i386 try on amd64 system

I've got some idea of trying (for example, for strange testing) to build and run some ports as i386, but do that and run them on an amd64 machine. Is is possible in reality?
Say, I want to try www/firefox in both variants: amd64 (native) and i386 (not so native) on the same machine. I could guess that I need to build also all the dependencies (all?) in i386 mode for that. But is it somehow explained somewhere?

UPD. May be that is not clear enough, I want two browsers, i386 and amd64, on one desktop side-by-side, say in MATE desktop, to compare.
 
Last edited:
I've got some idea of trying (for example, for strange testing) to build and run some ports as i386, but do that and run them on an amd64 machine. Is is possible in reality?
You can run a 32 bit jail on a 64 bit system without problems.
 
Oh, thanks! And how is that can be done? Could you point me to some tutorial, please?
 
I am afraid there's no way to make it as simple as just running 32bit binaries on amd64 system (just like on Win), is there? I mean to build them possible running without jails?
 
There is no need for a jail. chroot() suffices. make installword and make distribution into some DESTDIR, copy resolv.conf into it and mount /dev into it.
 
Okay. ;)

This assumes that one has the srctree installed under /usr/src, and the portstree on a separate filesystem that can be unmounted from /usr/ports and mounted somewhere else where needed (symlinking will not do). This is how I do build my ports for other machines.

Designate a working directory with enough space, Lets call it /build for this example. Then:

Code:
cd /usr/src
make buildworld TARGET=i386 TARGET_ARCH=i386 # if not yet done
make installworld TARGET=i386 TARGET_ARCH=i386 DESTDIR=/build
make distribution TARGET=i386 TARGET_ARCH=i386 DESTDIR=/build
cp /etc/resolv.conf /build/etc  # so that fetch can work
mount -t devfs devfs /build/dev   # some make commands need this
umount /usr/ports; mount <your portstree filesystem> /build/usr/ports
chroot /build sh -c 'cd /usr/ports/www/firefox; make install'

Ports built this way will run within the chroot, that is, when invoked via chroot /build /path/to/whatever-command - if the kernel is configured to do so ( options COMPAT_FREEBSD32). They should as well run when installing them to the amd64 base system , but you will have to figure out the name-clashes (the newly built things will in most cases have the same filenames as the same ports installed in amd64 version) not only for the program itself, but also for all the shared libs it may require (There may be some switches in the makefiles to help with that, but I never looked into that more closely). This might be a little bit of work, especially for such a fat beast as firefox is. ;)
 
Back
Top