From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9505 invoked by alias); 2 Mar 2013 07:45:25 -0000 Received: (qmail 9493 invoked by uid 22791); 2 Mar 2013 07:45:23 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ia0-f175.google.com (HELO mail-ia0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 02 Mar 2013 07:45:17 +0000 Received: by mail-ia0-f175.google.com with SMTP id k38so1156291iah.20 for ; Fri, 01 Mar 2013 23:45:16 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.42.247.8 with SMTP id ma8mr11565832icb.1.1362210316480; Fri, 01 Mar 2013 23:45:16 -0800 (PST) Received: by 10.231.102.10 with HTTP; Fri, 1 Mar 2013 23:45:16 -0800 (PST) In-Reply-To: References: Date: Sat, 02 Mar 2013 07:45:00 -0000 Message-ID: Subject: Re: cross compiling gcc for i686 target From: vijay nag To: Ian Lance Taylor Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2013-03/txt/msg00008.txt.bz2 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="\"\"" -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 wrote: > On Fri, Mar 1, 2013 at 9:39 AM, vijay nag 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