February 16 2008
Compiling Wine for Ubuntu Gutsy Gibbon 64 bit.
Tagged Under : Cedega, Crossover Office, Debian, Games, Wine
I’ve been using the 64 bit version of Ubuntu for about 3-4 months now. Considering that it has been satisfying my needs I’m pretty happy with it. I’ve also managed tog et quite a few people to try out Ubuntu as well. Recently one of my friends said that he would try out Ubuntu if I could get is favorite game to work on it which happens to be Call of Duty 4 : Modern Warfare. So I set out to see if Wine could be used to play COD4 (Call of Duty 4) on Ubuntu 64 bit Gutsy Gibbon.
I must say that although the process was kind of scary I managed to pull it off and finally get it to work. In fact here is a screenshot of it in game.
Before continuing I must say that the process is kind of scary for a person new to Linux and that you wont be able to get the best of graphic quality. As you can see the above is set to Low on my machine and it has a 8600 GT as a display card with 2 GB of RAM and a AMD x2 4400 Processor. I found that at low settings it was definitely playable. I would post a movie but unfortunately I haven’t exactly found out how glc works as of yet, which is a Fraps alternative for Linux. Anyway for the process to do this on your 64 bit machine read on.
First of all may I say that the tutorial for 32 bit distros i different from 64 bit ones. Before you say “How hard could it be” and try installing Wine from the repositories let me tell you upfront it won’t work. For this to work you need the Wine Git version installed. The reason for this is that you need to patch Wine for this to work. You can find more details about Wine Git here.
To start off we are going to have to first install three packages which are listed below.
git
git-core
patch
You can install these packages by running the command.
sudo apt-get install git git-core patch
Now that you have that installed lets download the latest Wine Git by using the command.
git clone git://source.winehq.org/git/wine.git wine
This process may take a bit of time based on the Internet connection you have. Now lets install the patch for Wine. You can get the patch here. Save this file to your Wine folder (this folder was created when you ran the above command). When saving the file I saved it as cod4.diff (this wa the name used in the other guides which I have linked below. You need to make sure that you are in the Wine folder when you execute the patch commands. The steps are shown below.
cd wine
patch -p1 < cod4.diff
If the steps when through successfully you should have gotten a message which says Hunk 1 - 4 successful. Although I don’t recall the actual message you definitely will know by the output if it worked or if it didn’t.
Lets now install all the dependencies we need for Wine which can be done using the following command.
sudo apt-get build-dep wine
For the next step we need to create a set of links between certain .so files in order to be able to compile Wine properly. Although I’m not quite sure why this is done I can guarantee you that the whole process won’t work without doing the same. As per WineHQ
mkdir -p `pwd`/lib32
ln -s /usr/lib32/libX11.so.6 `pwd`/lib32/libX11.so
ln -s /usr/lib32/libXext.so.6 `pwd`/lib32/libXext.so
ln -s /usr/lib32/libfreetype.so.6 `pwd`/lib32/libfreetype.so
ln -s /usr/lib32/libfontconfig.so.1 `pwd`/lib32/libfontconfig.so
ln -s /usr/lib32/libGL.so.1 `pwd`/lib32/libGL.so
ln -s /usr/lib32/libGLU.so.1 `pwd`/lib32/libGLU.so
ln -s /usr/lib32/libXrender.so.1 `pwd`/lib32/libXrender.so
ln -s /usr/lib32/libXinerama.so.1 `pwd`/lib32/libXinerama.so
ln -s /usr/lib32/libXi.so.6 `pwd`/lib32/libXi.so
ln -s /usr/lib32/libXrandr.so.2 `pwd`/lib32/libXrandr.so
ln -s /usr/lib32/liblcms.so.1 `pwd`/lib32/liblcms.so
ln -s /usr/lib32/libcrypto.so.0.9.8 `pwd`/lib32/libcrypto.so
ln -s /usr/lib32/libssl.so.0.9.8 `pwd`/lib32/libssl.so
ln -s /usr/lib32/libxml2.so.2 `pwd`/lib32/libxml2.so
ln -s /usr/lib32/libjpeg.so.62 `pwd`/lib32/libjpeg.so
ln -s /usr/lib32/libXcomposite.so.1 `pwd`/lib32/libXcomposite.so
ln -s /usr/lib32/libcups.so.2 `pwd`/lib32/libcups.so
ln -s /usr/lib32/libXcursor.so.1 `pwd`/lib32/libXcursor.so
ln -s /usr/lib32/libsane.so.1 `pwd`/lib32/libsane.so
ln -s /usr/lib32/libhal.so.1 `pwd`/lib32/libhal.so
ln -s /usr/lib32/libpng12.so.0 `pwd`/lib32/libpng.so
ln -s /usr/lib32/libgphoto2.so.2 `pwd`/lib32/libgphoto2.so
ln -s /usr/lib32/libgphoto2_port.so.0 `pwd`/lib32/libgphoto2_port.so
ln -s /usr/lib32/libldap.so.2 `pwd`/lib32/libldap.so
ln -s /usr/lib32/libldap_r.so.2 `pwd`/lib32/libldap_r.so
ln -s /usr/lib32/liblber.so.2 `pwd`/lib32/liblber.so
ln -s /usr/lib32/libxslt.so.1 `pwd`/lib32/libxslt.so
My friend Mehulved from IRC explained how I could create a script file which can do the same so I created a script file which would run the above commands. You can do that by first opening your test editor and type #!/bin/bash and then copy and paste all the commands into the file. Save the file as wine-links.sh (any name will do) into the wine folder. Open your terminal and enter the following commands.
cd wine
chmod + x wine-links.sh
This should allow you to run the file. You can run the file by typing ./wine-links.sh or by double clicking the file in Nautilus. After you have executed the file its finally time to start to compile stuff.
CC="gcc-4.2 -m32" LDFLAGS="-L/lib32 -L/usr/lib32 -L`pwd`/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32"
./configure
make depends && make
sudo make install
These steps might take quite a bit of time to finish based on your system configuration. Now open a terminal and enter the command wine and you should get the below screen.

While the terminal is open enter the following command.
winecfg
This should give you access to the Wine Configuration tool which allows you to adjust the settings for Wine. You want to set the default settings Windows Version to Windows XP here otherwise the game will not work.
Now before you go installing the game there is one more thing you want to do. You need the DirectX dll files in your Wine system32 folder before you start to install the game. You can copy the dll files from another Windows XP installation. I basically copied every single dll file form that folder to the wine system32 folder.
To install the game insert the CD and then enter the following commands.
cd /media/cdrom
wine ./setup.exe
This should install the game without no problem. Make sure you do not install Punkbuster cause it doesn’t work on Linux anyway. I chose not to install DirectX since I already have the files in my system32 folder in Wine. Finally after the installation is done download the No Cd patch for the game and replace the file iw3sp.exe with it. If you didn’t cancel the option to place the icons on your desktop you should have two icons on your desktop, one for Single Player and te other for Multiplayer.
Run Single Player and make sure you change the options in the graphics tab to low otherwise it might be quite slow on some systems. If everything went well you should be able to play COD4 without any problem.
Conclusion
1. Multiplayer does not work properly. I could join a game with no problem but the display gets divided into two and makes playing near to impossible. Check the picture below.
2. There is quite a performance degrade when playing the game on Wine.
3. To me the sound was better on Linux than was on Windows . I have no clue why , but definitely to me it sounded awesome.
4. I didn’t try to update to 1.4 so I have left that for another time.
5. The Wine version I am using is Wine 0.9.55.
References:
Linux-Gamers.net
Rob Whaley’s guide to COD4 on Linux
Wine Application Database
Wine Wiki for 64 bit Distros
And lots and lots of help from the folks of wine IRC Channel like oiaohm , scguy318, nanonyme, romster and Omnipotententity and quite a few folks from the Digit IRC channel.










The whole install process could have been scripted with a little knowledge of shell scripting. Guess it’s time to learn a bit of it and make sys admin stuff really easy.
[Reply]
Interesting Mehul. I’ll definitely check it out and try to create a script file which performs the above actions. I’ve downloaded the guide you mentioned yesterday and I have started reading it . So I shoud be able to create one very soon.
[Reply]
for some reason when i type in “cd wine
chmod + x wine-links.sh” it tells me “chmod: cannot access `x’: No such file or directory” please help me with this, email at cory_tretsky@yahoo.com. Thanks.
[Reply]
@Cory make sure you type the command as is (case sensitive) and there are no spaces in between the switches. Also Do you have the win-links.sh file created and saved in the right folder?
[Reply]
yes, it is created and saved right b/c it accepts that the wine-links.sh is there, and i coppied the command directly from the page. it just says that “x” is no such file or directory
[Reply]
@Cory: Hmmm Weird I might be missing something then
. the above did work on my Gutsy Gibbon system though. However for Hardy Heron my current system I already have Wine and didn’t have to compile anything to get my applications to work with it .
[Reply]