On 01/13/2015 03:15 PM, mefyl wrote:
Hi,
In my quest cross-compiling Boost.Context for ARM64, I encounter the following problem (using develop since ARM64 support is not in 1.57):
$ ./bootstrap.sh --with-libraries=context [...] $ ./b2 -d2 -q toolset=clang architecture=arm abi=aapcs address-model=64 binary-format=mach-o [...] "clang++" -o "bin.v2/libs/system/build/clang-darwin-4.2.1/release/abi- aapcs/address-model-64/architecture-arm/threading-multi/libboost_system.dylib" -single_module -dynamiclib -install_name "libboost _system.dylib" "bin.v2/libs/system/build/clang-darwin-4.2.1/release/abi- aapcs/address-model-64/architecture-arm/threading-multi/error_code.o"
Despite asking for arm, the "-arch arm64" I would expect is not passed to clang which thus compile to x86_64. However Boost.Context DOES understand I'm targeting arm since it picks the right ASM file:
"clang++" -x assembler-with-cpp -O3 -O3 -finline-functions -Wno-inline - Wall -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1 - DBOOST_CONTEXT_DYN_LINK=1 -DBOOST_CONTEXT_SOURCE -DBOOST_SYSTEM_DYN_LINK=1 - DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_POSIX - DBOOST_THREAD_USE_DLL=1 -DNDEBUG -I"." -c -o "bin.v2/libs/context/build/clang- darwin-4.2.1/release/abi-aapcs/address-model-64/architecture-arm/threading- multi/asm/make_arm64_aapcs_macho_gas.o" "libs/context/src/asm/make_arm64_aapcs_macho_gas.S"
Which yields assembly errors of course since "-arch arm64" is not passed.
Other sources seem to manage to build Boost for ARM64 using darwin toolset forcing clang as the compiler and passing many additional options, but their setup fails to build Boost.Context since it either picks the wrong ASM file, either complains the platform is not supported.
Hi Quentin, it does not appear that anybody made clang-darwing.jam do anything about architecture or address-model features. Would the following patch work for you? diff --git a/src/tools/clang-darwin.jam b/src/tools/clang-darwin.jam index 51e5fad..2976030 100644 --- a/src/tools/clang-darwin.jam +++ b/src/tools/clang-darwin.jam @@ -72,6 +72,8 @@ rule init ( version ? : command * : options * ) SPACE = " " ; +flags clang-darwing OPTIONS <architecture>arm <address-model>64 : -arch arm64 ; + flags clang-darwin.compile OPTIONS <cflags> ; flags clang-darwin.compile.c++ OPTIONS <cxxflags> ; # flags clang-darwin.compile INCLUDES <include> ; -- Vladimir Prus CodeSourcery / Mentor Embedded http://vladimirprus.com