Compiling Sources under Linux
From Rigs of Rods Wiki
Tip: Shell scripts for automatic building
If you just want to install RoR without much hassle then have a look at these shell scripts, they bundle all necessary steps:
Rigs of Rods is very complex and is built on top of many components to provide its features. This results in a long list of dependencies. Most dependencies can usually be found in the software repositories of your distribution but some have to be compiled by hand. Fear not! While this may look overwhelming at first it is actually very easy if you follow these steps closely.
Note: Some dependencies are marked as optional. You can compile and run Rigs of Rods without them. However, we greatly recommend to install them. Chances are you want to use the features they provide sooner or later. Since the developers always compile with all dependencies it is also possible that building without the optional dependencies results in compiler errors. If you want to be on the safe side you should install them, which usually takes only very little time.
Dependencies of Rigs of Rods
Library and Software versions required to compile Rigs of Rods
- C/C++ compiler with support for C++11 (e.g. gcc >= 4.8)
- boost: >= 1.50
- cmake: >= 2.6
- libgtk 2.0
- mygui: >= 3.2.2
- ogre: 1.9.x
- OIS: 1.3
- openal-soft (any version should work, crashes with 1.15.x)
- wxWidgets >= 2.6
optional but recommended:
- AngelScript: 2.22.1
- Caelum: version >= 0.6.2, compatible with Ogre 1.9 - sky plugin, provides dynamic sky with day/night, weather and clouds
- mysocketw: latest from git
- nvidia-cg-toolkit - required for Cg shader effects which some mods use. Not libre software. Requires Ogre to be compiled by hand.
- paged geometry: latest from git
Installing required packages usually found in repositories
Ubuntu, Debian, Linux Mint and derivatives
sudo apt-get update sudo apt-get -q install build-essential git cmake pkg-config libboost-all-dev mercurial \ libfreetype6-dev libfreeimage-dev libzzip-dev libois-dev \ libgl1-mesa-dev libglu1-mesa-dev libopenal-dev \ libx11-dev libxt-dev libxaw7-dev libxrandr-dev \ libssl-dev libcurl4-openssl-dev libgtk2.0-dev libwxgtk3.0-dev \ nvidia-cg-toolkit
Compiling and installing missing packages
- add -jX after make for multithreaded building. More threads require more RAM. Example for quad core: make -j4
- if you want to avoid the use of sudo you can use CMAKE_INSTALL_PREFIX. This is not covered in these instructions. For an example see the Debian build scripts linked at the top of this page
It is recommended to create a directory for the dependencies:
mkdir ~/ror-deps cd ~/ror-deps
Ogre and its dependencies
Ogre version 1.9.x is required to build RoR. It's provided by many software repositories. Compiling by hand is only necessary if:
- you want to see Cg shader effects (needs nvidia-cg-toolkit to be installed) - otherwise black/yellow placeholders will be shown
- you want to make use of the new OpenGL 3+ render subsystem
- your distribution doesn't have Ogre 1.9 in its repositories
Ogre has some dependencies on its own which can be downloaded and built in one package. The package contains: freeimage, freetype, OIS, zlib and zziplib
If you use Debian/Ubuntu/Linux Mint and ran the apt-get install above you can skip the installation of ogredeps.
wget https://bitbucket.org/cabalistic/ogredeps/get/tip.zip -O ogredeps.zip unzip ogredeps.zip cd ogredeps cmake . make sudo make install cd ..
Ogre 3D is the rendering engine of Rigs of Rods.
hg clone https://bitbucket.org/sinbad/ogre -b v1-9 cd ogre cmake \ -DFREETYPE_INCLUDE_DIR=/usr/include/freetype2/ \ -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ -DOGRE_BUILD_SAMPLES:BOOL=OFF \ . make sudo make install cd ..
As the name implies MyGUI is needed for the GUI.
git clone https://github.com/MyGUI/mygui cd mygui git pull cmake \ -DFREETYPE_INCLUDE_DIR=/usr/include/freetype2/ \ -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ -DMYGUI_BUILD_DEMOS:BOOL=OFF \ -DMYGUI_BUILD_DOCS:BOOL=OFF \ -DMYGUI_BUILD_TEST_APP:BOOL=OFF \ -DMYGUI_BUILD_TOOLS:BOOL=OFF \ -DMYGUI_BUILD_PLUGINS:BOOL=OFF \ . make make install cd ..
Paged Geometry (vegetation - optional)
Paged Geometry is a plugin for OGRE taking care of vegetation. Without Paged Geometry there will be no vegetation at all.
git clone https://github.com/Hiradur/ogre-paged.git cd ogre-paged cmake \ -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ -DPAGEDGEOMETRY_BUILD_SAMPLES:BOOL=OFF \ . make sudo make install cd ..
Since there is no uninstall script run this to remove PagedGeometry
sudo rm /usr/local/lib/libPagedGeometry.so sudo rm -rf /usr/local/include/Paged
Caelum (dynamic sky - optional)
Caelum is a sky plugin for OGRE. Without a sky plugin you will only have a skybox, a static image filling the sky. Sky plugins make the sky look more realistic. They allow to set the time of day which is impossible without a sky plugin. Clouds and weather are only available with a sky plugin. Caelum only works with OpenGL and Direct3D but not with OpenGL ES.
git clone https://github.com/RigsOfRods/caelum cd caelum git pull cmake . make make install # important step, so the plugin can load: sudo ln -s /usr/local/lib/libCaelum.so /usr/local/lib/OGRE/ cd ..
since there is no uninstall script run this to remove Caelum
sudo rm /usr/local/lib/libCaelum.a sudo rm -rf /usr/local/include/Caelum
MySocketW (network play - optional)
MySocketW handles OS socket abstraction and is required for network play/multiplayer.
NOTE: You have to install the OpenSSL development package before you compile (libssl is not required if you are using Debian/Ubuntu and derivatives and ran the apt-get install command above)
git clone https://github.com/Hiradur/mysocketw.git cd mysocketw make -j2 shared sudo make install cd ..
since there is no uninstall script run this to remove SocketW
sudo rm /usr/local/lib/libSocketW* sudo rm /usr/local/include/SocketW.h sudo rm /usr/local/include/sw_*.h
AngelScript (scripting - optional)
AngelScript is required for scripting support. Scripting allows the use of the benchmark map, AI, races and server mods among others.
mkdir angelscript cd angelscript wget http://www.angelcode.com/angelscript/sdk/files/angelscript_2.22.1.zip unzip angelscript_*.zip cd sdk/angelscript/projects/gnuc SHARED=1 VERSION=2.22.1 make # sudo make install fails when making the symbolic link, this removes the existing versions rm -f ../../lib/* sudo SHARED=1 VERSION=2.22.1 make install #cleanup files made by root rm -f ../../lib/* cd ../../../../../
Building Rigs of Rods
Download the source code:
cd ~/ git clone https://github.com/RigsOfRods/rigs-of-rods.git cd rigs-of-rods
Configuring your build
Before you can compile the code you have to configure your build by running cmake. cmake automatically detects what platform you are using, finds the dependencies, sets up the flags for the compiler accordingly etc..
There are two ways to run cmake, one is to run cmake from the console. This is straigt forward and thus recommended. Instead you can use cmake-gui if you prefer GUIs. The GUI has the advantage that it shows multiple configuration options which are not shown by the CLI. But you usually don't need them anyway.
The cmake GUI may not be provided on all systems or has to be installed in addition to cmake.
To start the GUI for cmake run:
- click "Configure"
- select "Unix Makefiles" and "Use default native compilers" (that are the default options) and press "Finish"
- click "Configure" again until all list entries are white
- look at the log window for information and errors (look for red lines with " > " in front)
- enable the components you want to compile in: ROR_*
- click "Configure" again until the "Generate" button is click-able
- click "Generate"
- close cmake-gui
Building the source code
To start building simply run:
That's it! You finally built Rigs of Rods. Now you should read Starting RoR under Linux
Updating existing sources
If you already got the sources and just want to update, follow the steps below:
cd rigs-of-rods git pull rm -f CMakeCache.txt rm -rf CmakeFiles/ cmake . make
Verification of the instruction on this page
- Xubuntu 14.04.1 64 bit -- User:Hiradur 22nd Oct, 2015