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).
構建1.35.0以及在timesys arm-gcc工具鏈上的1.36.0,無論是靜態(鏈接靜態)還是動態(.so,默認選項)都沒有問題。
However, when I try to link a simple sample filesystem app:
但是,當我嘗試鏈接一個簡單的示例文件系統應用程序時:
#include
#include
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?
有誰知道如何讓我的Boost為gcc-arm工具鏈構建?
2 个解决方案
#1
3
An almost identical question was answered here on the Boost mailing list.
在Boost郵件列表中回答了幾乎完全相同的問題。
#2
3
You need to add in file 'boost_1_35_0/boost/config/user.hpp':
您需要添加文件'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:
順便說一句,你需要將文件'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
;
This will solve the problem of linking now.
這將解決現在鏈接的問題。