How To: Run Call of Duty 4 (COD4): Modern Combat in Linux

Here in the city I affectionately call Salt Lake Shitty, Utah – it’s about as cold as a witch wearing an iron cupped bra doing push ups in the snow.


To offset this chilly weather, my best friend in the entire world* Yahtzee, who does a little piece for Escapist Magazine every Wednesday called Zero Punctuation warmed up to Call of Duty 4: Modern Combat, calling it a “Pretty Excellent Gun Wank” which in my book means it’s a 5-star title, and worth playing – but only if it runs in Wine.

*I am not actually friends with Yahtzee.

The Wine Application DB website says the compatibility rating of the game is Silver, which means it works excellently for ‘normal’ use. In less generalized color coded terms, this means that it works near perfectly after recompiling Wine.

I can hear the groaning and murmurs in the background – stop it!!! All this requires is a little bit of brainless copy and paste from this page into a terminal.

I spent a significant amount of time getting this to work on my own, and apparently I *did not* quote the source of most of what I posted here, for which I apologize. As far as I can recall, I had gone though the process of recompiling Wine with the 3dmark patch, downloading the D3D DLL and found a guide on Ubuntu Forums by ahaslam that had all my work plus more already posted.

Getting COD4 to run in Wine is really no more complicated than say… my tutorial on running all the games in the Orange Box (TF2, Portal, HL2, etc). Getting COD4 up and running takes a little bit more time, since compiling Wine takes the better part of 15 minutes on a relatively fast computer.

On a side note, perhaps the Department of Homeland Security should take a hint from the Wine folks and change their color-coded terrorism threat level matrix, since Wine’s implementation works pretty damn well, if I say so myself.

The story of my life is that I’m ready to kick ass and chew bubble gum, and I’m all out of gum. ARE YOU WITH ME? Let’s go and kill our existing Wine installation, and install a couple tools since we’re going to be rolling our own. Yeehaw!

sudo apt-get remove wine
rm -r ~/.wine
sudo apt-get build-dep wine
sudo apt-get install build-essential checkinstall rar

Next let’s download the source code for Wine, download and apply the “3dmark” diff patch, then recompile Wine. This guide has been updated to use Wine 0.9.56 and several changes have been made after usability testing. :)

mkdir wine && cd wine
tar -xvjf wine-0.9.56.tar.bz2
cp attachment.cgi\?id\=8548 wine-0.9.56/3dmark.diff && cd wine-0.9.56
patch -p1 < 3dmark.diff
./configure --prefix=/usr --sysconfdir=/etc --enable-opengl --with-x
make depend && make
sudo checkinstall

Now, we need to download and install a DirectX DLL file so that everything runs smoothly:
unzip -d ~/.wine/drive_c/windows/system32/

Change Wine to use Windows XP emulation mode, and ddd “d3dx9_34.dll” into the winecfg Library section as a Native dll:
On the Application tab, change the Windows Version to Windows XP

Now goto the Library tab, type in d3dx9_34.dll and press the Add button.

Now, I bought the game from Direct2Drive, which means I have an electronic copy – No disc at all, so after extracting the archive of the installation files I opened setup.exe from the directory I extracted it to. If you have the DVD version, just open the setup.exe file from your DVD with Wine.

Installation is a fairly standard process, however I had an issue that cropped up the two times I attempted to test my method, where it failed during the first attempt, but on the second attempt to install the game, it went through flawlessly. I did NOT install PunkBuster because it is not compatible with Wine – yet.






I installed a No-CD patch from Game Copy World just for good measure, and if you’re installing from a CD, you definitely will want this to avoid needing the CD every time you want to play the game or if you get this error like I did:


To install the No-DVD patch, download the iw3sp.exe file from Game Copy World, extract it to your Desktop, then run the following commands which will backup your existing game executable and copy the No-DVD patched one in its’ place:

mv ~/.wine/drive_c/Program\ Files/Activision/Call\ of\ Duty\ 4\ -\ Modern\ Warfare/iw3sp.exe iw3sp.exe.backup
cp ~/Desktop/iw3sp.exe ~/.wine/drive_c/Program\ Files/Activision/Call\ of\ Duty\ 4\ -\ Modern\ Warfare/

Finally, we’re ready to actually run the game.
cd ~/.wine/drive_c/Program\ Files/Activision/Call\ of\ Duty\ 4\ -\ Modern\ Warfare/
wine iw3sp.exe

