在Boost交叉编译之后指令,
已经运行了bootstrap.sh
,并创建了一个本地b2
。
和使用user-config.jam
using gcc : arm :arm-linux-gnueabihf-g++ ;
启动构建:
./b2 toolset=gcc-arm target-os=linux
Boost的b2
吐出一堆错误消息,并停止:
username@ubuntu:~/Code/boost_1_81_0$ ./b2 toolset=gcc-arm target-os=linux
/home/username/Code/boost_1_81_0/tools/build/src/util/numbers.jam:23: in numbers.check from module numbers
error: arm in arm
error: is not a number
/home/username/Code/boost_1_81_0/tools/build/src/build/version.jam:110: in version.version-compatible from module version
/home/username/Code/boost_1_81_0/tools/build/src/tools/common.jam:1132: in common.find-compiler from module common
/home/username/Code/boost_1_81_0/tools/build/src/tools/gcc.jam:165: in gcc.init from module gcc
/home/username/Code/boost_1_81_0/tools/build/src/build/toolset.jam:44: in toolset.using from module toolset
/home/username/Code/boost_1_81_0/tools/build/src/build-system.jam:543: in process-explicit-toolset-requests from module build-system
/home/username/Code/boost_1_81_0/tools/build/src/build-system.jam:610: in load from module build-system
/home/username/Code/boost_1_81_0/tools/build/src/kernel/modules.jam:294: in import from module modules
/home/username/Code/boost_1_81_0/tools/build/src/kernel/bootstrap.jam:135: in module scope from module
显然,它不期望指令所建议的值。
还有路吗?
我不确定到底是哪里出了问题,但是在Ubuntu 22.04上交叉编译arm-linux-gnueabihf
boost的完整工作过程将是:
# Retrieve/install cross-compiler.
wget https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
tar Jxf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
export CROSS_COMPILE=$(pwd)/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
# Retrieve/install boost source code.
wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2
tar jxf boost_1_81_0.tar.bz2
# Build boost
cd boost_1_81_0
echo "using gcc : arm : ${CROSS_COMPILE}g++ ;" > user_config.jam
./bootstrap.sh --prefix=$(pwd)/boost-1.81.0-arm-none-linux-gnueabihf
./b2 install toolset=gcc-arm link=static cxxflags=-fPIC --with-filesystem --with-test --with-log --with-program_options -j32 --user-config=user_config.jam
编译结束后,编译工件应该驻留在目录boost_1_81_0/boost-1.81.0-arm-none-linux-gnueabihf
中。