Originally posted: 29 Sep 2014

http://web.archive.org/web/20150415133148/http://xpcoin.com/2014/09/29/urho3d-install-guide/comments/#comments

Urho3D Install tricks and tips


This guide is based on my install of Urho3D 1.3.1 on a 32bit Mint Linux.
It should be understandable for other linux distros and windows, ie just use the .bat file instead of the .sh files.

These are my quick notes while testing Urho3D, the details are in the links.
I don’t do any of this for a living ie gamedev, linux, cmake, nor C++, so if you find mistakes, please let me know.

I believe in having (all!) the source code, but you can install Urho3D as a prebuilt library.


OS Setup

To start, firstly read the build help page.
Especially the build options at the bottom!
Also read the other build targets as it will give clues, ie how to use the build option ie: -D if your new to cmake!
It’s not a race, read it! The steps below are current for now, but would have changed over time.

You may need to install extra software to have an environment ready for compiling, ie for 32bit mint linux:

sudo apt-get install build-essential gcc cmake libglu1-mesa-dev libogg-dev libopenal-dev libgtk-2.0-dev curl libpcrecpp0:i386 libasound2-dev libxrandr-dev

I recommend cloning the github repository and downloading the source via github to your user folder ~/ ie: ~/Urho3D-master
This way you can contribute any bug fixes you may find.

I also recommend installing code::block, it’s a good IDE and projects are automatically created for it.
Although, I prefer using QT Creator, Code::Blocks is also good and works straight away.

Urho3D Building

Once you have the code downloaded and your OS is setup, you run the setup script.
My build looks like this:

cd ~/Urho3D-master
./cmake_codeblocks.sh Build -DCMAKE_BUILD_TYPE=Debug -DURHO3D_SAMPLES=1 -DURHO3D_DOCS=1 -DURHO3D_EXTRAS=1
cd Build
make -j3

-DCMAKE_BUILD_TYPE=Debug
For tracing/debugging code.

-DURHO3D_SAMPLES=1
For installing and building the sample code.

-DURHO3D_DOCS=1
For generating the HTML class documentation, doxygen required.
If you don’t want to install doxygen, you can get the help HTML files from any of the static binary builds from the home page.

-DURHO3D_EXTRAS=1
Just in case it’s required later.

make -j3
the -J3 tells make to use 3 CPU cores, I like to leave one spare for background tasks.

Once compiled, you will have:
* Executables (samples, editor & NinjaSnowWar ) in the Bin folder
* Optionally, your documentation is in Docs/html/index.html (Bookmark it!)
* FYI all the source files (third party, engine, tools, samples, etc) are in the Source folder

If you get cmake failing because it’s missing a library, you simply install library it’s missing.

If you get linking errors like this:

Linking CXX executable /home/user/Urho3D-1.31/Bin/Urho3DPlayer
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make[2]: *** [/home/user/Urho3D-1.31/Bin/Urho3DPlayer] Error 1
make[1]: *** [Tools/Urho3DPlayer/CMakeFiles/Urho3DPlayer.dir/all] Error 2
make: *** [all] Error 2

It usually means that make (or gcc) can not find your library in the default location or with the correct library name.
In this case you can create a symbolic link from the library file to /usr/lib without a version number in the filename ie:

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so

Running the samples

Read the sample documentation and start playing!

Here is a youtube video of me quickly going through all the Urho3D samples:

More info here:
http://urho3d.prophpbb.com/topic451.html?sid=333272614105957532cc9b07c0b00b3f

Next, I’ll do a quick code explanation of the Hello World sample.