Cross-compiling under Linux x86
  • Butterfly
    Butterfly
    mdma
    Posts: 85 from 2003/5/4
    I'm new to this so don't shout! ;-)

    I am trying to cross-compile an SDL C++ Linux program to MorphOS, I have installed the Linux x86 crosscompiler and SDK from zerohero.se and have also copied the PowerSDL SDK to the relevant directories.

    I run the configure script with:
    Code:
    CC=/usr/local/amiga/bin/ppc-morphos-gcc CXX=/usr/local/amiga/bin/ppc-morphos-g++ ./configure --libdir=/usr/local/amiga/ppc-morphos/lib/ --includedir=/usr/local/amiga/ppc-morphos/include/ --bindir=/usr/local/amiga/ppc-morphos/bin/ --target=powerpc-unknown-morphos --host=powerpc-unknown-morphos


    So far so good, the only error I get is:

    Code:
    checking whether argument type for signal handlers is "int"... configure: error: cannot run test program while cross compiling"


    Which I don't think is anything to worry about for the moment.

    I then run make with:

    Code:
    CC=/usr/local/amiga/bin/ppc-morphos-gcc CXX=/usr/local/amiga/bin/ppc-morphos-g++ make


    Which plods along nicely compiling the relevant source files then finishes with no errors displayed.

    Only problem is the resulting executable is an x86 Linux program.

    Obviously I've missed something out, but what?

    Thanks in advance,
    Nik
  • »17.04.07 - 16:43
    Profile
  • Paladin of the Pegasos
    Paladin of the Pegasos
    Jupp3
    Posts: 1193 from 2003/2/24
    From: Helsinki, Finland
    I wonder how easy it would be to create morphos target for scratchbox...
    http://www.scratchbox.org

    I did some experimenting long ago, but didn't have much progress (and I mostly compile stuff on MOS anyway), but with scratchbox more software would likely compile without any changes in configure scripts and makefiles.
  • »17.04.07 - 20:16
    Profile Visit Website
  • Butterfly
    Butterfly
    mdma
    Posts: 85 from 2003/5/4
    That looks quite nice but it doesn't solve my problem. :-(
  • »17.04.07 - 20:19
    Profile
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    Code:
    CC=/usr/local/amiga/bin/ppc-morphos-gcc CXX=/usr/local/amiga/bin/ppc-morphos-g++ ./configure --libdir=/usr/local/amiga/ppc-morphos/lib/ --includedir=/usr/local/amiga/ppc-morphos/include/ --bindir=/usr/local/amiga/ppc-morphos/bin/ --target=powerpc-unknown-morphos --host=powerpc-unknown-morphos


    Is this really the commandline you used when running configure? AFAICT it should be much simpler, something like this:

    Code:
    ../<source>/configure --build=`../<source>/config.guess` --target=ppc-morphos

    Note this uses a separate build directory next to the sources which are in <source>. Replace <source> with the real name of the directory. Create a build directory named like the source dir with an added -obj extension. configure is then invoked from inside that directory. If there is no config.guess file you must findout your buildsystem name yourself. Its possible that you also need to specify host (or maybe its only host and target defaults to host if no target was specified?) as --host=ppc-morphos.

    Quote:

    Code:
    checking whether argument type for signal handlers is "int"... configure: error: cannot run test program while cross compiling"

    Which I don't think is anything to worry about for the moment.


    You better should... This shows that the configure script wasn't created with cross-compiling in mind since it wants to get information about the host/target by running a programm and that can't work when cross-compiling.
  • »18.04.07 - 08:10
    Profile