This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Compiling for i586 architecture - illegal instruction on executable


I have Ubuntu 12.01 with gcc 4.8.2 as a host and I need to do a cross
compilation for a Vortex86DX CPU embedded system running an old 2.6.23
kernel. Although I had succeeded installing a newer 4.7.4 gcc in
Vortex (from previous post), due to the lack or resources I need to be
able to cross compile for the Vortex architectue using my Ubuntu host.

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.cpp -static -static-libgcc
-static-libstdc++

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

    $ ./test586
    Illegal instruction

Browsing on the internet it seens that I need to "build the whole
toolchain for 586" on Ubuntu, but IÂm really confused about how to do
it... Shall I need to install something ?

Is the -march=i586 parameter the only thing needed ? IsnÂt it logical
to gcc to choose the correct 586 libraries in that case ?
Does that Illegal instruction problem come from libraries that is
linked using a 686 architecture ?
How can I tell the compiler to use the 585 libraries ?


IÂm really very confused on how to solve this issue and help is very
much appreciated. [here][1]


  [1]: http://stackoverflow.com/questions/32781281/gcc-cross-compile-to-a-i586-architecture-vortex86dx


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]