Sorry, you need to enable JavaScript to visit this website.

Return to Castle Wolfenstein on GNU/Linux

Homer's picture

RTCW

Like most iD titles, RTCW was ultimately released under the GPL, and is thus available as a GNU/Linux native game. Installing it under Gentoo is as simple as "emerge games-fps/rtcw", but unfortunately the game itself no longer works in modern GNU/Linux systems. This is only to be expected with proprietary software that becomes abandoned, and would affect the operation of that software on any OS, but naturally it doesn't have to be that way with Free Software, which can be revived at any time, even years later.

Currently there are several issues with iD Software's (now old) binary release, including a "ui/menddef.h not found" error, an inability to launch without a pre-existing "default.cfg" (and an inability to create an initial copy), a problem setting the correct video mode, an inability to accept keyboard input, broken support for SDL audio (which falls back to the now typically non-existant /dev/dsp device), a stack overflow condition triggered by large OpenGL extension strings (fixed by setting the variable "__GL_ExtensionStringVersion" to a lower number, typically 17700), and finally the source is not yet 64-bit ready.

The latest development of RTCW is bzzwolfsp [ed: the project is now called rtcwcoop], a "modification of the RTCW single player source code that brings you Cooperative gameplay", however I've had no luck getting it to work (the same "ui/menddef.h not found" error, and a "black screen of death" on the menu). It also seems to be only a coop game that offers no single player mode [ed: confirmed], and simply ignores the original pak3 files. Needless to say it's still a WIP.

Edit: 18th May 2013. You can safely ignore everything below (except the config information), and just fetch the fully patched and 64-bit-ready sources from here instead. This also fixes the cinematic cut-scene problem.

But then I discovered this thread on the Arch Linux forum.

Following the simple instructions on that forum, I was able to build a fully-functional version of RTCW, and play the original single-player mode.

