WINE in jail [Was: i386_set_ldt and wine on AMD64]

Lapo Luchini lapo at
Fri Dec 12 04:29:40 PST 2008

Roland Smith wrote:
> On Sat, Dec 30, 2006 at 05:10:08PM -0500, Siavosh Benabbas wrote:
>> Hi,
>> I know that this is brought up several time on this list, but I wanted to
>> run wine on my FreeBSD AMD64 machine.
>> I know that a 64-bit wine is nearly impossible but I thought that an i386
>> compilation should work.
> You'd need a cross-compiler to start with. That's the easy part.
> Then you'd need ports infrastructure to compile 32-bit ports on amd64.

Easiest approach to avoid that part seems to be seting up a full i386
jail inside the amd64 host, and install WINE normally from the ports.

>From man jail(8):

  host# D=/here/is/the/jail
  host# cd /usr/src
  host# mkdir -p $D
  host# make world DESTDIR=$D
  host# make distribution DESTDIR=$D
  host# mount -t devfs devfs $D/dev

But as suggested here <> I actually:

  host# make world distribution TARGET_ARCH=i386 TARGET=i386 DESTDIR=$D
  host# ln -s $D/libexec/

Then added IP alias for jail use, set up a unionfs over ports (to avoid
having them double) and can correctly login in the jail:

  host# ifconfig em0 inet $IP/32 alias
  host# mount -t unionfs -o noatime,below /usr/ports $D/usr/ports
  host# jail $D $HOSTNAME $IP /bin/tcsh

>From there I normally installed WINE:

  jail# cd /usr/ports/emulatos/wine
  jail# make install clean

…but then it just “bus error” dumps on me… something to do with LDT:

  jail# winecfg
  Bus error (core dumped)
  jail# gdb `which wine-pthread` wine-pthread.core
  (gdb) bt
  #0  0x7df3b2e9 in wine_ldt_init_fs () from /usr/local/lib/
  #1  0x7bf00fb3 in init_pthread_functions ()
  #2  0x7e36a81f in thread_init () from /usr/local/lib/wine/
  #3  0x7e345d98 in __wine_process_init () from
  #4  0x7df3bd74 in wine_init () from /usr/local/lib/
  #5  0x7df571eb in wine_casemap_upper () from

Lapo Luchini -

“Beware of bugs in the above code; I have only proved it correct, not
tried it.” (Donald Knuth, 1977-03-22)

More information about the freebsd-amd64 mailing list