Building 32-bit binaries on 64-bit 6.3
Oliver Fromme
olli at lurza.secnetix.de
Sat May 10 11:50:37 UTC 2008
David Schwartz wrote:
> I've been looking for a way to build 32-bit x86 binaries on an AMD64
> install of FreeBSD 6.3 STABLE.
Doing it within a 32bit chroot (or jail) is probably the
easiest way. At least it was for me. I simply took a
32bit install from an FTP mirror, installed it into
/usr/i386, mounted devfs inside it (and mdfs on tmp),
then chrooted into it, and everything worked as expected.
Of course, if you have a 32bit world on some other box,
you can simply make a copy of it for your chroot.
Of course, be sure that your amd64 kernel contains the
line "options COMPAT_IA32" (it's in GENERIC by default),
so the i386 binary compatibility is enabled. You also
have to make a link inside the chroot's /libexec:
# cd libexec
# ln ld-elf.so.1 ld-elf32.so.1
And finally, certain Makefiles (including our buildworld
target) will be confused and think that you're attempting
to cross-compile. In order to trick them into assuming
that you're running on a 32bit kernel, you have to set
these environment variables before:
# export UNAME_m=i386
# export UNAME_p=i386
If you're using csh or tcsh, use this syntax instead:
% setenv UNAME_m i386
% setenv UNAME_p i386
With the above settings, I was able to perform a full
buildworld + installworld within a 32bit chroot on a
64bit host. The result was still a 32bit world, of
course.
Best regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart
FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd
"If Java had true garbage collection, most programs
would delete themselves upon execution."
-- Robert Sewell
More information about the freebsd-chat
mailing list