2010-11-17 201 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 

我想你:
在库有