質問

静的(link-static)と動的(.so、デフォルトオプション)の両方で、timesys arm-gccツールチェーンで1.35.0と1.36.0をビルドするのに問題はありません。

ただし、簡単なサンプルファイルシステムアプリをリンクしようとすると:

#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

gcc-armツールチェーン用にBoostをビルドする方法を知っている人はいますか?

役に立ちましたか?

解決 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