Unfortunately, a Silver rated game means that some things don’t work, and some configuration changes are needed to make the game run smoothly. Turn off the following options for optimal performance:

Sync Every Frame
Specular Map
Depth of Field
Number of Dynamic Lights
Soften Smoke Edges

Soften Smoke Edges is the most important – Make SURE you turn this off, otherwise the game will not be playable at all.

Here’s a video of the game in action, enjoy!

The video doesn’t really capture the absolutely beautiful graphics COD4 has, it’s a really fantastic game engine. The maps are sweet, and the fact that it’s playable in Wine after a couple tweaks lets me easily recommend
Call of Duty 4: Modern Warfare

to all you Linux gamers out there.

  • ubuntunut

    WOW. That is amazing! Any idea if the wine devs plan on implementing this patch into the main install of wine? Or is this something they are working to implement natively on their own?

  • Wayne

    The patch has been floating around for quite some time now, I’m not sure if it will be integrated into the main branch.

  • k00pa

    That looks good, but I don’t want to ruin my wine install :(

    But is it possible to run hl2 etc faster with this 3dmark patch?

  • Oli

    Woo, you get what looks like a nice framerate! How powerful is your system?

  • Gil

    I hope this may help you about running PB in Linux.
    Please make tutorial about this:

  • Wayne

    k00pa: You can always “upgrade” this version to the latest version without much trouble.

    I’m not sure on the HL2 performance/3dmark patch relation, I’ll test it out later.

    Oli: 3.2GHz Core2Duo, 4GB RAM, 7800GT, Raptor

    Gil: Nice find! I’ll look into that, I haven’t even attempted to run PB after it failed the first time around, I’ll have to take a look at what errors it gives when it fails.

  • Jon Ramvi

    Hi there! Good work!
    Since you’ve already got it running in wine, could you please take the time to run it on windows as well, on the same machine and benchmark it? It would be awesome to see how many fps you loose using wine. Almost looks too good to be true :)

  • Wayne


    Thanks for visiting the site, and thanks for the comment, they are much appreciated.

    Instead of installing Windows and then the game which would take a couple hours away from other things like … oh… writing new articles, which you apparently enjoy, I’ll just give you a rough guesstimate:

    Running a game in Wine in a real-world scenario around a 10-20% reduction in FPS.

    It sounds like a lot, but it’s not much in reality when you do the math.

    I’m getting 50-60 FPS in Wine, that’d mean windows would be running at 60-72 FPS if my 20% guesstimate is correct – not bad, eh?

    Also, I’m running a LCD, so anything over 60FPS is just wasted since the hardware is limited to a 60Hz refresh rate.

    I try to respond to everybody… unless there’s hundreds of comments on an article then it’s mostly people responding to each other.

    Yeah, it did seem too good to be true, but that’s why I made a video to prove it works. Haha! On an unrelated note, I’m VERY excited about the new nVidia 9000 series video cards.


  • Adam Dodson

    Awesome work again wayne!
    Cod4 was one of the last things that keeps me dual booting on my main desktop, so I’ll give this a go :)

  • Oli

    Wayne is the process the same with 0.9.56 that just came out? Or would the patch break that?

  • Oli

    And I might be being thick (having never used checkinstall before) but do you pass it any special config?

    I’m trying to install using the 0.9.56 source, I’ve patched, go through all the checkinstall stuff using pretty default config but when I “wine –version” I get 0.9.55 come up (the last manually installed version).

  • Oli

    My bad, I had to remove (eg: sudo make uninstall) my previous build of Wine. –version now reckons I’m on 0.9.56 =)

  • david.cs

    What´s your hardware configuration?

  • ubuntunut

    Question: Why did you end up using the 9.50 version of wine?

  • Wayne

    I used 0.9.50 since the patch works with that version — I’m not sure if it works with later versions.

  • Wayne

    checkinstall makes a .deb file so apt-get remove works.

  • Oli

    By the way, I can confirm this (3dmark patch included) works on the latest Wine version, 0.9.56.

    Exactly the same instructions, just use “wine-0.9.56” where you see “wine-0.9.50”.

  • roxxe

    i did everything u told here, but when i run the game, i get an error: floating point support problem ? something with the visual c++ libary?

  • Oli

    roxxe: Use another crack. The firts sp crack I tried did the same. I found another and now it works fine!

  • masch

    Can apply this 3dmark path with wine 0.56??

  • Oli

    masch: Yes. Thought that’s what I just said =)

  • masch

    Another question, i have GTA San Andres with wine .56(not the compiled version) and with wine in some parts becomes slow, not in windows, so i compile this version and there was no difference, can i do something else to make it better?

  • Wayne

    I’m going to recompile 0.9.56 and attempt applying the patch to confirm.

    No idea on GTA – although that’s a game I’d like to play… it’s rated Platinum on the Wine AppDB so there shouldn’t be any problems – what video card and driver are you using?

  • Wayne

    This guide has been updated to use Wine 0.9.56 and several changes have been made after usability testing. :)

  • masch

    i have GeForce 7950 GT in Fedora 8 with nvidia proprietary driver. is it right?

  • Wintch

    El Wine se esta volviendo cada ves mas groso! Increible lo que se puede hacer en unos pasos usando tan pocas librerias propietarias, estaria lindo que compremos el Dx9 y lo liberemos, no? Teniendo en cuenta que Micro$oft esta a full con el Dx10 ahora…

  • Pingback: Call of Duty 4 aprobado! « Rogertrips()

  • Jack

    When i made checkinstall in Fedora 8 i got this error:

    make[1]: Entering directory `/home/jack/Download/wine/wine-0.9.56/include’
    ../tools/mkinstalldirs -m 755 /usr/include/wine/windows/ddk
    mkdir /usr/include/wine
    chmod 755 /usr/include/wine
    chmod: changing permissions of `/usr/include/wine’: No such file or directory
    make[1]: *** [/usr/include/wine/windows/ddk] Error 1
    make[1]: Leaving directory `/home/jack/Download/wine/wine-0.9.56/include’
    make: *** [include/__install__] Error 2

    **** Installation failed. Aborting package creation.

    Cleaning up…OK


    Do you know what is wrong?

  • nash

    thanks. It works really good. But how do i update the game to patch 1.5. I tried install to the game folder. But when run the game it was still ver 1.0 I am new to wine so this is my first time using it.

    Many thanks for this tutorial.


  • Wayne

    In fedora: First I would double check you’re running that as root, then try using “make install” instead, see if you get different errors.

  • Wayne

    nash: running updates shouldn’t require anything special to work properly, other than finding a new executable from GCW.

  • Wayne

    masch: Yep that’s correct.

  • pixelbrei

    Jack: seems to me like a bug in checkinstall, had the same. it says “mkdir bla” but it didn’t really create the dir.

    I just ran the
    mkdir /usr/include/wine
    manually, checkinstalled again, got the next dir not created, mkdir’ed it manually, and so on, until it worked.

  • pixelbrei

    It seems the performance is quite lower than on windows.
    I copied the installation folder from winxp to linux,
    and already set everything to low quality and 800×600.
    On winXP it was 90fps avg, on linux it’s like 40fps…

    And the ranks&challenges in multiplayer were not transferred, how do i copy them?

  • Wayne

    From 90 to 40fps… that’s really bad performance.

  • ubuntunut

    Well honestly, what do you guys expect? CoD is built on DX, not openGL. It won’t nearly as well as it could on Windows.

  • Jac

    if u do all this recompiling wine stuff, will it affect other games?

  • Warped


    First thanks for the HOWTO. COD4 is the only reason I boot Winblows these days and would love it if I could get this too work.

    So followed it and everything seemed to go like it was suppose but when I go to actually run the game I get the following errors…
    err:advapi:service_control_dispatcher pipe connect failed
    err:wgl:get_render_type_from_fbconfig Unknown render_type: 0
    err:d3d:WineD3D_CreateFakeGLContext Can’t find a suitable iPixelFormat
    err:d3d:InitAdapters Failed to get a gl context for default adapter
    err:wine_d3d:WineDirect3DCreate Direct3D9 is not available without opengl

    I’m running Ubuntu 7.10, nvidia 7600 GT with the latest proprietary drivers.

    Any thoughts? Thanks!

  • Oli

    I can confirm that this works (as is) with version 0.9.57 (just released) with no (noticeable) issues – just swap out wine-0.9.56 for wine-0.9.57 in the instructions.

    However, I’m getting a sound issue with ALSA on .57, so I’ve had to go back to OSS and ESD for wine sound. If you can hold off for the next release, I would suggest doing so.

  • John

    Hey, thx for all the help, but i came to the last step, which is

    cd ~/.wine/drive_c/Program\ Files/Activision/Call\ of\ Duty\ 4\ -\ Modern\ Warfare/
    wine iw3sp.exe

    (running COD4), but then theres a window that tells me that i need to insert the dvd in (i bought the game, and it was inside my dvd drive

    Do u know any solutions to this?

  • Wayne

    Sounds like you may have gotten the wrong file from gamecopyworld.

  • masch

    I compiled it with 0.9.56 version, now there is the 0.9.57 version, what should i do to compile the new version?


  • ne

    Hi Wayne,
    I am running ununtu 7.10 (64bit version)
    I followed the steps and reched until wine build, then i get the following errors:

    is it due to the 64bit ubuntu i am running..?
    -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith -g -O2 -o xvidmode.o xvidmode.c
    ../../tools/wrc/wrc –nostdinc -I. -I. -I../../include -I../../include -D__WINESRC__ -foversion.res version.rc
    ../../tools/winegcc/winegcc -B../../tools/winebuild -shared ./winex11.drv.spec bitblt.o bitmap.o brush.o clipboard.o clipping.o codepage.o dce.o desktop.o dib.o dib_convert.o dib_dst_swap.o dib_src_swap.o event.o graphics.o init.o keyboard.o mouse.o opengl.o palette.o pen.o scroll.o settings.o text.o window.o winpos.o wintab.o x11ddraw.o x11drv_main.o xdnd.o xfont.o xim.o xinerama.o xrandr.o xrender.o xvidmode.o version.res -o -luser32 -lgdi32 -ladvapi32 -lkernel32 -lntdll -L/usr/lib -lXext -lX11 ../../libs/port/libwine_port.a
    /usr/bin/ld: skipping incompatible /usr/lib/ when searching for -lXext
    /usr/bin/ld: skipping incompatible /usr/lib/libXext.a when searching for -lXext
    /usr/bin/ld: skipping incompatible /usr/bin/../lib/ when searching for -lXext
    /usr/bin/ld: skipping incompatible /usr/bin/../lib/libXext.a when searching for -lXext
    /usr/bin/ld: skipping incompatible /usr/lib/ when searching for -lXext
    /usr/bin/ld: skipping incompatible /usr/lib/libXext.a when searching for -lXext
    /usr/bin/ld: cannot find -lXext
    collect2: ld returned 1 exit status
    winegcc: gcc failed
    make[2]: *** [] Error 2
    make[2]: Leaving directory `/home/vikrant/wine/wine-0.9.56/dlls/winex11.drv’
    make[1]: *** [winex11.drv] Error 2
    make[1]: Leaving directory `/home/vikrant/wine/wine-0.9.56/dlls’
    make: *** [dlls] Error 2
    [email protected]:~/wine/wine-0.9.56$

    Thanks in advance!!

  • masch

    HI ne!
    Maybe yo should install Xext library and try again.


  • jack

    Wayne, Great guide thanks for your work. I have wine, patched, compiled and running on Ubuntu Hardy 64 system. I install wine 9.57. COD4 works fine.

    Ne: be sure to follow the sym link instructions here Put the mkdir -p `pwd`/lib32 folder in the extracted wine 9.5x folder. Once I did this I compiled without the same erros you are posting above.

  • FleX

    Gr8 how to there m8.

    I guess I’m slowly edging towards loosing the Windows box for gaming, and for me thats a good thing.

    Top marks on the single player campaign working, just a shame Punk Buster wont work for multi player, this basically means your playing against cheats (who have been found out and banned from every PB server) or Other Linux users, which would be fine if only there were another tab in the filter selection giving to option for Linux only :)

    Like I said, getting closer 😛

  • Pingback: so linux+games=no? - Page 2 - -

  • Finlandia

    Wow, shit ton of effort to get something running on Linux. Odd, hmm, just installed it on my Windows box, and proceeded to rock cock.

    So lame.

  • Wayne

    Finlandia: It’s not that much work, I’ve already done the hard part for everyone. :)

  • roney

    You got owned by a hacker using a program called “aimboting” because you can’t access Punk Buster servers. There’s no point in playing online without that unless you plan to hack the game yourself…