#android #c #boost #cmake #conan
Вопрос:
Я пытался скомпилировать некоторые библиотеки conan с помощью Android ndk с моей linux-машины. При попытке перекрестной компиляции я получаю ошибку сбоя сборки. Другие пакеты conan отлично скомпилируются, кроме boost. Я добавил профиль конана и журнал ошибок.
Мой профиль конана:
include(default)
[settings]
arch=armv8
build_type=Release
compiler=clang
compiler.libcxx=libc
compiler.version=12
os=Android
os.api_level=21
[build_requires]
[options]
[env]
ANDROID_NDK_ROOT=/home/local/Downloads/android-ndk-r23
WARN: replace_in_file didn't find pattern '$(>) > $(<)' in '/home/local/.conan /data/boost/1.76.0/_/_/source/source_subfolder/libs/stacktrace/build/Jamfile.v2' file.
WARN: replace_in_file didn't find pattern '/* thread_local */' in '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost/stacktrace/detail/libbacktrace_impls.hpp' file.
WARN: replace_in_file didn't find pattern '/* static __thread */' in '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost/stacktrace/detail/libbacktrace_impls.hpp' file.
boost/1.76.0: WARN: Patching user-config.jam
boost/1.76.0: WARN:
using zlib : 1.2.11 : <include>"/home/local/.conan/data/zlib/1.2.11/_/_/package/18bbcddf275ee23aa172cdc6dbfa549e2411acfd/include" <search>"/home/local/.conan/data/zlib/1.2.11/_/_/package/18bbcddf275ee23aa172cdc6dbfa549e2411acfd/lib" <name>z ;
using bzip2 : 1.0.8 : <include>"/home/local/.conan/data/bzip2/1.0.8/_/_/package/a765640a31d963ba8d5612cab2f1811597d3de80/include" <search>"/home/local/.conan/data/bzip2/1.0.8/_/_/package/a765640a31d963ba8d5612cab2f1811597d3de80/lib" <name>bz2 ;
using "clang-linux" : : :
<compileflags>"-I/home/local/.conan/data/libbacktrace/cci.20210118/_/_/package/18bbcddf275ee23aa172cdc6dbfa549e2411acfd/include" <linkflags>"-L/home/local/.conan/data/libbacktrace/cci.20210118/_/_/package/18bbcddf275ee23aa172cdc6dbfa549e2411acfd/lib" ;
boost/1.76.0: Cross building, detecting compiler...
boost/1.76.0: Cross building flags: []
boost/1.76.0: WARN: b2 -q numa=on target-os=android architecture=arm address-model=64 binary-format=elf abi=aapcs --layout=system --user-config=/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=on boost.locale.iconv.lib=libc threading=multi visibility=hidden link=static variant=release --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave toolset=clang-linux pch=on cxxflags="-fPIC -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=/usr/bin/addr2line" install --prefix=/home/local/.conan/data/boost/1.76.0/_/_/package/1e5ed3b96aff577e610fddd01bd296a709542e8c -j12 --abbreviate-paths -d0 --debug-configuration --build-dir="/home/local/.conan/data/boost/1.76.0/_/_/build/1e5ed3b96aff577e610fddd01bd296a709542e8c"
notice: found boost-build.jam at /home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost-build.jam
notice: loading B2 from /home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/bootstrap.jam
warning: mismatched versions of B2 engine and core
warning: B2 engine (b2) is 4.5.0
warning: B2 core (at /home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src) is 4.4-git
notice: Searching '/etc' '/home/local' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/kernel' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/util' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/tools' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/contrib' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/.' for site-config configuration file 'site-config.jam'.
notice: Configuration file 'site-config.jam' not found in '/etc' '/home/local' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/kernel' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/util' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/tools' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/contrib' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/.'.
notice: Loading explicitly specified user configuration file:
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam
notice: Searching '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build'.
notice: [zlib] Using pre-installed library
notice: [zlib] Condition
notice: [bzip2] Using pre-installed library
notice: [bzip2] Condition
warning: toolset clang-linux initialization: can not find tool clang
warning: initialized from /home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam:5
sh: 1: clang : not found
notice: will use 'clang ' for clang-linux, condition <toolset>clang-linux
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/tools/clang-linux.jam:69: in clang-linux.init
*** argument error
* rule clang.init-cxxstd-flags ( toolset : condition * : version )
* called with: ( clang-linux : <toolset>clang-linux : )
* missing argument version
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/tools/clang.jam:54:see definition of rule 'clang.init-cxxstd-flags' being called
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build/toolset.jam:44: in toolset.using
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build/project.jam:1104: in using
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam:5: in modules.load
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build-system.jam:255: in load-config
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build-system.jam:449: in load-configuration-files
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build-system.jam:607: in load
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/kernel/modules.jam:295: in import
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/kernel/bootstrap.jam:139: in boost-build
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost-build.jam:17: in module scope
boost/1.76.0:
boost/1.76.0: ERROR: Package '1e5ed3b96aff577e610fddd01bd296a709542e8c' build failed
boost/1.76.0: WARN: Build folder /home/local/.conan/data/boost/1.76.0/_/_/build/1e5ed3b96aff577e610fddd01bd296a709542e8c
ERROR: boost/1.76.0: Error in build() method, line 807
self.run(full_command, run_environment=True)
ConanException: Error 1 while executing b2 -q numa=on target-os=android architecture=arm address-model=64 binary-format=elf abi=aapcs --layout=system --user-config=/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=on boost.locale.iconv.lib=libc threading=multi visibility=hidden link=static variant=release --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave toolset=clang-linux pch=on cxxflags="-fPIC -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=/usr/bin/addr2line" install --prefix=/home/local/.conan/data/boost/1.76.0/_/_/package/1e5ed3b96aff577e610fddd01bd296a709542e8c -j12 --abbreviate-paths -d0 --debug-configuration --build-dir="/home/local/.conan/data/boost/1.76.0/_/_/build/1e5ed3b96aff577e610fddd01bd296a709542e8c"
Комментарии:
1. Пакет boost использует встроенную систему сборки boost, и сам рецепт может не иметь поддержки для рассмотрения перекрестного построения Android. Вероятно, лучше всего было бы сообщить в репозиторий ConanCenter github, где живут рецепты, а сообщество и сотрудники работают над этим: github.com/conan-io/conan-center-index/issues