app programming on freebsd amd64

Peter Jeremy peterjeremy at optushome.com.au
Fri Aug 1 08:44:25 UTC 2008


On 2008-Jul-31 18:58:56 -0400, Chuck Robey <chuckr at telenix.org> wrote:
>I wasn't trying to force you to go my way, just stop trying to make me go your
>way.

I wasn't intending to force you to use my way.

>Well, I'm doing this with X11, which was written to begin with in a 32 bit
>atmosphere, and does have several nontrivial 64 bit problems.

I run 64-bit X.org on several systems and haven't noticed that.  Can you
give some more details.

>Oh, you're telling me that if I run one app as 32 bit (compiling it, the whole
>enchilada, as 32 bit) would only work if I had the OS, kernel and all libs, as
>32 bits?

No.  A 64-bit kernel will happily run 32-bit or 64-bit apps, with the
exception of 32-bit apps that grovel in kernel memory.

The problem is that include files wind up getting defines from
/usr/include/machine and the contents of that directory assume that
longs and pointers are 64 bits but they are 32 bits with -m32.  Try
comparing /usr/include/machine on i386 and amd64 boxes to see what I
mean.  This means that if you #include <sys/stat.h> in -m32, your
struct stat will be different to the one that the kernel expects.

(And I forgot about the linking problems that other people pointed
out, sorry).

Given the current situation with FreeBSD, I believe the easiest way to
build a 32-bit app is to install an i386 world under (eg) /i386 and
chroot into it to build the app.  You can still run it outside the
chroot area.

-- 
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/20080801/4c8dbd3a/attachment.pgp


More information about the freebsd-amd64 mailing list