moritz-wundke / Boost-for-Android

Android port of Boost C++ Libraries
MIT License
1.02k stars 485 forks source link

"No best alternative for libs/context/build/asm_sources" with armeabi-v7a architecture #130

Open ivilata opened 6 years ago

ivilata commented 6 years ago

(This might be related with #122, although the errors that I see are more similar to those in #69.)

I'm running the build script like this in a Debian Testing Vagrant instance:

$ sh -x ./build-android.sh --boost=1.65.1 --arch=armeabi-v7a \
   --with-libraries=regex,context,coroutine,program_options,system,test,thread,filesystem,date_time \
   /home/vagrant/android/android-ndk-r16b

I see that bjam gets invoked like this:

./bjam -q -j8 target-os=android toolset=clang-armeabiv7a link=static threading=multi --layout=versioned \
  -sICONV_PATH=/home/vagrant/android/Boost-for-Android/boost_1_65_1/../libiconv-libicu-android/armeabi-v7a \
  -sICU_PATH=/home/vagrant/android/Boost-for-Android/boost_1_65_1/../libiconv-libicu-android/armeabi-v7a \
  --build-dir=./.././build//build/armeabi-v7a --prefix=./.././build//out/armeabi-v7a \
  --with-date_time --with-filesystem --with-thread --with-test --with-system \
  --with-program_options --with-coroutine --with-context --with-regex install

The output shows this (as in #69):

Performing configuration checks

    - 32-bit                   : yes
    - arm                      : yes
    - symlinks supported       : yes
error: No best alternative for libs/context/build/asm_sources
    next alternative: required properties: <abi>aapcs <address-model>32 <architecture>arm <binary-format>elf <threading>multi <toolset>clang
        not matched
    next alternative: required properties: <abi>aapcs <address-model>32 <architecture>arm <binary-format>elf <threading>multi <toolset>gcc
        not matched
[… more next alternatives, none with armeabiv7a …]

Boost still seems to build (the script invocation doesn't report an error code), yet while linking the static libraries with other code, I get this:

[ 98%] Linking CXX executable test-cache
cd /home/vagrant/android/build-project/test && /usr/bin/cmake -E cmake_link_script CMakeFiles/test-cache.dir/link.txt --verbose=1
/home/vagrant/android/android-ndk-r16b-toolchain-android21-arm-libc++/bin/clang++  --target=armv7-none-linux-androideabi --gcc-toolchain=/home/vagrant/android/android-ndk-r16b-toolchain-android21-arm-libc++ --sysroot=/home/vagrant/android/android-ndk-r16b-toolchain-android21-arm-libc++/sysroot  -I /home/vagrant/android/android-ifaddrs -I /home/vagrant/android/openssl-1.1.0g/include -std=c++14 -pthread -Wall -ggdb  -g  -Wl,--fix-cortex-a8  -fPIE -pie -Wl,--gc-sections -Wl,-z,nocopyreloc CMakeFiles/test-cache.dir/test_cache_control.cpp.o CMakeFiles/test-cache.dir/__/src/cache_control.cpp.o  -o test-cache /home/vagrant/android/Boost-for-Android/build/out/armeabi-v7a/lib/libboost_filesystem-clang-mt-1_65_1.a /home/vagrant/android/Boost-for-Android/build/out/armeabi-v7a/lib/libboost_regex-clang-mt-1_65_1.a /home/vagrant/android/Boost-for-Android/build/out/armeabi-v7a/lib/libboost_unit_test_framework-clang-mt-1_65_1.a /home/vagrant/android/Boost-for-Android/build/out/armeabi-v7a/lib/libboost_program_options-clang-mt-1_65_1.a /home/vagrant/android/Boost-for-Android/build/out/armeabi-v7a/lib/libboost_coroutine-clang-mt-1_65_1.a /home/vagrant/android/Boost-for-Android/build/out/armeabi-v7a/lib/libboost_context-clang-mt-1_65_1.a /home/vagrant/android/Boost-for-Android/build/out/armeabi-v7a/lib/libboost_thread-clang-mt-1_65_1.a /home/vagrant/android/Boost-for-Android/build/out/armeabi-v7a/lib/libboost_date_time-clang-mt-1_65_1.a /home/vagrant/android/Boost-for-Android/build/out/armeabi-v7a/lib/libboost_system-clang-mt-1_65_1.a
libs/coroutine/src/detail/coroutine_context.cpp:41: error: undefined reference to 'make_fcontext'
libs/coroutine/src/detail/coroutine_context.cpp:68: error: undefined reference to 'jump_fcontext'
clang50++: error: linker command failed with exit code 1 (use -v to see invocation)
test/CMakeFiles/test-cache.dir/build.make:129: recipe for target 'test/test-cache' failed
make[2]: *** [test/test-cache] Error 1
make[2]: Leaving directory '/scratch/vagrant/android/build-project
CMakeFiles/Makefile2:639: recipe for target 'test/CMakeFiles/test-cache.dir/all' failed

It looks like the assembler part of the context library were not built at all. Hardcoding architecture=arm abi=aapcs binary-format=elf in bjam's invocation (see) seemed to do the trick, but it's obviously not a proper fix. Turning TOOLSET_ARCH=clang-armeabiv7a into TOOLSET_ARCH=clang-arm before invoking bjam made the "No best alternative" error go away but x86_64 libraries were built instead (which may be what's seen in #122).

If you need more info, please ask for it. Thanks a lot!

MaxClerkwell commented 5 years ago

Hi, I am running in somewhat similar issues while trying to cross-compile for a debian running on beaglebone black.

`Performing configuration checks

- default address-model    : 32-bit (cached)
- default architecture     : arm (cached)

Building the Boost C++ Libraries.

error: No best alternative for libs/context/build/asm_sources next alternative: required properties: aapcs 32 arm elf multi clang not matched next alternative: required properties: aapcs 32 arm elf multi gcc not matched next alternative: required properties: aapcs 32 arm elf multi qcc not matched next alternative: required properties: aapcs 32 arm mach-o multi clang not matched next alternative: required properties: aapcs 32 arm mach-o multi darwin not matched next alternative: required properties: aapcs 32 arm pe multi msvc not matched next alternative: required properties: aapcs 64 arm elf multi clang not matched next alternative: required properties: aapcs 64 arm elf multi gcc not matched next alternative: required properties: aapcs 64 arm mach-o multi clang not matched next alternative: required properties: aapcs 64 arm mach-o multi darwin not matched next alternative: required properties: o32 32 mips1 elf multi clang not matched next alternative: required properties: o32 32 mips1 elf multi gcc not matched next alternative: required properties: sysv 32 power elf multi clang not matched next alternative: required properties: sysv 32 power elf multi gcc not matched next alternative: required properties: sysv 32 power mach-o multi darwin not matched next alternative: required properties: sysv 32 power xcoff multi clang not matched ..... ` boost-error.txt

May someone what you actually did to fix this? Or some place I could get additional help? I really need this :D

Cheers Stephan

MaxClerkwell commented 5 years ago

Okay, fixed it by compiling with following options

./b2 --prefix=~/boostForBBB/ --without-context --without-coroutine --without-fiber --without-python --address-model=32 --stagedir=~/boostForBBBstage-arm-gnueabihf-g++/ -j3 -toolset=arm-linux-gnueabihf-g++ -threading=multi

jpo38 commented 5 years ago

@bjoekeldude : What exactly did you modify on the command line or jam file to fix this error? I'm tryin gto compile for armv7a and am constatntly getting this error "No best alternative for..."