Get the sources here (see post #7 in the above thread for a list of build dependencies):

hg clone http://hg.ioquake.org/rtcw-sp # hg = Mercurial
cd rtcw-sp
wget http://slated.org/files/rtcw-1.41.patch
cd src
mkdir sdl && cd sdl
wget https://raw.github.com/cbxbiker61/wolfsp/master/src/sdl/sdl_snd.c
wget http://slated.org/files/sdl_snd.c.patch
patch -p0 <sdl_snd.c.patch
cd ../..
patch -p1 <rtcw-1.41.patch

git clone https://github.com/hexameron/RTCW-SP-linux
cd RTCW-SP-linux/src
CFLAGS="-march=i686 -O2 -pipe -fomit-frame-pointer" # edit to taste, supports 64bit too
sed -i "s/\$BASE_CFLAGS = \$COMMON_CFLAGS . '-D.*$/\$BASE_CFLAGS = \$COMMON_CFLAGS . '-DNDEBUG $CFLAGS ';/" unix/Construct
make
mkdir -p ~/RTCW/main/

strip --strip-unneeded unix/release-x86-Linux/full/unix/wolfsp.exe unix/release-x86-Linux/out/main/*
cp unix/release-x86-Linux/full/unix/wolfsp.exe ~/RTCW/wolfsp
cp unix/release-x86-Linux/out/main/* ~/RTCW/main/
cd ~/RTCW

You'll need to copy all your *.pak3 files over to the ./main directory (e.g. from the demo files or Wine install from CD) then run:

./wolfsp

This will create and populate the ~/.wolf directory with configuration files, then start the game in the default (low, 4:3) resolution. For those with an HD display, you'll need to exit the game then do the following:

echo "seta r_mode \"-1\"" >>~/.wolf/main/wolfconfig.cfg
sed -i 's/seta r_customwidth.*$/seta r_customwidth "1920"/' ~/.wolf/main/wolfconfig.cfg
sed -i 's/seta r_customheight.*$/seta r_customheight "1080"/' ~/.wolf/main/wolfconfig.cfg

Getting cheats to work is a bit convoluted, but it works if you do the following:

echo "set sv_cheats 1" >> ~/.wolf/main/user.cfg
./wolfsp.x86 +set sv_cheats 1

Start a new game, open the in-game console with the "`" (backtick) key, and type:

/sv_cheats 1

You'll get an error about sv_cheats being read-only. Ignore that, save the game, then quit. Launch RTCW again using the same flags as before, load the saved game, open the in-game console then type:

/god
/give all

This will make you invincible (god) and give you all available weapons and full ammo (give all).

Other cheats to try include "/nofatigue", which lets you run forever without running out of energy; "/notarget", which makes you invisible to enemies (and allies!); and "/noclip", which lets you fly, move through solid objects, and see a bird's eye overview of the entire map.

Enjoy.

Comments

Anony Mouse's picture

RTCW at Linus -- easy instruction

I publish overview of the compile here at my github repository (see akaWolf user)

Anony Mouse's picture

Initializing Shaders -----

Initializing Shaders
----- finished R_Init -----
^3WARNING: R_FindImageFile could not find 'ui/assets/SMOKE-16bit.tga' in shader 'console'
^3Shader console has a stage with no image
^3WARNING: R_FindImageFile could not find 'ui/assets/wolficonback4.tga' in shader 'console2'
^3Shader console2 has a stage with no image
ok
----- CL_Shutdown -----
RE_Shutdown( 1 )
SMP: Render thread ended.
Closing SDL audio device...
SDL audio device shut down.
-----------------------
Sys_Error: recursive error after: ^3menu file not found: ui/menus.txt, using default

im dont have /ui folder, any idea ?

Homer's picture

ui folder

The "/ui folder" is actually a virtual folder contained within the sp_pak1.pk3 data file. If you open or extract it with 7zip or similar then you should see the contents. On the original sp_pak1.pk3 file that I'm looking at, there is a "ui/menus.txt" file, so I assume your data file is either corrupt or can't be found because it's in the wrong location (must be in ~/RTCW/main, along with all the other pk3 data files).

You can ignore the other warnings, as they're just cruft left over from the developers who use custom icons not available in the official data files.

Anony Mouse's picture

Great. Thank you. Worked on the first try

On Ubuntu 16.10 64bit, intel HD4000 (Core i7). Clean compilation.
I'm on my Mission 3. :)

Many thanks for the good work, Homer!

Anony Mouse's picture

Still not working..

Hello! Good to know you have done so much work
But it does not work for me.
1. When I try to install native linux version I see the first screen with a begining of the presentation of the game but then the terminal starts and I get the error:
file ui/setup.menu, line 1: file ui/menddef.h not found
2. I have tried to "make" your version, and it gives me a different error:
*** stack smashing detected ***: ./wolfsp terminated
Aborted (core dumped)
3. I have also tried to run in wine and here is what it gives me an Error:
Couldn't load default.cfg

Thank you very much for the work you have done, hope you will have some time for reply

Kind Regards
Artem

Homer's picture

Check your CFLAGS

Sounds like you are running a version built for the wrong architecture, and/or using the wrong CFLAGS.

Build it yourself using CFLAGS derived from the following command:

gcc -### -E - -march=native 2>&1 | sed -r '/cc1/!d;s/(")|(^.* - )|( -mno-[^\ ]+)//g'
Anony Mouse's picture

crash

Hi, I've build the game without any problem, launched it and it works fine.
But it segfault after a second launch, I have to delete the .wolf directory to get it work another time :(
Any idea to solve this issue?

Luca

Homer's picture

Sorry, no

Not without a crash dump.

Anony Mouse's picture

Figured it out!

After about an hour of troubleshooting, I figured out the problem! For whatever reason, RTCW scans your GPU and CPU and launches one of its recommended configs inside pak0.pk3. What I found is that the wolfconfig.cfg then gets the following command added:

seta com_recommendedSet "1"

The game CANNOT launch with this command active for whatever reason. The steps I took to both prevent this command from reappearing AND to force the game to stop changing my resolution and GFX options are as follows:

1. Delete wolfconfig.cfg located in your /.wolf/main folder

2. Launch wolfsp from the terminal, then quit.

3. Check the terminal output, or copy and paste into your favorite text editor, and look for a line towards the beginning similar to this:

execing highVidlowCPU.cfg

This is the .cfg file located in the pak0.pk3 file we will need to edit.

4. Open pak0.pk3 (I used an archive manager, but I believe you can use terminal as well) and find the .cfg file to edit in the root directory.

5. Edit this file to only contain the following command:

seta com_recommendedSet "0"

and save to update the .cgf file within pak0.pk3.

6. Edit the seta com_recommendedSet line inside /.wolf/main/wolfconfig.cfg from "1" to "0". While you're in there, change r_mode to -1 and edit the r_customheight and r_customwidth parameters to the resolution of your choice. Then save.

That should do it! Since then, I've had absolutely no problems launching the game from terminal.

So sit back, relax, and enjoy toppling the Third Reich!

Anony Mouse's picture

Same problem, some ideas

I'm having the same problem. After a little investigating, the .cfg file RTCW generates is bugged in some way, as whenever it is present as anything other than a blank file or a list of keybinds, it crashes the game. I suppose I could force the program to not generate a .cfg file, but I'd rather not play through the game in 640 x 480. Any ideas?

Anony Mouse's picture

fatal error: SDL/SDL.h: No such file or directory

hey man.

when I tried to do a make the log gives me the following

#####

hostname ~/Downloads/rtcw/RTCW-SP-linux/src $ make
cd unix && ./cons
Wolfenstein version 1.41
cpu : x86
OS : Linux
configured for release build
CFLAGS: -pipe -fsigned-char -DNDEBUG -march=x86-64 -O2 -pipe -fomit-frame-pointer
gcc -pipe -fsigned-char -DNDEBUG -march=x86-64 -O2 -pipe -fomit-frame-pointer -c release-x86-Linux/full/unix/sdl_glimp.c -o release-x86-Linux/full/unix/sdl_glimp.o
release-x86-Linux/full/unix/sdl_glimp.c:52:21: fatal error: SDL/SDL.h: No such file or directory
#include
^
compilation terminated.
cons: *** [release-x86-Linux/full/unix/sdl_glimp.o] Error 1
cons: errors constructing release-x86-Linux/full/unix/sdl_glimp.o
make: *** [all] Error 2

####

I've installed SDL and all dependencies. What could be wrong?

many thanks

Homer's picture

Development headers

You need more than just SDL, you also need its development headers, typically called "sdl-devel" or similar, depending on your distro. This is because you are not merely using SDL but actually compiling software that links to it. This is called a "build dependency".

Anony Mouse's picture

Console not showing

Hi,

thanks to your instructions, I was able to replay one of my favourites shooters of all time on my Linux machine. I finished RTCW on the hardest level. Now I'd like to play some custom maps that can be found on the web, but this requires me to access to the console. There's no way I can access that one. I try the key below ESC, but to no avail. It's a german keyboard and the game itself is in Italian. A sidenote: When I try to bind some German key (like 'Ä') to some action, I get . If I press some of these keys during gameplay, I get ' is not set, use controls menu to set'.

Do you have any idea why the console is not showing? Is there a way to configure the console access from within a config file?

Thanks!
//p4630

Homer's picture

Console

First make sure that you have the following in your ~/.wolf/main/wolfconfig.cfg

bind ` "toggleconsole"

And/or

bind ~ "toggleconsole"

Also make sure that your $LANG environment is set correctly, and that you can normally type the above characters (or whatever other characters you choose) in a terminal. If you have no way to type those characters in other programs, then they won't work in this game either, so you'll have to choose whatever characters your keyboard locale provides instead.

Anony Mouse's picture

toggleconsole were both set

toggleconsole were both set like you described in wolfconfig.cfg.

Also, I'm able to use the characters I've mentioned in other programs. I bought RTCW in Italian, but I'm running Ubuntu with German locale. However, I am now able to activate the console by using another binding (L in my case).
Thanks!

Anony Mouse's picture

THANKS A LOT!

It worked for me as well. I had to install one additional packet, and replace "i686" for "x86-64" in the recipe, and then I was able to compile the executable and play RtCW in my Ubuntu 12.04 LTS for x86-64.
Everything was O.K., thanks a lot! Greetings from Argentina.
Ricardo Caljem

Anony Mouse's picture

error in compilation

After lot of apt-get installing libs, I get this error and now I don't know how to proceed:

[...]
/usr/bin/ld: /usr/lib64/libSDL.a(SDL_syssem.o): undefined reference to symbol 'sem_getvalue@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
cons: *** [release-x86-Linux/full/unix/wolfsp.exe] Error 1
cons: errors constructing release-x86-Linux/full/unix/wolfsp.exe
-----------------

Any idea? Thanks :-)

Anony Mouse's picture

Awesome.

Thank you for this -- I was ready to resort to WINE.

Worked perfectly on Fedora 18 (x86_64). Needed to install several libraries during the "./cons -- release" step, but elsewise went without a hitch -- and with the side effect (thanks to the SDL patch) of SOUND working (which is awesome).

Good article.

Anony Mouse's picture

Worked perfectly?

$ ./cons -- release
Wolfenstein version 1.41
cpu : x86
OS : Linux
configured for release build
CFLAGS: -pipe -fsigned-char -DNDEBUG -O3 -ffast-math -fno-strict-aliasing -fstrength-reduce
gcc -pipe -fsigned-char -DNDEBUG -O3 -ffast-math -fno-strict-aliasing -fstrength-reduce -c release-x86-Linux/full/jpeg-6/jerror.c -o release-x86-Linux/full/jpeg-6/jerror.o
In file included from release-x86-Linux/full/jpeg-6/../renderer/tr_local.h:37:0,
from release-x86-Linux/full/jpeg-6/jerror.c:22:
release-x86-Linux/full/jpeg-6/../renderer/qgl.h:57:19: fatal error: GL/gl.h: No such file or directory
compilation terminated.
cons: *** [release-x86-Linux/full/jpeg-6/jerror.o] Error 1
cons: errors constructing release-x86-Linux/full/jpeg-6/jerror.o
$

Homer's picture

Missing build dependencies

Sorry for my late reply. You've probably already figured this out for yourself, but just in case you haven't:

The error "fatal error: GL/gl.h: No such file or directory" tells you the development header file "gl.h" is missing. This is a component of the OpenGL project called MESA, typically called "mesa-dev" or "mesa-devel", depending on your distro.

On Debian and all its derivatives (such as Ubuntu and Mint) I believe the package containing "gl.h" is called "mesa-common-dev". On Gentoo it's simply part of the main "media-libs/mesa" package. On Fedora and other Red Hat derivatives it's called "mesa-libGL-devel".

Hope that helps.

Anony Mouse's picture

thanks for this

After a fk.... lot of lib upgrades working great on Mint 15 Cinnamon

Thanks

am a nubie on Linux and everyday like it more.

Thx again