加大对GCC臂工具链C ++库 [英] Boost C++ libraries for gcc-arm toolchain

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

问题描述

我对TimeSys的手臂gcc工具没有烦恼建设1.35.0,以及1.36.0,无论是静态(链接静态)和动态(。所以,默认选项)。

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

 的#include<升压/ filesystem.hpp>
#包括LT&;的iostream>命名空间FS =的boost ::文件系统;INT主(INT ARGC,CHAR *的argv []){
    为const char *文件名=的argv [1];
    性病::法院LT&;< 文件:<<文件名<< =><< FS ::存在(文件名)<<的std :: ENDL;
    返回0;
}

我得到下面的连接错误:

 
开发商@ eldp01:〜/升压/测试$ /选择/ TimeSys公司/ at91sam9263_ek /工具链/斌/ armv5l-TimeSys的-Linux的gnueabi-GCC
  exists.cpp -o exists.exe -I ../boost_1_35_0/ -lboost_filesystem -lboost_system -lstdc ++ -L。/tmp/ccex3NGb.o:在函数'的boost ::详细:: atomic_decrement为(int *)':
exists.cpp:(.text._ZN5boost6detail16atomic_decrementEPi[boost::detail::atomic_decrement(int*)]+0x1c):
  未定义的引用`__sync_fetch_and_add_4/tmp/ccex3NGb.o:在函数'的boost ::详细:: atomic_increment为(int *)':
exists.cpp:(.text._ZN5boost6detail16atomic_incrementEPi[boost::detail::atomic_increment(int*)]+0x1c):
  未定义的引用`__sync_fetch_and_add_4collect2:劳工处返回1退出状态

有谁知道我怎样才能推动建立海合会臂工具链?


解决方案

您需要在文件中添加boost_1_35_0 /升压/配置/ user.hpp中

 的#define BOOST_SP_USE_PTHREADS

顺便说一句,你需要设置GCC工具链中的文件'boost_1_35_0 /工具/建设/ V2 /用户config.jam中到:


 使用gcc
        :手臂
        中:/ opt / TimeSys公司/ at91sam9263_ek /工具链/斌/ 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臂工具链C ++库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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