automake
[Top][All Lists]
Advanced

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

Re: cross-compiling on 64 to 32-bit Linux


From: Bruno Haible
Subject: Re: cross-compiling on 64 to 32-bit Linux
Date: Sun, 24 May 2009 14:51:56 +0200
User-agent: KMail/1.9.9

> what the procedure was for cross-compiling 32-bit apps on a 64-bin Linux 
> system?

You need a bi-arch system, that is, one that has the system libraries both in a
64-bit variant and in a 32-bit variant (typically in /lib64 and /lib, 
respectively).

For compiling in 32-bit mode, I use

  ./configure --host=i686-pc-linux-gnu \
              --prefix=/arch/x86-linux/gnu \
              CC="gcc -m32 -march=i586" \
              CXX="g++ -m32 -march=i586" \
              LDFLAGS="-m32"

whereas for compiling in 64-bit mode, I use

  ./configure --host=x86_64-pc-linux-gnu \
              --prefix=/arch/x86_64-linux/gnu 
--libdir=/arch/x86_64-linux/gnu/lib64

Notes:
  - The -m32 flag has to be passed as part of both CC / CXX and LDFLAGS.
  - The -m64 flag is the default on bi-arch Linux systems.
  - In 32-bit mode no --libdir option needs to be passed, because the default
    libdir is already $(prefix)/lib.
  - The -march=i586 is needed for me, because some particular gcc version
    lacks the library functions needed for multithreading primitives that are
    used by i386 or i486 compatible compiled code. (A quite obscure bug.)
  - Use of the "linux32" program is not needed, since I pass the --host
    option explicitly and hence config.guess does not have to guess it by
    running 'uname -m'.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]