5

timesys arm-gcc ツールチェーンで 1.35.0 と 1.36.0 を静的 (link-static) と動的 (.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 ツールチェーン用にビルドする方法を知っている人はいますか?

4

2 に答える 2

3

ファイル'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
;

これにより、リンクの問題が解決されます。

于 2008-10-28T00:29:55.863 に答える
3

Boostメーリングリストでは、ほぼ同じ質問に回答しました。

于 2008-10-27T22:52:58.650 に答える