Mendes
Mendes

Reputation: 18511

Vortex86DX Illegal instruction on C++ code/toolchain build

I have Ubuntu 12.01 with gcc 4.8.2 and did a cross compilation 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++ -march=i586 test.cpp -o test586 -static -static-libgcc -static-libstdc++ 

When I run the test586 on the target architecture I´m getting this error:

$ ./test586
Illegal instruction

Well, as pointed out here it seens that I need to build the whole toolchain for the given architecture, but I´m really confused about how to do it:

A) As I´m currently using Ubuntu 12.01, it is built for i686 architecture. Shall I build the new toolchain in this Ubuntu ? Shall I build a VM with an older Ubuntu and compile that (this is a problem for me as I need C++00x -C11 support, and Ubuntu like 10.X gcc does not support it).

b) I cannot build in the target hardware, as it has very little memory and disk (256Mb RAM) and a very old Linux Kernel 2.6.23.

I´m really very confused on how to solve that and help is appreciated. here

Upvotes: 0

Views: 407

Answers (1)

vasek
vasek

Reputation: 2849

This is because your libstdc++ is linked as i686 version which is incompatible with vortex platform. When you switch to dynamic linkage (which is enabled by default) your example will work perfectly.

Upvotes: 1

Related Questions