GCC Cross Combination with i586 Architecture (Vortex86DX)

I have Ubuntu 12.01 with gcc 4.8.2 and would like to cross compile for a Vortex86DX processor working with the old 2.6.23 kernel.

I am trying to execute the following test code:

#include <iostream>

int main()
{
   std::cout << "Hello world" << std::endl;
}

This is compiled using the following command line:

g++ -static-libgcc -static-libstdc++ -march=i586 test.cpp -otest586

When I run test586 on the target architecture, I get this error:

$ ./test586
./teste586: symbol lookup error: ./test586: undefined symbol: _ZMSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE

Any ideas on what's going on here? This is just a small code - in real code there are about 10 different libraries written in C ++ 11.


In fact, the comment from Marco was right. The code still needs dynamic 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 need to avoid all dynamic libraries, since the target system either does not have them, or will have them in a very old version.

Help evaluate this.

0
1

, , (libgcc, libstd++) . -static-libgcc, , .

:

$ g++ -m32 -march=i586 test.cpp -o test586 -static -static-libgcc -static-libstdc++
$ ./test586 
Hello world
$ ldd test586 
not a dynamic executable
+1

Source: https://habr.com/ru/post/1658987/


All Articles