Need help installing irrlicht on ubuntu

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
saadjumani
Posts: 5
Joined: Sat Apr 16, 2016 9:44 am

Need help installing irrlicht on ubuntu

Post by saadjumani »

Hello guys, as you can guess from the title, im a complete newbie in game development from scratch. I do have fair bit of experience of programming in C++, JavaScript and python and I have used a couple of bigger tools like Unity and Unreal but never built anything directly from just a programming language and a bunch of headers and libraries. So I was kinda thinking it is about time I change that (for personal learning).

So when I searched on how to get irrlicht, I understood there are two ways to do that. 1 Compiling from source using a whole bunch of commands in installation page, or using $ sudo apt-get update followed by $ sudo apt-get install irrlicht irrlicht-dev. Now I do not plan to make any contributions to the source code just yet(for very obvious reasons. Would love to do in future though, as I get the hang of it). Keeping that in mind, what exactly is the difference between these 2 ways of compiling from source code and getting it directly.

If it helps, I will be using Code::Blocks IDE so any hints about additional configuration I might need to do would also be appreciated.
amziraro
Posts: 13
Joined: Fri Jan 22, 2016 2:09 pm
Location: Australia

Re: Need help installing irrlicht on ubuntu

Post by amziraro »

Hi saadjumani,

As a Ubuntu user myself I think I can help. Unfortunately I don't use C::B so I can't help there. (Geany + Makefiles! :D )

First up, whichever you choose, only install one. You can have problems if you have both distro provided packages and manually downloaded stuff (I'll get to that latter).
Just a quick note; I'm running Ubuntu 15.10 (Wily). This information should hold for older versions, Debian Jessie and Sid and most recent Debian based Distros.

For the Distro provided Irrlicht...

Code: Select all

 
sudo apt-get install libirrlicht1.8 libirrlicht-dev libirrlicht-doc
 
...will get you Irrlicht.
The docs get put in `/usr/share/doc/libirrlicht`.
Note that libirrlicht-dev contains the headers and libs that you link against, while libirrlicht1.8 contains the libs for running

I don't recommend the Distro version. First, its out of date. It packages Irrlicht 1.8 or 1.8.1 (we're up to 1.8.3, and SVN is 1.9).
Second, it is disorganised when compared to the manually downloaded version; e.g. the examples are in `/usr/share/doc` along with the documentation, which makes them hard to compile. You have to copy them somewhere else and then modify the Makefiles (and probably the C::B project files) to make them work.
Thirdly, the 'dev' package doesn't provide sources, only headers. This is terrible if you want to modify Irrlicht, because then you have to manually download and take the other option.

Obviously, I don't recommend this option.


For the official Irrlicht version...

Code: Select all

 
sudo apt-get install subversion build-essential g++
 
Will get your basic build environment setup, you will probably need more than this or already have this.

Code: Select all

 
svn co https://svn.code.sf.net/p/irrlicht/code/branches/releases/1.8/
 
This will use svn (from the subversion package) to download ('check out') the latest revision of Irrlicht stable (1.8.x, currently 1.8.3)
You can also get the trunk (ie: unstable but awesomer) version from https://svn.code.sf.net/p/irrlicht/code/trunk/

This is the part where you compile from source. The only command `make -j` is the part that actually starts to compile it.

Code: Select all

 
cd <irrlicht root>/irrlicht/source/Irrlicht/
make clean
make -j
 
This will drop you into the Irrlicht source folder, and compile a static lib for you.
Point your C::B project at the headers (include/) and the static lib (lib/Linux/libIrrlicht.a) and you're done.
You might be interested in the example projects under example/
The -j flag for make tells it to use multiple threads, which speeds up compiling.
Note, there should also be a C::B project file for compiling Irrlicht, but I have never used it.

Additionally, you can change some compile time settings by editing '<irrlicht root>/include/IrrCompileConfig.h' After editing this, you must recompile.

You don't have to install this, so you won't even need root access for most of this! Except for installing packages. :P
If Make throws errors at the final stage (linking), you will need to install the dependencies, mainly to do will X11 and OpenGL dev. Remember to install the '-dev' versions.
A need hack is to install the distro version. This will (or should) install the correct dependencies. Then remove the disto version of irrlicht, leaving the dependencies.

Differences and Issues
Now, grabbing the Irrlicht source means that you can change it, patch it, recompile, whatever, while the Distro version can't be recompiled as it doesn't include the source. Of course, you don't have to compile the Distro version in the first place, so it might be more convenient.

Manually compiling everything isn't that hard or even that complicated.
The manual method is more complicated, yes, but more rewarding. Manual install also means you won't have to cd around the rootfs looking for offline documentation and example code.

Also DO NOT install both at once. (Except briefly for the hack described above.)
You can (and Murphy says it will) end up accidentally linking with the Older distro version while compiling with the 1.8.3 headers (or worse, the 1.9 headers). Or vis versa. This is bad™.

Finally, the manual method will let you try the SVN 1.9 trunk and other branches.

Hope this is helpful.
~Amziraro
saadjumani
Posts: 5
Joined: Sat Apr 16, 2016 9:44 am

Re: Need help installing irrlicht on ubuntu

Post by saadjumani »

Thank you so much. This was extremely helpful. I compiled it from source and it worked perfectly. In the end I had some minor trouble linking it with Code::Blocks so for anyone with same problem browsing this, just follow steps mentioned by Amziraro and then do the following:
-Open up your C::B project
-In project management sidebar right click on the project, select build options and in the new window that pops up, make sure the project is selected not debug or release
-Go to search directories, select compiler tab and add the path to the include folder inside irrlicht directory. (In my case irrlicht folder was names 1.8 so my path was /home/jumani/1.8/include, where jumani was my username).

Now go to linker settings and in link libraries option add the following:
Irrlicht
GL
GLU
Xxf86vm
Xext
X11

After that go back to search directories, and this time select linker and add the path to the folder that contains libIrrlicht.a

Thats about it if your installation has gone well and systems settings haven't been messed with it should work now.
Post Reply