How to compile 32bit applications on FreeBSD-amd64?

W.B. Kloke wb at arb-phys.uni-dortmund.de
Wed Nov 28 09:14:07 PST 2007


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

Specifically, I want to build the Haskell compiler GHC on my system.
(My answer about the regular way to port it on the GHC mailing list has not
been anwered yet.) I have a working 32bit GHC-6.8.1 available. I managed to
compile a sample program to i386 object code. But I did not manage to link
it.

I used the script as32

#!/bin/sh
/usr/bin/cc -Xassembler -32 $*

as a replacement for the assembler, and got so far.
I did not succeed in working out an equivalent 32bit ld.

#!/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.

-- 
Dipl.-Math. Wilhelm Bernhard Kloke
Institut fuer Arbeitsphysiologie an der Universitaet Dortmund
Ardeystrasse 67, D-44139 Dortmund, Tel. 0231-1084-257
PGP: http://vestein.arb-phys.uni-dortmund.de/~wb/mypublic.key



More information about the freebsd-amd64 mailing list