用于 gcc-arm 工具链的 Boost C++ 库 [英] Boost C++ libraries for gcc-arm toolchain

查看:32
本文介绍了用于 gcc-arm 工具链的 Boost C++ 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以轻松地在 timesys arm-gcc 工具链上构建 1.35.0 和 1.36.0,无论是静态(链接静态)还是动态(.so,默认选项).

但是,当我尝试链接一个简单的示例文件系统应用程序时:

#include #include 命名空间 fs = boost::filesystem;int main(int argc, char *argv[]) {const char* 文件名 = argv[1];std::cout <<文件:"<<文件名<<" => " <<fs::exists(fileName) <<std::endl;返回0;}

我收到以下链接器错误:

<代码>developer@eldp01:~/boost/test$/opt/timesys/at91sam9263_ek/toolchain/bin/armv5l-timesys-linux-gnueabi-gccexists.cpp -o exists.exe -I ../boost_1_35_0/-lboost_filesystem -lboost_system -lstdc++ -L ./tmp/ccex3NGb.o:在函数`boost::detail::atomic_decrement(int*)'中:存在.cpp:(.text._ZN5boost6detail16atomic_decrementEPi[boost::detail::atomic_decrement(int*)]+0x1c):对__sync_fetch_and_add_4"的未定义引用/tmp/ccex3NGb.o:在函数`boost::detail::atomic_increment(int*)'中:存在.cpp:(.text._ZN5boost6detail16atomic_incrementEPi[boost::detail::atomic_increment(int*)]+0x1c):对__sync_fetch_and_add_4"的未定义引用collect2: ld 返回 1 个退出状态

有谁知道我如何让 Boost 为 gcc-arm 工具链构建?

解决方案

你需要在文件'boost_1_35_0/boost/config/user.hpp'中加入:

#define BOOST_SP_USE_PTHREADS

顺便说一句,您需要将文件 'boost_1_35_0/tools/build/v2/user-config.jam' 中的 gcc 工具链设置为:

<块引用>

使用gcc: 手臂:/opt/timesys/at91sam9263_ek/toolchain/bin/armv5l-timesys-linux-gnueabi-gcc;

这将解决现在链接的问题.

I have no trouble building 1.35.0, as well as 1.36.0 on the timesys arm-gcc toolchain, both statically (link-static) as well as dynamically (.so, default option).

However, when I try to link a simple sample filesystem app:

#include <boost/filesystem.hpp>
#include <iostream>

namespace fs = boost::filesystem;

int main(int argc, char *argv[]) {
    const char* fileName = argv[1];
    std::cout << "file: " << fileName << " => " << fs::exists(fileName) << std::endl;
    return 0;
}

I get the following linker error:


developer@eldp01:~/boost/test$ /opt/timesys/at91sam9263_ek/toolchain/bin/armv5l-timesys-linux-gnueabi-gcc 
  exists.cpp -o exists.exe -I ../boost_1_35_0/ -lboost_filesystem -lboost_system -lstdc++ -L .

/tmp/ccex3NGb.o: In function `boost::detail::atomic_decrement(int*)':
exists.cpp:(.text._ZN5boost6detail16atomic_decrementEPi[boost::detail::atomic_decrement(int*)]+0x1c): 
  undefined reference to `__sync_fetch_and_add_4'

/tmp/ccex3NGb.o: In function `boost::detail::atomic_increment(int*)':
exists.cpp:(.text._ZN5boost6detail16atomic_incrementEPi[boost::detail::atomic_increment(int*)]+0x1c): 
  undefined reference to `__sync_fetch_and_add_4'

collect2: ld returned 1 exit status

Does anyone know how I can get Boost to build for the gcc-arm toolchain?

解决方案

You need to add in file 'boost_1_35_0/boost/config/user.hpp':

#define BOOST_SP_USE_PTHREADS

btw, you need to set the gcc tool-chain in file 'boost_1_35_0/tools/build/v2/user-config.jam' to:

using gcc
        : arm
        : /opt/timesys/at91sam9263_ek/toolchain/bin/armv5l-timesys-linux-gnueabi-gcc
;

This will solve the problem of linking now.

这篇关于用于 gcc-arm 工具链的 Boost C++ 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