app programming on freebsd amd64
Peter Jeremy
peterjeremy at optushome.com.au
Thu Jul 31 19:55:31 UTC 2008
On 2008-Jul-31 13:18:43 -0400, Chuck Robey <chuckr at 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
--
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-amd64/attachments/20080731/01749a2a/attachment.pgp
More information about the freebsd-amd64
mailing list