app programming on freebsd amd64

Chuck Robey chuckr at telenix.org
Thu Jul 31 22:59:27 UTC 2008


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

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

You mean, why not use ports?  You'd have to be fairly blind not to understand
this... would you tell the hunter that you can't understand why they don't just
visit the butcher's?  Or tell the electronics hobbyist that they just ought to
buy themselves a big stereo and be done with it?  But you can't understand why
someone who enjoys hacking wouldn't rather lay back and let YOU do it.
Honestly,  aren't you being just a little bit blind here? Read my paragraph
again, and try to concentrate on the very first two sentences, I wasn't unclear
or indirect.

I wasn't trying to force you to go my way, just stop trying to make me go your
way.  Some of us happen to enjoy screwing around with applications.  Not the
applications (using firefox), programming them, there IS a difference.

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

Thanks, is that all?  Easy enough, appreciate that.

  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.

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.  Yes, I could go
back and fix them, but right now, that's not the main road, I need to build it
as a test environment, for something else I'm writing, not as a goal in itself.
 I may well back up in a month or two and get it up in 64 bit mode, there's
reason to do that, but right now, it'd only serve to slow up my main goal.

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

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?  I couldn't just run the X11 as 32 bits?  I mean, not only run it as 32
bits, also compile it as 32 bits?  If I did that, it would use the OS and libs
as 64 bits, and be therefore incorrect?

If that's so, it does throw a wrench into things, forcing another set of
decisions on me, so I need a confirmation, you'll understand.

  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
> 

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

iEYEARECAAYFAkiSQ7AACgkQz62J6PPcoOnxeACeMhnPu+1Vg/mBRXlVqSHzXNEl
9fsAoIZYUKSVI8xLNx5LCoD4j13ACdxP
=4//P
-----END PGP SIGNATURE-----


More information about the freebsd-amd64 mailing list