compile 32-bit gcc on 64-bit Linux distribution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I just compiled 32-bit gcc-4.4.1 on a 64-bit Linux OS.  Here are my notes for anyone interested in doing this:

    compile 32-bit versions of the standard prerequisites.

    compile 32-bit binutils with the following config options:

        --build-i686-linux-gnu
        --host=i686-linux-gnu
        --target=i686-linux-gnu
        --enable-64-bit-bfd
        --with-libpath=<use apropriate paths for your system here>

    set PATH and LDFLAGS such that gcc finds the needed prerequisites

    export CC="gcc -m32"
    export CXX="g++ -m32"

    configure gcc with the following options:

        --build-i686-linux-gnu
        --host=i686-linux-gnu
        --target=i686-linux-gnu

If you get scary assembler errors like "suffix or operands invalid for `pop`" or "bad register name...", check my notes here for solutions:

http://ynform.org/w/Pub/Gcc

Heading the ensuing discusssion off at the pass...
I've seen all the previous messages to the effect of "Why would you want to do
that anyway?  The 64-bit gcc should be perfectly capable of producing 32-bit
binaries, given the right options.", but still, there are sometimes some
reasons one might want to do this.

-- 
Yorick




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux