I tried to build with host,build = amd64-pc-linux-gnu and target=i686-pc-linux-gnu. Binutils compile successfully for i686-pc-linux-gnu target , but when native compiler tries to invoke "i686-pc-linux-gn-as" which by default emits 32 bit code i see the following errors. gcc -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -Wold-style-definition -Wc++-compat -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../../gcc/gcc -I../../../gcc/gcc/build -I../../../gcc/gcc/../include -I../../../gcc/gcc/../libcpp/include -I/localdisk/vinag/tmp/sbtools.tmp.201302221200/sbtools/systemsw/tools/src/objdir_201302221200_linux-x86/gcc_stage1/./gmp -I/localdisk/vinag/tmp/sbtools.tmp.201302221200/sbtools/systemsw/tools/src/gcc/gmp -I/localdisk/vinag/tmp/sbtools.tmp.201302221200/sbtools/systemsw/tools/src/objdir_201302221200_linux-x86/gcc_stage1/./mpfr -I/localdiskvinag/tmp/sbtools.tmp.201302221200/sbtools/systemsw/tools/src/gcc/mpfr -I/localdisk/vinag/tmp/sbtools.tmp.201302221200/sbtools/systemsw/tools/src/gcc/mpc/src -I../../../gcc/gcc/../libdecnumber -I../../../gcc/gcc/../libdecnumber/bid -I../libdecnumber \ -DBASEVER="\"4.7.2\"" -DDATESTAMP="\"\"" \ -DREVISION="\"\"" \ -DDEVPHASE="\"\"" -DPKGVERSION="\"(GCC) \"" \ -DBUGURL="\"<http://gcc.gnu.org/bugs.html>\"" -o build/version.o ../../../gcc/gcc/version.c /tmp/ccAlfevC.s: Assembler messages: /tmp/ccAlfevC.s:37: Error: cannot represent relocation type BFD_RELOC_64 /tmp/ccAlfevC.s:38: Error: cannot represent relocation type BFD_RELOC_64 /tmp/ccAlfevC.s:66: Error: cannot represent relocation type BFD_RELOC_64 /tmp/ccAlfevC.s:84: Error: cannot represent relocation type BFD_RELOC_64 /tmp/ccAlfevC.s:102: Error: cannot represent relocation type BFD_RELOC_64 make[2]: *** [build/version.o] Error 1 make[2]: *** Waiting for unfinished jobs.... /bin/sh ../../../gcc/gcc/../move-if-change tmp-optionlist optionlist echo timestamp > s-options make[2]: *** wait: No child processes. Stop. make[1]: *** [all-gcc] Error 2 exporting CFLAGS='-m64' I could go past this point. It bails out in the next stage of compilation when the target compiler is used with -m64 option with the error "cc1plus: sorry, unimplemented: 64-bit mode not compiled in" On Fri, Mar 1, 2013 at 11:58 PM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: > On Fri, Mar 1, 2013 at 9:39 AM, vijay nag <vijunag@xxxxxxxxx> wrote: >> >> Is it possible to do a cross compile of gcc-4.7.2 on AMD x86_64 to >> produce i686 target ? >> >> My build, host and target parameters are amd64-pc-linux-gnu, >> amd64-pc-linux-gnu and i686-pc-linux-gnu. My native compiler again is >> a 64 bit compiler emitting default 64 bit object code. > > Yes, it is possible. > > It is also usually unnecessary. A typical x86_64 compiler > installation will produce 32-bit x86 code with the -m32 option. > > Ian