Installing Irrlicht on a linux machine

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
greenbeast
Posts: 1
Joined: Wed Apr 24, 2019 12:18 pm

Installing Irrlicht on a linux machine

Post by greenbeast »

I have been trying to install project chrono to my laptop with 'Ubuntu 18.04.2 LTS" installed. Project Chrono requires Irrlicht to be installed to run its examples (also, I will use it for my project, if I can get it going). I have done the following:
1. Extracted the downloaded zip file for Irrilicht 1.8.4 and put it in the /Home directory.
2. Before following the instructions in readme.txt file in /home/irrlicht-1.8.4/bin/linux, I modified the Makefile in /home/irrlicht-1.8.4/source/Irrilicht by appending '-fPIC' to the following (3 lines were effected):

Code: Select all

###############
#Compiler flags
CXXINCS = -I../../include -Izlib -Ijpeglib -Ilibpng -fPIC
CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1
CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
ifndef NDEBUG
CXXFLAGS += -g -D_DEBUG
else
CXXFLAGS += -fexpensive-optimizations -O3 -fPIC
endif
ifdef PROFILE
CXXFLAGS += -pg
endif
CFLAGS := -O3 -fexpensive-optimizations -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -fPIC

3. I then called the terminal 'make' command from /home/irrlicht-1.8.4/source/Irrilicht. This created the library file /home/irrlicht-1.8.4/lib/Linux/libIrrlicht.a. [NB. how do I create a libIrrlicht.so instead of a libIrrlicht.a file? I have been told this is possibly a better solution]

4. However, when I call the terminal 'make' command to build an Irrilicht example (in /home/irrlicht-1.8.4/examples), I get the following error:

Code: Select all

greenbeast@Destiny:~/irrlicht-1.8.4/examples/01.HelloWorld$ make
Makefile:47: Building...
g++ -I../../include -I/usr/X11R6/include  -O3 -ffast-math main.cpp -o ../../bin/Linux/01.HelloWorld -L../../lib/Linux -lIrrlicht -L/usr/X11R6/lib -lGL -lXxf86vm -lXext -lX11 -lXcursor
/usr/bin/ld: cannot find -lXcursor
collect2: error: ld returned 1 exit status
Makefile:47: recipe for target 'all_linux' failed
make: *** [all_linux] Error 1
 
5. Also (and more importantly for what I am trying to do) when I try and use Irrlicht with a project-Chrono example, I get the following error:

Code: Select all

greenbeast@Destiny:~/Documents/Development$ make
[ 50%] Building CXX object CMakeFiles/crank.dir/SliderCrankMechanism.cpp.o
In file included from /usr/local/include/chrono_irrlicht/ChIrrApp.h:17:0,
                 from /home/greenbeast/Documents/Development/SliderCrankMechanism.cpp:29:
/usr/local/include/chrono_irrlicht/ChIrrAppInterface.h:18:10: fatal error: irrlicht.h: No such file or directory
 #include <irrlicht.h>
          ^~~~~~~~~~~~
compilation terminated.
CMakeFiles/crank.dir/build.make:62: recipe for target 'CMakeFiles/crank.dir/SliderCrankMechanism.cpp.o' failed
make[2]: *** [CMakeFiles/crank.dir/SliderCrankMechanism.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/crank.dir/all' failed
make[1]: *** [CMakeFiles/crank.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
 
So can anyone tell me what I am doing wrong so I can get this going?

Many thanks
CuteAlien
Admin
Posts: 9652
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Installing Irrlicht on a linux machine

Post by CuteAlien »

Note that Irrlicht is an Ubuntu package. So it might be sufficient to install that (with apt). I recommend doing that when you stay with Irrlicht 1.8.

If you want to compile yourself... (usually only necessary when you want to use Irrlicht from svn trunk).

XCursor is likely in package libxcursor-dev, but you can also just kick the lXcursor out I suppose (just means you can't create colored hardware cursors, as that's unfortunately not part of default X11).

The other error looks like you didn't set the include path. If you compile Irrlicht yourself and don't install it in the system (which you shouldn't, as that will just conflict with the official Irrlicht package), then you have to tell other code using it where the include and linker paths are.
I don't know the Makefile in your project, but you have to set there the include path to the Irrlicht headers (include folder) and the lib path to the Irrlicht lib folder.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply