From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 10 04:44:30 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9BBB16A41B for ; Fri, 10 Aug 2007 04:44:30 +0000 (UTC) (envelope-from sharadc@in.niksun.com) Received: from in.niksun.com (210.18.76.166.sify.net [210.18.76.166]) by mx1.freebsd.org (Postfix) with ESMTP id 8D33B13C474 for ; Fri, 10 Aug 2007 04:44:30 +0000 (UTC) (envelope-from sharadc@in.niksun.com) Received: from sharadc.niksun.com (unknown [10.60.5.27]) by in.niksun.com (Postfix) with ESMTP id 9A5695CBD; Fri, 10 Aug 2007 09:58:57 +0530 (IST) From: Sharad Chandra Organization: Niksun India To: freebsd-hackers@freebsd.org Date: Fri, 10 Aug 2007 09:51:02 +0530 User-Agent: KMail/1.8.2 References: <200707271513.48639.sharadc@niksun.com> <20070727102027.GH1152@turion.vk2pj.dyndns.org> In-Reply-To: <20070727102027.GH1152@turion.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200708100951.02394.sharadc@in.niksun.com> X-Mailman-Approved-At: Fri, 10 Aug 2007 11:27:51 +0000 Cc: Sharad Chandra Subject: Re: gcc -m32 option on amd64. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2007 04:44:31 -0000 On Friday 27 Jul 2007 3:50 pm, Peter Jeremy wrote: > On 2007-Jul-27 15:13:48 +0530, Sharad Chandra wrote: > >I am trying gcc -m32 on freebsd 6.1 amd64 env, but it does not seems to be > >working. i also installed /usr/port/lang/linux-libgcc/ but did not help > >what i did is=> > >echo "main () {}" > t.c; gcc -m32 t.c > >/usr/bin/ld: skipping > >incompatible > > /usr/local/lib/gcc/x86_64-portbld-freebsd6.1/4.2.0/gcc/x86_64-portbld-fre > >ebsd6.1/4.2.0/libgcc.a when searching for -lgcc > >/usr/bin/ld: cannot find -lgcc > >collect2: ld returned 1 exit status > > > >how can we make this working? > > You are using gcc 4.2 from ports. I suspect this only includes the > 64-bit libraries. gcc in the base system includes both 32-bit and > 64-bit libraries by default but it still suffers the same problem. Yes, gcc looks for library in /usr/lib, whereas libraries for 32 is in /usr/lib32, and there is a switch -B in gcc which tells from where to pick the library, I did gcc -m32 -B /usr/lib32 t.c and this is working now. > I had a go at fixing the problem in amd64/112215 but this has other > problems and needs more work. Note that non-trivial code will break > because points at amd64 headers whilst the -m32 > compiler needs i386 headers in many cases. There's a non-trivial > amount of work needed to actually get cross-building working. I > suggest you look throught the FreeBSD-amd64 archives. Thanks Sharad Chandra