Urho3D Wiki

This section focuses on setting up and compiling Urho3D from source to run on any linux distribution. The purpose of this article is not to cover any possible aspect of Urho's build system but to provide simple instructions in order to set up everything fast. For a more detailed and in-depth explanation please refer to the official documentation at http://urho3d.github.io/documentation/HEAD/_building.html

Requirements and dependencies[]

TODO - Add the 32 bit packages for other distributions.

TODO - Add names of packages in other distributions.

In order to build Urho on Linux you have to meet the following dependencies:

  • Build tools (Make and GCC) - Available in build-essential (Debian) and base-devel (Arch Linux). In any RedHat-based distribution you'll need to install those separately: make automake gcc gcc-c++ kernel-devel
  • CMake - Avaliable as cmake in most Linux distributions.
  • OpenGL development files - freeglut3-dev worked on Ubuntu, may be also called mesa-dev or mesa-common-dev.
  • LibXrandr - Available as libxrandr-dev (Debian), libXrandr-devel (RedHat) and libxrandr on (Arch Linux).
  • Alsa lib - Available as libasound2-dev (Debian), alsa-lib-devel (RedHat) and alsa-lib (Arch Linux).

[Note: a previous editor had Libx11 instead of OpenGL development files, whitch seemed odd and freeglut3-dev worked. His note was: "Libx11 - Available as libx11-dev (Debian), libx11-devel (RedHat) and libx11 (Arch Linux)".]

If you are using a 64 bits system and want to build Urho as a 32 bit library you'll also need to get the 32 bit versions of LibX11, LibXrandr and Alsa lib mentioned above, and the 32 bit version of your graphics drivers. Refer to your distribution for which packages to choose.

Beginners note: "meeting the dependencies" means your computer needs to have all those packages installed. A minimal understanding of Linux systems is assumed for this guide. If you're unsure on how to install packages or basic usage of the terminal please refer to your distribution's support channel.

Beginners note: If you're on Ubuntu or Linux Mint you should refer to the same packages as Debian as both distributions are Debian-based. If you're on Fedora you should be using the RedHat packages for the same reason.

Downloading Urho3D[]

You can get Urho3D from the download site or by directly cloning from its git repository. For the later, some basic knowledge of git would be useful but not completely necessary.

First of all you should create two folders: The build folder and the repository folder. If you don't know where to place them, something like: /home/your_user/Repositories/Urho3D and /home/your_user/Urho3D is recommended. We'll refer to those folders as repository folder and build folder from now on.

It's a good idea to set up environment variables for those folders:

$ export URHO3D_HOME=the_build_folder
$ export URHO3D_REPOSITORY=the_repository_folder

You can add those lines to your /home/your_user/.bashrc to make them permanent.

Both download methods are described below. You should only follow one in order to build Urho.

Download latest stable package[]

This is the recommended option if you're unsure on how git works or don't know it at all.


Go into the newest version and look for "Urho3D-*.*-Source.zip" (or "*.tar.gz").

Clone from git repository[]

This is the recommended option, if you're already used to git, as it allows the most versatility.

Cloning from git allows you to get the latest Urho changes the very moment they are made. This ensures you get the latest features right away, but you might also encounter some bugs and unexpected changes. If you prefer it, you can also stick to the stable branch in order to get only the same changes as stable releases but being able to upgrade from git itself.

To clone the repository head over to: https://github.com/urho3d/Urho3D and look for the clone URL as shown in the picture:


After that, go to your repository folder and clone the Urho3D repository

$ git clone https://yourgithubusername@github.com/urho3d/Urho3D

This clones Urho3D's repository into a folder called Urho3D. You should replace yourgithubusername by your GitHub username. If you don't want to specify one leave that out and it will ask for it every time.

Prepare Building Urho3D using CMake[]

Once you have Urho3D's source code, either with git or manual download and have your environment variable URHO3D_HOME set (this directory should be empty as of now) you're ready to start building Urho.

Go to your repository folder and use one of the cmake scripts to create the build files. For example cmake_generic.sh does create make files per default, cmake_codeblocks.sh does create project files for Code::Blocks.

$ ./cmake_generic.sh $URHO3D_HOME [variable list]

Where [variable list] is a list with variables for CMake. If it's your first time building Urho, building the samples is recommended (-DURHO3D_SAMPLES=1, this is currently the default), and probably also you'll want to set up a debug build (-DCMAKE_BUILD_TYPE=Debug). Check out the "Build Options" section of the official documentation for a list of all the options you can enable: http://urho3d.github.io/documentation/HEAD/_building.html.

Building Urho3D using make (cmake_generic.sh)[]

$ make

Optional: You can use make with the -jX option. X is the number of threads you want to use to compile, use your number of logical cores for maximum speed. Anything higher is going to slow things down.

Depending on your processor this might take a while. Be patient and don't worry if you see warning messages. Once it's done you'll get back to your prompt. At this point you have successfully built Urho3D.

If make fails with errors[]

If make stopped with some errors before getting to 100%, it is very likely you don't meet the dependencies listed in the top of this article. The compiler / linker errors might give a hint for what's wrong. For example, missing symbols from alsa_lib probably mean your Alsa library is not correctly installed in the system.

Building Urho3D using Code::Blocks (cmake_codeblocks.sh)[]

If you used the cmake_codeblocks.sh script, there should be Code::Blocks project file (CBP) called Urho3D.cbp in the build directory. Open that and use the build button or Ctrl+F9 to build Urho3D.

Trying out the samples[]

You might be interested in trying out the samples you just compiled. In order to do that just go to your Urho3D build folder ($URHO3D_HOME) and run the samples.


Also, you can try to run the NinjaSnowWar game that ships with Urho. Use a terminal in your build folder:

$ ./NinjaSnowWar.sh


$ ./Urho3DPlayer Data/Scripts/NinjaSnowWar.as