我尝试使用arm64-v8a
的ndk-build构建Boost 1.58.0,但我遇到了问题。
当我运行bjam
时,它会以错误unrecognized command line option '-m64'
完成。
我发现了一些错误,而且#34;执行配置检查"部分 如:
- 32-bit : no
- 64-bit : yes
- arm : no
...
我想arm
字段应该是yes
,而且当我为armv7-a
构建它时,它会有很大不同。 armv7-a
的相应构建始终成功。
[环境]
使用的构建命令是
./bjam toolset=gcc-ndk10.android.21.arm64v8a.4.9 link=static \
runtime-link=static target-os=linux --stagedir=output/arm64-v8a \
--disable-filesystem2 -sICONV_PATH=/home/weareff/local.r10/arm64-v8a/include
我的user-config.jam
文件如下:
# NDK 10, android-21, arm64-v8a, 4.9,
using gcc : ndk10.android.21.arm64v8a.4.9 : /home/weareff/external/android-ndk/android-ndk-r10/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86/bin/aarch64-linux-android-gcc :
<compileflags>--sysroot=/home/weareff/external/android-ndk/android-ndk-r10/platforms/android-21/arch-arm64
<compileflags>-D_LITTLE_ENDIAN
<compileflags>-D_POSIX_THREADS=1
<compileflags>-D_POSIX_SOURCE
<compileflags>-DANDROID
<compileflags>-march=armv8-a
<compileflags>-mtune=cortex-a53
<compileflags>-fpic
<compileflags>-ffunction-sections
<compileflags>-funwind-tables
<compileflags>-fstack-protector
<compileflags>-fno-short-enums
<compileflags>-fomit-frame-pointer
<compileflags>-fno-strict-aliasing
<compileflags>-finline-limit=64
<compileflags>-Wno-psabi
<compileflags>-Os
<compileflags>-O2
<compileflags>-g
<compileflags>-I"/home/weareff/external/android-ndk/android-ndk-r10/platforms/android-21/arch-arm64/usr/include"
<compileflags>-I"/home/weareff/external/android-ndk/android-ndk-r10/platforms/android-21/arch-arm64/usr/local/include"
<compileflags>-I"/home/weareff/external/android-ndk/android-ndk-r10/sources/cxx-stl/gnu-libstdc++/4.9/include"
<compileflags>-I"/home/weareff/external/android-ndk/android-ndk-r10/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include"
<linkflags>-L"/home/weareff/external/android-ndk/android-ndk-r10/platforms/android-21/arch-arm64/usr/lib" -stdlib=libstdc++
<archiver>/home/weareff/external/android-ndk/android-ndk-r10/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86/bin/aarch64-linux-android-ar
;
输出消息如下:
Performing configuration checks
- 32-bit : no
- 64-bit : yes
- arm : no
- mips1 : no
- power : no
- sparc : no
- x86 : no
- combined : no
Building the Boost C++ Libraries.
- has_icu builds : no
- lockfree boost::atomic_flag : no
Component configuration:
- atomic : not building
- chrono : not building
- container : not building
- context : not building
- coroutine : not building
- date_time : building
- exception : not building
- filesystem : building
- graph : not building
- graph_parallel : not building
- iostreams : not building
- locale : not building
- log : not building
- math : not building
- mpi : not building
- program_options : not building
- python : not building
- random : not building
- regex : building
- serialization : not building
- signals : not building
- system : building
- test : not building
- thread : building
- timer : not building
- wave : not building
...patience...
...found 1318 targets...
...updating 86 targets...
common.mkdir bin.v2/libs/date_time
common.mkdir bin.v2/libs/date_time/build
common.mkdir bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9
common.mkdir bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9/release
common.mkdir bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9/release/link-static
common.mkdir bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9/release/link-static/runtime-link-static
common.mkdir bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9/release/link-static/runtime-link-static/threading-multi
common.mkdir bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9/release/link-static/runtime-link-static/threading-multi/gregorian
gcc.compile.c++ bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9/release/link-static/runtime-link-static/threading-multi/gregorian/greg_month.o
aarch64-linux-android-gcc: error: unrecognized command line option '-m64'
"/home/weareff/external/android-ndk/android-ndk-r10/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86/bin/aarch64-linux-android-gcc" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall --sysroot=/home/weareff/external/android-ndk/android-ndk-r10/platforms/android-21/arch-arm64 -pthread -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_DATE_TIME_STATIC_LINK -DDATE_TIME_INLINE -DNDEBUG -I"." -c -o "bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9/release/link-static/runtime-link-static/threading-multi/gregorian/greg_month.o" "libs/date_time/src/gregorian/greg_month.cpp"
...failed gcc.compile.c++ bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9/release/link-static/runtime-link-static/threading-multi/gregorian/greg_month.o...
gcc.compile.c++ bin.v2/libs/date_time/build/gcc-ndk10.android.21.arm64v8a.4.9/release/link-static/runtime-link-static/threading-multi/gregorian/greg_weekday.o
aarch64-linux-android-gcc: error: unrecognized command line option '-m64'
答案 0 :(得分:1)
您可以尝试按照配置选项进行操作:
BS_CONFIG_EXTRA := -d2 -q toolset=gcc architecture=arm abi=aapcs address-model=64
./bootstrap.sh && ./b2 $(BS_CONFIG_EXTRA)
我已成功编译了aarch64硬件中的boost 1.58.0库。
问候。
答案 1 :(得分:0)
架构检查手臂说&#34; no&#34;应该由{boost_root} /libs/config/checks/architecture/arm.cpp中的文件引起,该文件包含以下内容:
#if !defined(__arm__) && !defined(__thumb__) && \
!defined(__TARGET_ARCH_ARM) && !defined(__TARGET_ARCH_THUMB) && \
!defined(_ARM) && !defined(_M_ARM)
#error "Not ARM"
#endif
arm64 gcc无法编译此文件,我们可以通过添加&#34; aarch64 &#34;来修补它,所以它变为:
#if !defined(__arm__) && !defined(__thumb__) && \
!defined(__TARGET_ARCH_ARM) && !defined(__TARGET_ARCH_THUMB) && \
!defined(_ARM) && !defined(_M_ARM) && !defined(__aarch64__)
#error "Not ARM"
#endif
这可能使架构检查认识到这是arm平台。