I have Ubuntu 12.01 with gcc 4.8.2 and would like to cross compile for the Vortex86DX CPU running an old 2.6.23 kernel.
I´m trying the following testing code:
#include <iostream>
int main()
{
std::cout << "Hello world" << std::endl;
}
That is compiled using the following command line:
g++ -static-libgcc -static-libstdc++ -march=i586 test.cpp -otest586
When I run the test586 on the target architecture I´m getting this error:
$ ./test586
./teste586: symbol lookup error: ./test586: undefined symbol: _ZMSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE
Any ideas of what is going on here ? This is just a small code - the real code has around 10 different libraries all written in C++ 11.
In fact the comment from Marco was right. The code still need some dynamics libraries:
$ ldd ./test586
linux-gate.so.1 => (0xb776b000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb75a4000)
/lib/ld-linux.so.2 (0xb776e000)
I have to avoid all dynamic library as the target system either does not have them or will have in a very old version.
Help appreciated to accomplish that.
I think the problem is the order of the command switches, i.e. the linker first discovers the dependencies (libgcc, libstdc++) and only then resolves them. If you give it -static-libgcc before it found the dependency then it will simply ignore it.
the following works for me: