How to compile 32bit applications on FreeBSD-amd64?

Mike Meyer mwm at mired.org
Wed Nov 28 11:03:35 PST 2007


On Wed, 28 Nov 2007 16:14:26 +0000 (UTC) wb at arb-phys.uni-dortmund.de (W.B. Kloke) wrote:

> Is there an easy way to build a 32bit application on an amd64 system?

Not really.

> #!/bin/sh
> /usr/bin/cc -Wl,-m,elf_i386_fbsd,-L,/usr/lib32
> 
> does not really work, because it tries to link /usr/lib/libgcc.a, crt1.o
> and other 64bit programs instead of the right ones.

You need to explicitly list all the 32 bit versions of all those 64 bit libraries it's trying to link in. Once you do that, it'll work. There have been notes here indicating that the resulting binary won't run on a 32 bit system because of the differences in library locations, but I haven't verified it.

	<mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.


More information about the freebsd-amd64 mailing list