使用交叉编译工具为龙芯编译Boost1.81

下载交叉编译工具:

wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2
tar jxvf ./boost_1_81_0.tar.bz2

 将交叉编译工具目录移动到合适的位置。

创建Boost配置文件设置交叉编译工具:

vim /root/user-cofig.jam

因为后面要用sudo ./b2 install ......,所以这个文件必须创建在root主目录,我就是创建在当前用户主目录,浪费了大量时间找问题,并且这个坑踩了两次。

using gcc : loongarch : /opt/loongarch64-gcc-8.3.0/bin/loongarch64-linux-gnu-g++ ;

注意其中6个空格一个都不能少,上面的g++文件名和路径换成自己的。

生成b2工具:

tar jxvf ./boost_1_81_0.tar.bz2
cd boost_1_81_0
./bootstrap.sh --prefix=/opt/loongarch64

编译和安装所需的库:

sudo ./b2 install toolset=gcc-loongarch architecture=loongarch binary-format=elf link=static --with-chrono --with-json --with-filesystem --with-context --with-coroutine --with-program_options --with-date_time --with-atomic --with-container --with-locale --with-serialization --with-url --with-stacktrace --with-system

你可能感兴趣的:(linux,c++)