Announcement

Collapse
No announcement yet.

Building 32-bit apps on x86_64 system

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Building 32-bit apps on x86_64 system

    I need to build a 32-bit version of an app (dbxml) on my Kubuntu x86_64 system. This will be run on an IA32 system, not on the X86_64.

    dbxml attempts to build 32-bits when given the right environment variables but fails with the following messages:

    Code:
    configure:4143: gcc -m32 -D_GNU_SOURCE -D_REENTRANT conftest.c >&5
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.1/libgcc.a when searching for -lgcc
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.1/libgcc.a when searching for -lgcc
    /usr/bin/ld: cannot find -lgcc
    Being new to (K)Ububtu, I am not sure how to get the right libs. I looked in System Settings -> Add and Remove Software but there is no 32-bit version of the libs listed.

    Bob

    #2
    Re: Building 32-bit apps on x86_64 system

    you should install the multilib libs

    sudo apt-get install gcc-multilib g++-multilib

    and the same for fortran and objc if you want those compilers too.

    Then to compile to 32bit from a 64bit machine just run

    gcc -m32 -c source.c -o source.o
    ld -m32 objects.o final_binary

    A short cut would be to do:

    CC="gcc -m32" CXX="g++ -m32" LD="gcc -m32" make

    This makes sure you compile with 32bit support

    Comment

    Working...
    X