我在 timesys arm-gcc 工具链上构建 1.35.0 和 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 工具链构建?