Another useless homepage

Using Q4Wine with self-patched and -compiled wine versions

Table of contents

1. Motivation

For years I was using PlayOnLinux. If you do not know what that is then use a freaking search engine let me give you a very brief explanation.
PlayOnLinux is a Python program (using WxWindows for the GUI) which provides a way to easily install multiple versions of wine on your computer. Then it allows you to create a bunch of wine prefixes (or "bottles", as codeweavers calls them). Those are essentially isolated virtual Microsoft Windows installations. For each prefix you can select which version of wine to use and automatically install additional libraries needed. Most Linux distributions install a certain version of wine and nothing else, but since some programs and games work better with certain versions of wine having this option is really good! It also has some automatic install scripts for many programs and games that created prefixes, select and download the correct wine version and install necessary libraries. It is to note that creating wineprefixes is directly supported by wine and not a PlayOnLinux feature, that one just sets some environment variables correctly.
But if PlayOnLinux worked perfectly fine for me I probably wouldn't waste my time writing all this stuff here, right? Right. I had various problems with it over the years. Sometimes some games (most recently: the Turok 2 remaster) simply wouldn't install at all - even though my distribution's wine version could do it. Also apparently the console interface still tries to load the GUI part and if that doesn't work: Enjoy not being able to play all those games you installed. Downloading it from the official website also doesn't help because its dependencies aren't bundled with it (really useful, you guys!) so I was basically forced to search for an alternative.

The most obvious alternative is CrossOver Linux which basically provides the same features of PlayOnLinux, however there are a few differences.

Keep in mind that I tried it two years ago and all of the things I just wrote might be different now.

Another alternative is - you guessed it - Q4Wine. This in itself is quite a simple tool. You add wine versions that you have on your system and it lets you create prefixes. It is much less automatic than PlayOnLinux or CrossOver, but it gives you more flexibility (i.e. using a self-patched version of wine). Additional libraries are installed using the winetricks script (I suspect PlayOnLinux uses that as well as the available libraries seem to be the same). It is more work to set up, but the lack of dependencies makes it very attractive to me.

2. Prerequisites

First you'll need to install wine, Q4Wine and the header files necessary for compiling wine. On Gentoo it's just regularly installing the tools as the source remains on the system:

emerge wine q4wine
On Debian derivatives the following will probably work (I didn't try):
aptitude install wine q4wine wine-dev
And you're done! Technically you don't actually need to install wine on either Gentoo or Debian but it conveniently provides a base version for Q4Wine and also installs the dependencies and headers necessary to compile wine ourselves.
You will also need basic tools to compile stuff (package "build-essential" on Debian), cmake and git.

3. Getting the wine source code

For this I would suggest you create a directory for source code somewhere in your home-directory (I named mine simply "src") and open a console in there. First, check out the following repositories:

git clone git://
git clone
The first one is (of course) wine and the second one is a patchset for wine called "staging" which includes experimental changes. As far as I can tell they're mostly useful for improving performance in games, but also some programs. It's up to you to decide whether you want/need them or not.
The following examples are for wine version 2.0 but they should be extremely similar for any other wine version. You can repeat the whole process for other wine versions, but first you should clean up your local copies of both wine and wine-staging:
git reset --hard
git clean -fd
After that, check out the correct version tag for both wine and wine-staging. Make sure the versions are the same.
git checkout wine-2.0 # for wine
git checkout v2.0 # for wine-staging

4. Patching, compiling and installing wine

First, change into the wine-staging/patches directory:

cd wine-staging/patches
If you want to read about what patches you can install, execute the script and enjoy your walls of text. For this guide (and the wine version I use) I just apply all of them (the DESTDIR option is important! Modify it if you didn't follow the guide to the letter!):
./ DESTDIR=~/src/wine --all
I am running a 64 bit system (like anyone with a regular desktop computer manufactured in the last 10 years should) and I want both 64- and 32-bit support in my wine. If you do not want that then you'll have to skip some steps and figure it out on your own. Sorry.
Next, move into the wine source directory and create subdirectories where we will build the wine versions.
cd ~/src/wine
mkdir -p build/2.0/amd64
mkdir -p build/2.0/x86
Then build both versions. The order is actually important! You'll notice a "--prefix" option. This is where wine will be installed later. Modify it if you like to have it somewhere else. You can also add a "-j8" parameter to the make command where the "8" defines the parallel compilation for multicore CPUs. On my PC with 8 cores and 4 GHz clock rate one make-call takes about 10 minutes.
cd ~/src/wine/build/2.0/amd64
../../../configure --enable-win64 --prefix=~/apps/wine/2.0
cd ~/src/wine/build/2.0/x86
../../../configure --with-wine64=../amd64 --prefix=~/apps/wine/2.0
make install
cd ~/src/wine/build/2.0/amd64
make install
Congratulations! Assuming the compilation was successful you now have a version of wine locally installed that can be used by Q4Wine!

5. Configuring Q4Wine

There is an online-manual, but I think it's pretty terrible. So I'll go over the basics. First, open Tools->Wine Version Manager and add a new version. Call it "2.0" or "2.0-staging" or something. The paths are the following:

Binary:  /home/<yourname>/apps/wine/2.0/bin/wine
Server:  /home/<yourname>/apps/wine/2.0/bin/wineserver
Loader:  /home/<yourname>/apps/wine/2.0/bin/wine
Libs 32: /home/<yourname>/apps/wine/2.0/lib/wine/fakedlls
Libs 64: /home/<yourname>/apps/wine/2.0/lib64/wine/fakedlls
After that go to the "Programs" tab, right click in the left column and select "Create new prefix". Give it a nice name and select whether it's a 32-bit or a 64-bit virtual Windows install. In the second tab select your own compiled wine version.
The "Setup" tab allows you to select a prefix and then double-click "Install or update Winetricks script". After that finished double-click on "Refresh Winetricks application list". A list of installable packages will pop up. You can install anything in those directories via double-click. Sometimes when you want to install something a file explorer and a website will pop up. The feedback is a bit weird, but what it wants you to do is to download the file, put it into that directory and start the installation again.
Finally, back in the "Programs" tab you can right-click on a prefix and select "Run..." to select an .exe file to execute (i.e. some installer program). Inside prefixes you can create a new directory for shortcuts to installed programs. Those can be created with a right-click "New icon" in the right tab. The icons can then be dragged-and-dropped ideally into "~/.local/share/applications" for a shortcut that your desktop environment can and will use. So in the future you don't even have to run Q4Wine to run programs installed with it - the .desktop file will call the command-line version which manages starting it correctly.

6. Installing more wine versions

To install other versions of wine (for example when some program works best with i.e. version 1.7) just repeat the steps from chapter 3 except for skipping the clone command. Also make sure to change the installation prefix to somewhere else (i.e. ~/apps/wine/1.7) in order to not overwrite your already installed version.