app programming on freebsd amd64

Chuck Robey chuckr at telenix.org
Fri Aug 1 16:58:09 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Peter Jeremy wrote:
> 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.
> 

Hokay, that's clear enough.  I just won't consider the strategy of trying to
make my target a 32 bit target as a flawed strategy.  I spent some enjoyable
hours last night working out the 64 bit problems with my project, I have a fair
chance of working it all out later on today (I hope).  Thanks for the help.

Until I spend more time on it, I don't want to share my fun yet, but I'll come
back if I need to.  Sure appreciate the description.

> (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.
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkiTQIcACgkQz62J6PPcoOkgLwCcC75xpDnYh5XhugK35awryP/n
1kAAn0msJdUq6MGuFjBXrPjvz4CDzJOk
=k+VM
-----END PGP SIGNATURE-----


More information about the freebsd-amd64 mailing list