Compiling On Linux
This tutorial was written by twentytortures. twentytortures+irrlict@gmail.com
This tutorial was originally written using Ubuntu 6.10 but should still work for other distributions. I followed these same instructions in February of 2008 on Fedora Core 8 and it worked perfectly.
Things you need
- A compiler, on Ubuntu systems this is as easy as typing "apt-get install build-essential", but I'm sure you've already got one :) .
- The OpenGL libraries "apt-get install glutg3-dev"
- These libraries "apt-get install libxxf86vm-dev"
- Irrlicht, just download it on Irrlicht's page.
Update: You can install XF86 vidmod on Ubuntu edgy by following these instructions. For some reason I didn't think to try that. Thanks to whoever provided this information.
What to do
Unzip Irrlicht to some handy location. Mine is in /home/mike/irrlicht so that is what I'll use as my directory, change it so it applies to yours. Open up a terminal and type:
cd ~/irrlicht/source/irrlicht
now type
make to build the debug version of the Irrlicht library.
make NDEBUG=1 to build the relase version of the Irrlicht library.
Irrlicht should now compile if you have everything installed on your system properly.
Some Errors You May Receive
Mine did not compile right away. I got some errors regarding XF86VidMode which is not installed on my system. If you get this error it's a simple fix, just open up IrrCompileConfig.h which is located in /home/mike/irrlicht/include with your favorite text editor and find the lines that look like this:
//! On some Linux systems the XF86 vidmode extension or X11 RandR are missing. Use these flags //! to remove the dependencies such that Irrlicht will compile on those systems, too. #if defined(LINUX) && !defined(__sun__) #define _IRR_LINUX_X11_VIDMODE_ //#define _IRR_LINUX_X11_RANDR_ #endif
Change it so that fourth and fifth lines look like this:
//#define _IRR_LINUX_X11_VIDMODE_ #define _IRR_LINUX_X11_RANDR_
And try running make again. If you get an error about RandR then you can comment out that line as well, but be aware that you will not be able to run fullscreen.
Hopefully it compiled fine.
Test It Out
I noticed that if I navigated to /home/mike/irrlicht/lib there was an archive named "Linux". I believe this was generated by the compilation procedure. Whatever it was, I couldn't use it. I found that the lib i wanted, "libIrrlicht.a", was located in the irrlicht/source/irrlicht directory. I just made a new directory named "Linux" in my "lib" directory and copied the lib there.
Now it's time to compile an example. Navigate to the first example and type in:
make
Hopefully it compiles for you. If you had to change your lib to use RanR then you will have to make some changes to the makefile. Just pop it open in a text editor and find the line that says all_linux: and change it so that it reads like this:
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXrandr -lXext -lX11
Save and exit and run make. (that was a lot of ands)
If you were able to compile, your executable will be located in /home/mike/irrlicht/bin/Linux
Other stuffs
If you have any questions or comments or anything else about this tutorial, just send an email to the email address provided at the top of this page.