使用GCC使用arm64_v8a构建Android的Boost

时间:2019-05-23 17:59:25

标签: c++ gcc boost android-ndk arm64

我正在尝试使用GCC为NDK 17c构建支持arm64的Boost库(我们尚未转移到clang)。

这是user.config.jam:

# ----------------------
# Android configuration.
# ----------------------

using gcc : androidR8
:
$ANDROID_NDK_ROOT/toolchains/bin/arm-linux-androideabi-g++
:
<archiver>arm-linux-androideabi-ar
<compileflags>-fexceptions
<compileflags>-frtti
<compileflags>-fpic
<compileflags>-ffunction-sections
<compileflags>-funwind-tables
<compileflags>-D__ARM_ARCH_5__
<compileflags>-D__ARM_ARCH_5T__
<compileflags>-D__ARM_ARCH_5E__
<compileflags>-D__ARM_ARCH_5TE__
<compileflags>-Wno-psabi
<compileflags>-march=armv5te
<compileflags>-mtune=xscale
<compileflags>-msoft-float
<compileflags>-mthumb
<compileflags>-Os
<compileflags>-fomit-frame-pointer
<compileflags>-fno-strict-aliasing
<compileflags>-finline-limit=64
<compileflags>-I${ANDROID_NDK_ROOT}/platforms/android-26/arch-arm/usr/include
<compileflags>-Wa,--noexecstack
<compileflags>-DANDROID
<compileflags>-D__ANDROID__
<compileflags>-DNDEBUG
<compileflags>-O2
<compileflags>-g
<compileflags>-I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/include
<compileflags>-I${ANDROID_NDK_ROOT}/sysroot/usr/include
<compileflags>-I${ANDROID_NDK_ROOT}/sysroot/usr/include/arm-linux-androideabi/
<compileflags>-I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include
# @Moss - Above are the 'official' android flags
<address-model>64
<architecture>arm
<compileflags>-fvisibility=hidden
<compileflags>-fvisibility-inlines-hidden
<compileflags>-fdata-sections
<cxxflags>-D__arm__
<cxxflags>-D_REENTRANT
<cxxflags>-D_GLIBCXX__PTHREADS
;

如图所示,我已设置:

<compileflags>-I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include

<address-model>64

to build for arm64_v8a. Still, the generated binary objdumps:

objdump -D libboost_atomic-gcc-mt-1_62.a

libboost_atomic-gcc-mt-1_62.a(lockpool.o):  file format ELF32-arm-little

这是我的bjam命令:

cmd="env PATH=$(dirname $CXXPATH):$PATH \
        AndroidNDKRoot=$(GetNDK) NO_BZIP2=1 \
        ./bjam toolset=$TOOLSET -q \
            cxxflags=\"$CXXFLAGS\" \
            link=static threading=multi --layout=versioned install";

TOOLSET=gcc-androidR8
CXXFLAGS=-fPIC
CXXPATH=android-ndk/toolchains/bin/arm-linux-androideabi-g++

它适合armeabi-v7a。

如何使Boost生成带有gcc的arm64库?

0 个答案:

没有答案