From WineHQ Wiki
Revision as of 19:45, 21 April 2018 by KyleAuble (talk | contribs) (Prep link for moving Portability page)
Jump to: navigation, search

FreeBSD is one of the classic unixes (unices?) with a long history of great ideas but is still thoroughly modern. Read on for more details about setting up wine on your FreeBSD system.

Also, if you're using either PC-BSD or ArchBSD, these are downstream projects of FreeBSD that specialize in providing a good desktop experience and simple packaging. Some instructions might not be the same (e.g. ArchBSD uses the pacman package manager instead of Ports), but both projects cooperate and regularly re-sync with FreeBSD so many concepts and issues should be very similar.


The FreeBSD Ports repository contains up-to-date packages for Wine's stable, development, and experimental staging releases; you can install them on 32-bit FreeBSD easily

pkg install wine
pkg install wine-devel
pkg install wine-staging

If you're on a 64-bit version of FreeBSD, you'll need to use the special i386 packages to get 32-bit wine. Instead of the packages listed above, just choose from

pkg install i386-wine
pkg install i386-wine-devel
pkg install i386-wine-staging

FreeBSD can actually build and run the pure 64-bit version of wine now. The problem is that it still doesn't support WoW64, and since that's necessary for the overwhelming majority of Windows apps, amd64 systems still need to use the 32-bit package.

Dialog-warning.svg Don't let the i386 name fool you; these packages are only meant to allow 32-bit wine on amd64 systems. If you're on 32-bit FreeBSD, the packages may have a failsafe that redirects to the vanilla one anyway, but it's much safer if you stick to the normal packages.

Building Wine

There are some mixed signals about multilib support in FreeBSD. The base system and build tools probably respect multilib conventions (apparently since Jun 2013 or earlier). Just a month later, the ArchBSD team not only announced their packages were multilib compatible, but even built 32-bit wine without a chroot.

Dialog-warning.svg However, the FreeBSD docs don't seem to mention this, nor have we tested it ourselves. If you do try, we can't guarantee that it will work or even that it won't destabilize your system. However, if you're successful building 32-bit wine on 64-bit FreeBSD without the chroot, feel free to update this section to share the good news.

Classic chroot

Even if multilib doesn't work for you (or you just want an especially clean build environment), then FreeBSD makes chroots wicked simple. All you need to do is...

  • Load the necessary i386 files for a chroot into a folder
cd /usr/src
make buildworld TARGET=i386
make installworld TARGET=i386 DESTDIR=/compat/i386
make distribution TARGET=i386 DESTDIR=/compat/i386
mkdir /compat/i386/usr/ports
  • Add mount points for necessary directories to the chroot
mount -t devfs devfs /compat/i386/dev
mount -t nullfs /usr/ports /compat/i386/usr/ports
  • Enter the chroot, set a few environment variables, and start ldconfig running
chroot /compat/i386
setenv MACHINE i386
setenv UNAME_m i386
setenv UNAME_p i386
service ldconfig start
  • Then move to your desired build directory and make the package
cd /usr/ports/emulators/i386-wine-devel
make package

And you're done!

Tango-style info icon.svg If you're not sure where your built package was saved, while still in the chroot, you can ask with make -V and the PKGFILE environment variable:

echo /compat/i386/$(make -V PKGFILE)

For Packagers

If you want to not only build wine, but help package it for FreeBSD, then the previous info is good to know, but you'll also want to read up on poudriere. This tool is designed to streamline the extra build and quality-control steps you want for a high-quality release. If you're familiar with Debian's debuild system, it's like that (only with the splendor and majesty of ZFS).

Outstanding Issues

There are still many subtle bugs in how wine runs on FreeBSD vs. other platforms. Some of them might be due to our upstream code while others sneak in during the packaging process. The former will ideally be tracked here at WineHQ while the latter should wind up on the FreeBSD bug-tracker:

However, while neither of the bug-trackers seem to have an open ticket for it, our main structural problem now is WoW64 support on FreeBSD. If you're interested in helping fix WoW64 support on FreeBSD, your best bet is to first try following the shared WoW64 build instructions to compile wine from source (preferably from the tip of our git tree).

If (when?) this fails, concentrate on the first error; if there's no simple workaround, submit a patch if you feel up to it, or if not, at least report the bug on the proper bug-tracker. Once you can compile and link a WoW64-capable version of wine, you can move onto runtime errors. And don't forget that the wine Conformance Tests are great for pinpointing problems too.

See Also

  • Psst... if a problem on FreeBSD has you bamboozled, MacOSX inherits much of FreeBSD's user-space and even some of the kernel; maybe OS X bug reports, patches, and test results can give you hints