Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Aug 2008 05:55:27 +1000
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Chuck Robey <chuckr@telenix.org>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: app programming on freebsd amd64
Message-ID:  <20080731195527.GT1359@server.vk2pj.dyndns.org>
In-Reply-To: <4891F3F3.8090608@telenix.org>
References:  <4891F3F3.8090608@telenix.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--96YOpH+ONegL0A3E
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2008-Jul-31 13:18:43 -0400, Chuck Robey <chuckr@telenix.org> wrote:
>I admit it, I'm a hobbyist, so I don't really want to make use of ports.

Each to his own...  But why bother re-inventing the wheel?

>Right now, I want to build xorg on the amd64 platform.  It seems that
>if I don't supply the correct flags (which I don't know about) then
>the amd64 gcc gives me 64 bit apps & libraries.

gcc on amd64 defaults to 64-bit because that is the native mode.

>  What would the flags
>be, if I want to build 32 bit things, both libs and apps?

The gcc flag to make gcc emit i386 code is "-m32".  Note that FreeBSD
_does_not_ include the infrastructure for this to work - the contents
of /usr/include/machine all define/assume I32LP64.  If you compile with
'-m32', you wind up with objects that should be 64-bit (eg off_t)
being 32-bits long - which in turn breaks stat(2), mmap(2) etc.  And,
even if you get a trivial app to link, it won't run on on a real i386
because it has the wrong rtld name embedded in it.

There are a couple of open PRs about this but fixing it is non-trivial.

Your only current option is to install an i386 world (as well as your
amd64 world) and chroot into it to build i386 apps.  Note that even
this approach will not work for things that use libkvm or otherwise
grovel around in kmem.

>about handling any other problems, I just want to know the way to
>coax gcc (and gnu-ld) to think purely 32 bit.

Install FreeBSD/i386

--=20
Peter Jeremy
Please excuse any delays as the result of my ISP's inability to implement
an MTA that is either RFC2821-compliant or matches their claimed behaviour.

--96YOpH+ONegL0A3E
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAkiSGK8ACgkQ/opHv/APuIfCvwCgjJOLiKnREQAws3Gd/N52STia
wYIAn0YzxbAwGIiREPLtaoKSGI9XgDgw
=pZ/Z
-----END PGP SIGNATURE-----

--96YOpH+ONegL0A3E--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080731195527.GT1359>