Tilera cross compilation - linking errors
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::_A开发者_运维技巧tomic_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 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:
tmc
pthread
I assume you are developing under Linux
The "STL" is just part of your C++ implementation. It shouldn't be linked specifically, just like you don't need to link malloc
or new
specifically.
If I compile a small program that uses , which uses _S_swap_lock, it works for me:
$ 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
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.
精彩评论