linux 32 bit compilation on x86_64 with autoconf
after loads of googling i can't find a simple answer, so maybe someone here knows:
i'm on an AMD64 suse. i'm trying to compile a library that will later be used from a 32 bit application, so i need to compile the library as 32bit.
it's set up with autoconf (e.g. ./configure, make, make install). how exactly do i tell configure to build for an ix86 (i386 or i586 or i686 etc) platform instead of x86_64? should something like this work?
what's the difference between --build, --host, and the other flags in configure?
i know you can do this by setting the -m32 flag for compiling and linking (e.g. CFLAGS=-m32 LFLAGS=-m32 CXXFLAGS=-m32) but this seems unnecessarily complicated.
Here is a description of the --host, --build, and --target flags.
To get the AMD64 triplet
seems to be almost working but not quite. here's what's happened:
i did ./configure --build=i586
(before i saw your reply - next will try it with build, host, and target, all of them )
everything compiled, linked, installed ok.
specifically, i'm building the ODE open dynamics engine. i get libode.so and libode.a in /usr/local/lib, which is what's supposed to happen.
next, i try to compile a little test program to use libode:
g++ -m32 -c odetest.c
g++ -m32 -o odetest -L/usr/X11R6/lib -lX11 -lglut -lGL -lXi -lXmu -lode -lode
/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/local/lib/libode.so when searching for -lode
so the compile/link is correctly targeting 32bit, and looking in the right place (/usr/local/lib, and not /usr/local/lib64), but libode.so is still wrong.
libstdc++.so.5 => /usr/lib64/libstdc++.so.5 (0x00002aaaaac3f000)
libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x00002aaaaae1c000)
libm.so.6 => /lib64/tls/libm.so.6 (0x00002aaaaaf31000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002aaaab088000)
libc.so.6 => /lib64/tls/libc.so.6 (0x00002aaaab194000)
First, are you building the library for use on YOUR AMD64 machine just for use with 32-bit applications?
Your test program is NOT building correctly
Rebuild libode like this and then try your test program.
|All times are GMT -5. The time now is 12:26 AM.|