Monday, September 21, 2009

Install TORCS on Ubuntu

I've got hold of a clean install Xubuntu 9.04 aka Jaunty Jackalope so I've decided to write down step-by-step what is needed to be able to build the latest TORCS version. I've done it many times now but never took time to note everything properly until now.
I hope you find the instructions below useful.

Method used
Brute force trial and error :) That is, you try to run TORCS's configure script and look at what it is complaining about. Then with the clever use of apt-cache search and dpkg -l and of course our good ol' friend grep you pick what is needed for real and you install that.
Below all the commands you must type in the mighty Terminal are in italics and follow the Ubuntu lifestyle of sudo-ing a lot.

  1. sudo apt-get install build-essential g++
  1. libpng: sudo apt-get install libpng12-dev
  2. the above also installs zlib1g-dev so zlib: OK
  3. OpenAL: sudo apt-get install libopenal-dev
  4. FreeGlut: sudo apt-get install freeglut3-dev - this pulls a lot of dependencies, too.
  5. X thingies: sudo apt-get install libxxf86vm-dev libxrender-dev libxrandr-dev
  6. ALUT: sudo apt-get install libalut-dev
  7. PLib: suxx, as Ubuntu Jaunty has only the 1.8.4c2 in the repo, so have to do some manual work here:
  • sudo apt-get install libxmu-dev libxi-dev
  • Visit the PLib download page.
  • Download the 1.8.5 version, then do as told: tar xzf plib-1.8.5.tar.gz
  • cd plib-1.8.5
  • ./configure
  • make
  • sudo make install
Now you have a working PLib1.8.5 so can go ahead. (If you accidentally get lost the FlightGear Wiki is a good place to look for help.)

  1. Download torcs-1.3.1.tar.bz2 (the all-in-one package, about 200MB).
  2. Unpack it: tar xfvj torcs-1.3.1.tar.bz2
  3. cd torcs-1.3.1
  4. ./configure --prefix=/usr/local --x-libraries=/usr/lib
  5. make
  6. sudo make install
  7. sudo make datainstall
You can play TORCS now by typing /usr/local/bin/torcs

Have fun! ;)


  1. Hi Kilo,

    I'm sorry I've seen this entry late. Had I known this before, I'd have given you the tip. Given that torcs is packaged for ubuntu, you can use apt in order to get all the build dependencies (at least the ones to build torcs like the package mantainer). You could have issued

    sudo apt-get build-dep torcs

    and it would have downloaded and installed all those pesky -dev libraries.

  2. Hi Miguel

    thanks for the hint - I prefer doing things manual though. Anyway your way can be useful, too.

    BTW does the build-dep way pull in the appropriate plib-dev dependencies?

  3. Awesome, thanks for this post. I used it to quickly gather the deps for compiling the head of the 1.3.1 branch.