linux下Ubuntu交叉编译boost源码编译

源码下载,选择需要的版本下载压缩包然后解压。
https://boostorg.jfrog.io/ui/native/main/release/
1.解压后执行脚本
./bootstrap.sh
2.修改生成的project-config.jam文件
修改为如下,注意空格和自己交叉编辑文件目录

using gcc : : /home/linux-x86/aarch64/toolchain-sunxi-glibc/toolchain/bin/aarch64-openwrt-linux-gnu-gcc ; 

以及修改option设置如下

option.set prefix : /home/linux-x86/aarch64/toolchain-sunxi-glibc/toolchain ; 
option.set exec-prefix : /home/linux-x86/aarch64/toolchain-sunxi-glibc/toolchain/bin ; 
option.set libdir : /home/linux-x86/aarch64/toolchain-sunxi-glibc/toolchain/lib ; 
option.set includedir : /home/linux-x86/aarch64/toolchain-sunxi-glibc/toolchain/include ;

3.执行./b2程序开始编译
如果修改不对,编译开始就会报如下类似错误;

error: toolset gcc initialization:
error: provided command 'aarch64-openwrt-linux-gnu-gcc' not found
error: initialized from project-config.jam:12

4.编译完成的静态和动态库文件就在stage目录下.

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

/home/riki/download/boost_1_74_0

The following directory should be added to linker library paths:

    /home/riki/download/boost_1_74_0/stage/lib

你可能感兴趣的:(C++基础,ubuntu,linux,boost)