2010-11-17 203 views
0

我想交叉編譯Tilera的源代碼,並且在鏈接時出現以下錯誤。 所有這些錯誤都與C++ STL(標準模板庫)有關。Tilera交叉編譯 - 鏈接錯誤

STL庫的鏈接過程有什麼區別嗎?

錯誤是:

gtpu_t. a: In function `stlp_std::_Atomic_swap_struct<0>::_S_swap(unsigned int volatile* , unsigned int)': 
91 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :588: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock' 
92 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :588: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock' 
93 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :591: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock' 
94 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :591: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock' 
95 /u/TILERA/LTESTACK/TILERA/DEV/lte/lte_enb/enb_app/../enb_gtpu/gtpu_t/lib/gtpu_t. a: In function `stlp_std::_Atomic_swap_struct<0>::_S_swap_ptr(void* volatile*, v oid*)': 
96 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :614: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock' 
97 /u/TILERA/LTESTACK/TILERA/DEV/lte/lte_enb/enb_app/../enb_gtpu/gtpu_t/lib/gtpu_t. a:/u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads .h:614: more undefined references to `stlp_std::_Atomic_swap_struct<0>::_S_swap_ lock' follow 

回答

0

的 「STL」 只是你的C++實現的一部分。它不應特別鏈接,就像你不需要特別鏈接mallocnew

0

如果我編譯使用的小程序,它使用_S_swap_lock,它爲我工作:

$ cat foo.cc 
#include <rope> 
int main(void) 
{ 
    std::crope r(100000, 'x'); 
    std::crope r2 = r + "abc"; 
} 
$ tile-c++ foo.cc 
$ nm -C a.out | grep -i atomic 
0000000000059028 V stlp_std::_Atomic_swap_struct<1>::_S_swap_lock 

這是「< 1>」的味道,32位原子公司,這似乎是普遍用過的。在libsupC++中沒有看到< 0> a。我懷疑你需要發佈一些代碼來重現問題。

+0

嗨Chris,我們的_threads.h文件包含_Atomic_swap_struct的2個定義,因此可以與我們共享_threads.h文件。 – arun 2010-11-19 05:18:03

1

我認爲這會有所幫助。我之前嘗試使用Tilera進行編譯,並得到類似的錯誤,「未定義的引用」。解決方案是將該庫包含在項目屬性中。

點擊您的項目設置,去路徑和符號,並在庫包括庫中的stlp_std::_Atomic_swap_struct<0>::_S_swap_lock中定義。

還要注意的是Tilera的IDE(日蝕)是愚蠢的。定義Tile庫的路徑不起作用!只需輸入圖書館的名稱。 (鑑於你正確設置你的IDE變量)。如果您是使用命令行,通過簡單地添加參數
-lMyLibrary

這裏包括圖書館是一個例子:Linux的

下正在開發

tmc 
pthread 

我想你:
在庫有