TDA4编译boost_1_58_0,及解决error: unrecognized command line option “-m64“错误

本文档记录了如何在TDA4平台上针对boost_1_58_0版本进行编译的过程。首先从SourceForge下载源码并解压,接着使用`bootstrap.sh`配置编译选项,遇到`-m64`编译错误后,修改`project-cache.jam`文件以适配arm架构。修复后成功编译,最后通过`b2 install`命令进行安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近在TDA4上开发系统中间件,用到了一些boost1_58_0的接口,但是TDA4现在的系统库中使用的时boost_1_72_0版本,因此,需要重新编译boost库,在此,记录下编译过程。

  1. 下载源码:
    在https://sourceforge.net/projects/boost/files/boost/1.58.0/中选择boost_1_58_0.tar.gz,并下载。
    将boost_1_58_0.tar.gz拷贝到TDA4上,并解压。
  2. 编译boost_1_58_0
cd boost_1_58_0
#./bootstrap.sh
./bootstrap.sh --with-libraries=all --with-toolset=gcc

会生成b2可执行程序,然后执行./b2进行编译。
3. 解决编译错误
在执行./b2命令,会生成bin.v2文件夹,并会报错 error: unrecognized command line option “-m64”。
错误原因为没有指定编译arm版本。
解决方法:修改bin.v2中的project-cache.jam文件:
将"arm-…"和"gcc-…"的改为true

set "arm-<target-os>linux-<toolset-gcc:version>9.2.1-<toolset>gcc" : "true" ;
set "arm-<address-model>64-<target-os>linux-<toolset-gcc:version>9.2.1-<toolset>gcc" : "true" ;
set "gcc visibility-<address-model>64-<target-os>linux-<toolset-gcc:version>9.2.1-<toolset>gcc" : "true" ;
set "64-bit-<target-os>linux-<toolset-gcc:version>arm-<toolset>gcc" : "true" ;
set "arm-<target-os>linux-<toolset-gcc:version>arm-<toolset>gcc" : "true" ;
set "arm-<address-model>64-<target-os>linux-<toolset-gcc:version>arm-<toolset>gcc" : "true" ;
set "gcc visibility-<address-model>64-<architecture>arm-<target-os>linux-<toolset-gcc:version>arm-<toolset>gcc" : "true" ;

然后在执行./b2就开始编译了。
成功后打印出:

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /../boost_1_58_0

The following directory should be added to linker library paths:

    /../boost_1_58_0/stage/lib

4.安装
执行命令:

./b2 install
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值