Build ports in chroot for i386 when booted with amd64 kernel?

Peter Jeremy peter at
Fri May 25 07:04:36 UTC 2012

On 2012-May-24 06:47:48 -0400, Thomas Mueller <mueller23 at> wrote:
>Is it feasible to chroot into an i386 environment when booted to FreeBSD amd64 for the purpose of building and installing ports for i386?

Yes.  I have built i386 code (both world & ports) using both chroot
and jail.  The only caveat is that the i386 world should be no newer
than the host kernel.  Assuming /tank/m3 has an i386 world installed:

On the host:
# mount -r -t nullfs /usr/src /tank/m3/usr/src
# mount -r -t nullfs /usr/ports /tank/m3/usr/ports
# mount -t devfs devfs /tank/m3/dev
# chroot /tank/m3 bin/sh

Inside the chroot:
# export MACHINE=i386 UNAME_p=i386 UNAME_m=i386
# cd /usr/src && make buildworld
# cd /usr/ports/.../... && make install

So far, I've only had this fail when building MPIR (which isn't a port and
seems to have broken CPU detection code).

Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url :

More information about the freebsd-ports mailing list