title: Building 32 bit GCC from source on 64 bit: linking issue
body: <pre><code>/usr/bin/ld: i386:x86-64 architecture of input file `build/gengenrtl.o' is incompatible with i386 output
  /usr/bin/ld: i386:x86-64 architecture of input file `build/errors.o' is incompatible with i386 output
  /usr/bin/ld: build/gengenrtl.o: file class ELFCLASS64 incompatible with ELFCLASS32
  /usr/bin/ld: final link failed: File in wrong format
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I don't get if the problem is <code>ld</code> or the given library.</p>
  
  <p>my configuration is</p>
  
  <pre><code> CC="gcc -m32" \
   CFLAGS="-m32" \
   LD="&lt;path&gt;/bin/32/binutils/2.23.2/bin/ld" \
   LDFLAGS="-m32" \
   ./configure \
   --build=i586-pc-linux-gnu \
   --host=i586-pc-linux-gnu \
   --target=i586-pc-linux-gnu \
   --enable-shared \
   --enable-static \
   --enable-languages=c,c++ \
   --enable-bootstrap \
   --prefix=&lt;path&gt;/bin/32/gcc/i586 \
   --disable-stage1-checking \ 
   --with-gmp=&lt;path&gt;/lib/32/gmp/5.1.2 \
   --with-mpfr=&lt;path&gt;/lib/32/mpfr/3.1.2 \
   --with-mpc=&lt;path&gt;/lib/32/mpc/1.0.1 \
   --with-cloog=&lt;path&gt;/lib/32/cloog/0.18.0 \
   --without-ppl
  </code></pre>
  
  <p>Apparently I can't change the ld executable so easily, gcc keeps compiling with the global system <code>/usr/bin/ld</code>.</p>
  
  <p>Someone can say what is going on here and how to fix this linking phase ?</p>
  
  <p>I'm under Ubuntu 64 bit and I'm trying to compile a 32 bit build of gcc, of course I have already compiler gmp, mpc, mpfr for 32 bits.</p>