Tilera 交叉编译 - 链接错误
我正在尝试交叉编译 Tilera 的源代码,但在链接时出现以下错误。 所有这些错误都与C++ STL(标准模板库)有关。
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
I'm trying to cross compile a source for Tilera and I got the following error while linking.
All these errors are related to C++ STL(Standard Template Library).
Is there any difference in linking process of a STL library?
Errors are:
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为这会有所帮助。我之前尝试用 Tilera 进行编译并得到类似的错误,“未定义的引用”。解决方案是将库包含在项目属性中。
单击项目设置,转到“路径和符号”,然后在库下包含定义了
stlp_std::_Atomic_swap_struct<0>::_S_swap_lock
的库。另请注意,Tilera IDE (eclipse) 是愚蠢的。定义 Tile 库的路径将不起作用!只需输入图书馆的名称即可。 (假设您正确设置了 IDE 变量)。如果您使用命令行,只需添加参数即可包含该库
-lMyLibrary
这是一个示例:
在库下有:
我假设你正在Linux下开发
I think this will help. I tried compiling with Tilera before and got similar errors, "undefined reference to". The solution was to include the library in the project properties.
Click on your project settings, go to Paths and Symbols, and under libraries include the library the
stlp_std::_Atomic_swap_struct<0>::_S_swap_lock
is defined in.Also note that Tilera IDE (eclipse) is dumb. Defining the path to your Tile library will not work! Just type in the name of the library. (Given the fact that you set up your IDE variables correctly). If you are using command lines, include the library by simply adding the argument
-lMyLibrary
Here is an example:
Under libraries there is:
I assume you are developing under Linux
“STL”只是 C++ 实现的一部分。它不应该被专门链接,就像您不需要专门链接
malloc
或new
一样。The "STL" is just part of your C++ implementation. It shouldn't be linked specifically, just like you don't need to link
malloc
ornew
specifically.如果我编译一个使用 _S_swap_lock 的小程序,它对我有用:
这是“<1>” flavor,用于 32 位原子,这似乎很常用。我没有看到 <0> libsupc++.a 中的风味。我怀疑您需要发布一些重现问题的代码。
If I compile a small program that uses , which uses _S_swap_lock, it works for me:
This is the "<1>" flavor, for 32-bit atomics, which seems to be commonly used. I don't see the <0> flavor in libsupc++.a. I suspect you'll need to post some code that reproduces the problem.