installing torcs - rolltolev/SpeedThrill GitHub Wiki
There are tutorials already available for installing TORCS. Check TORCS homepage for more information. This wiki page is an additional help for installing torcs-1.3.7 from source. This is not exhaustive in approach rather supplementary to existing tutorials. It is more precise in fixing errors that you would still get while following available tutorials. Also, it is limited to x86_64 bit machines running 64 bit Linux. It only used gcc compilers ( version - v5.4.0
, v6.3.0
and v8.1.1
) for installation, development and testing purposes.

If you are building torcs-1.3.7 from source, you may end up with some common errors while running configure or make. Look at the following sections for such errors and their solution to fix them. Also, look at gcc notes for additional gcc version specific compilation.
While running ./configure if you get an error like Can't find XXXX file, you have to fix it by installing additional libraries. For rpm packages if you use dnf, then the best option is to use dnf provides "*file-name" e.g. dnf provides "*GL/gl.h"
to get the package that has this file. Most of of them are straight forward file/lib searches but for few it is little tricky. For example for fixing error Can't find libz if you search for package containing libz you will not get any result. You have to search package for zlib. Here is a list of packages to install for "Can't find XXXX file ( or lib )" errors :
Can't Find | Library (rpm) | Library (debian) |
---|---|---|
GL/gl.h |
mesa-libGL-devel |
mesa-common-dev |
GL/glut.h |
freeglut-devel |
freeglut3-dev |
plib/ssg.h |
plib-devel |
libplib-dev |
AL/al.h |
openal-soft-devel |
libopenal-dev |
AL/alut.h |
freealut-devel |
libalut-dev |
vorbis/vorbisfile.h |
libvorbis-devel |
libvorbis-dev |
libICE |
libICE-devel |
libice-dev |
libSM |
libSM-devel |
libsm-dev |
libXt |
libXt-devel |
libxt-dev |
libXi |
libXi-devel |
libxi-dev |
libXmu |
libXmu-devel |
libxmu-dev |
libXrender |
libXrender-devel |
libxrender-dev |
libXrandr |
libXrandr-devel |
libxrandr-dev |
libz |
zlib-devel |
zlib1g-dev |
libpng |
libpng-devel |
libpng-dev |
Additionally on a debian machine I had to install package mesa-utils
for running glxinfo.
NOTE : The above error list has not been verified to be the exhaustive set. It may be the case that you would get more such errors for missing files/libs and consequently have to install more packages. It could be other way too if your system is already loaded with many of these libraries.
While compiling with gcc, you may get one or more of the following errors depending on the gcc version you use to compile it. You can apply patches for corresponding errors. All patches are to be applied from base directory of torcs-1.3.7 as shown below (this base directory would have src, export etc. directories inside it).
# this is same as $TORCS_BASE for installing torcs
# this directory would have src, export directories inside it
cd /path/to/torcs-1.3.7
patch -p0 -i /path/to/selected_patch.patch
OpenALMusicPlayer.cpp: In member function ‘virtual bool OpenALMusicPlayer::streamBuffer(ALuint)’:
OpenALMusicPlayer.cpp:164:22: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
const char* error = '\0';
^~~~
make[3]: *** [/path/to/torcs-1.3.7/Make-default.mk:240: OpenALMusicPlayer.o] Error 1
make[3]: Leaving directory '/path/to/torcs-1.3.7/src/libs/musicplayer'
make[2]: *** [/path/to/torcs-1.3.7/Make-default.mk:679: subdirs] Error 1
make[2]: Leaving directory '/path/to/torcs-1.3.7/src/libs'
make[1]: *** [/path/to/torcs-1.3.7/Make-default.mk:679: subdirs] Error 1
make[1]: Leaving directory '/path/to/torcs-1.3.7/src'
make: *** [/path/to/torcs-1.3.7/Make-default.mk:679: subdirs] Error 1
If you get above const char pointer error in src/libs/musicplayer/OpenALMusicPlayer.cpp while compiling then apply this gcc_charp patch ( car111-all/patches/gcc_charp.patch
)
geometry.cpp: In function ‘void EstimateSphere(std::vector<Vector>, ParametricSphere*)’:
geometry.cpp:373:15: error: ‘isnan’ was not declared in this scope
if (isnan(r)) {
^
geometry.cpp:373:15: note: suggested alternative:
In file included from geometry.cpp:23:0:
/usr/include/c++/6/cmath:662:5: note: ‘std::isnan’
isnan(_Tp __x)
^~~~~
/path/to/torcs-1.3.7/Make-default.mk:240: recipe for target 'geometry.o' failed
make[3]: *** [geometry.o] Error 1
make[3]: Leaving directory '/path/to/torcs-1.3.7/src/drivers/olethros'
/path/to/torcs-1.3.7/Make-default.mk:679: recipe for target 'subdirs' failed
make[2]: *** [subdirs] Error 1
make[2]: Leaving directory '/path/to/torcs-1.3.7/src/drivers'
/path/to/torcs-1.3.7/Make-default.mk:679: recipe for target 'subdirs' failed
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory '/path/to/torcs-1.3.7/src'
/path/to/torcs-1.3.7/Make-default.mk:679: recipe for target 'subdirs' failed
make: *** [subdirs] Error 1
If you get above isnan error in src/drivers/olethros/geometry.cpp while compiling then apply this gcc_isnan patch ( car111-all/patches/gcc_isnan.patch
)