From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 27 16:32:39 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 0953616A419 for ; Fri, 27 Jul 2007 16:32:39 +0000 (UTC) (envelope-from tevans.uk@googlemail.com) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.185]) by mx1.freebsd.org (Postfix) with ESMTP id 6FF8F13C4E8 for ; Fri, 27 Jul 2007 16:32:38 +0000 (UTC) (envelope-from tevans.uk@googlemail.com) Received: by mu-out-0910.google.com with SMTP id w9so901938mue for ; Fri, 27 Jul 2007 09:32:37 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; b=b/lcCuLN4X3FVQx/E3d+TCHXddxTGT3VWYY11xmJHdIfgYxaDk2T0oQoakXMlUjFuxuHWKK9LT/cWEruQisCyntdHhRUaxEZrApL8+eo/Ce2bbI197ww0N2K5OueJKB1Uv0mw0HoXYL2nEES+42WE8XPfF2sry8tOKm3wR92LUE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; b=Uh2Io/aK1k7g0bQtN9uZ9F0r8biME+gsyShjV5vIcp+dT5jd/b4x35yi6ImW0u/3bew7xxbXJEYLWDKquXZY2EAElKXJWEZ9dP8THmM+jAiJCTywL3eaH91fhByp9ADbY3fIRpavXMVNWKw+N846FuKYsulNaTaW29YNDs4PGsE= Received: by 10.82.162.14 with SMTP id k14mr2860488bue.1185553956940; Fri, 27 Jul 2007 09:32:36 -0700 (PDT) Received: from ?127.0.0.1? ( [217.206.187.79]) by mx.google.com with ESMTPS id f7sm588225nfh.2007.07.27.09.32.35 (version=SSLv3 cipher=RC4-MD5); Fri, 27 Jul 2007 09:32:36 -0700 (PDT) From: Tom Evans To: Peter Jeremy In-Reply-To: <20070727102027.GH1152@turion.vk2pj.dyndns.org> References: <200707271513.48639.sharadc@niksun.com> <20070727102027.GH1152@turion.vk2pj.dyndns.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-7o+A3uSvJUVkkyaOSDIU" Date: Fri, 27 Jul 2007 17:32:35 +0100 Message-Id: <1185553955.1457.8.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.10.2 FreeBSD GNOME Team Port Cc: Sharad Chandra , FreeBSD Hackers 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, 27 Jul 2007 16:32:39 -0000 --=-7o+A3uSvJUVkkyaOSDIU Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2007-07-27 at 20:20 +1000, 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=20 > >working. i also installed /usr/port/lang/linux-libgcc/ but did not help > >what i did is=3D> > >echo "main () {}" > t.c; gcc -m32 t.c > >/usr/bin/ld: skipping=20 > >incompatible /usr/local/lib/gcc/x86_64-portbld-freebsd6.1/4.2.0/gcc/x86_= 64-portbld-freebsd6.1/4.2.0/libgcc.a=20 > >when searching for -lgcc > >/usr/bin/ld: cannot find -lgcc > >collect2: ld returned 1 exit status > > > >how can we make this working? >=20 > 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. >=20 > 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. >=20 gcc on amd64 is capable of generating i386 code, but ld on amd64 is incapable of linking i386 code together without serious amounts of work. At work, we use a large number of amd64 boxes as compile farm servers for i386 development, using distcc and a wrapper to invoke gcc correctly on the external boxes. To verify that it works (it compiles to i386 code), do this: $ uname -a; echo "main() { } " > t.c ; gcc -c -m32 -o t.o t.c; file t.o FreeBSD chef.mintel.co.uk 6.1-STABLE FreeBSD 6.1-STABLE #1: Fri Jun 23 12:48:28 BST 2006 operator@chef.mintel.co.uk:/usr/obj/usr/src/sys/CHEF amd64 t.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (FreeBSD), not stripped --=-7o+A3uSvJUVkkyaOSDIU Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQBGqh4dlcRvFfyds/cRAlHPAKCEobXeinMaJu4IZTdyEdlFlyKHRQCgvNjy mvMk1ivTtGNKTtCiLt49rpY= =7zQL -----END PGP SIGNATURE----- --=-7o+A3uSvJUVkkyaOSDIU--