Question

I have installed gcc-4.6.2 from source, but it can't build 32bit program, it seemed doesn't have 32bit lib. error report by gcc:

/usr/local/gcc-4.6.2/lib/gcc/x86_64-redhat-linux/4.6.2/crtbegin.o: could not read symbols: File in wrong format

my gcc-4.6.2 config is:

Target: x86_64-redhat-linux
Configured with: ../gcc-4.6.2/configure --prefix=/usr/local/gcc-4.6.2 --mandir=/usr/share/man --infodir=/usr/share/info --enable-bootstrap --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++ --with-gmp=/usr/local/gmp-5.0.1 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-1.0.1 --without-ppl --without-cloog --with-arch-32=i686 --build=x86_64-redhat-linux --disable-multilib

Thread model: posix
Was it helpful?

Solution

Configure and build gcc with:

--enable-multilib --with-multilib-list=m32,m64

Once you install it, you can then compile for 32-bit by passing the "-m32" option to gcc. Note that you will also need 32-bit versions of all needed libraries (like glibc.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top