构建1.35.0以及在timesys arm-gcc工具链上的1.36.0,无论是静态(链接静态)还是动态(.so,默认选项)都没有问题。

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

#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;
}

我收到以下链接器错误:


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

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

有帮助吗?

解决方案 2

您需要添加文件'boost_1_35_0 / boost / config / user.hpp':

#define BOOST_SP_USE_PTHREADS
不过,您需要将文件'boost_1_35_0 / tools / build / v2 / user-config.jam'中的gcc工具链设置为:

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

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

其他提示

此处回答了一个几乎完全相同的问题。提升邮件列表。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top