Tip to compile Irrlicht in linux

A forum to store posts deemed exceptionally wise and useful
Post Reply
mandrav
Posts: 117
Joined: Sat Aug 27, 2005 8:29 pm
Contact:

Tip to compile Irrlicht in linux

Post by mandrav »

The source/source.txt file that describes how to build irrlicht in linux, mentions two ways to fix the linker error about glXGetProcAddress.

Well, both ways are ugly, if I may say so.
The first disables OpenGL extensions. Not good. Use it only as a last resort...
The second requires a lot of search & replace from the user. Not good either.

In these situations, it is more comfortable to use a quick'n'dirty hack to get the job done.
Here it goes:

1) Edit source/Irrlicht/Makefile
2) Find the line that starts with CXXINCS:

Code: Select all

CXXINCS = -I"include/" -I"zlib/"
3) Change it like so:

Code: Select all

CXXINCS = -DglXGetProcAddress=glXGetProcAddressARB -I"include/" -I"zlib/"
4) Run make and enjoy :)

Basically, all we do is we 're using the preprocessor to our advantage. We 're asking it to replace for us all occurrences of glXGetProcAddress with glXGetProcAddressARB.

One small note about glXGetProcAddress:
The NVidia drivers export glXGetProcAddressARB (hence this fix). It might be possible though, that some other drivers export glXGetProcAddressEXT. So if you still get linker errors, try substituting glXGetProcAddressARB with glXGetProcAddressEXT and retry. You might get lucky ;)

HTH someone,
Yiannis.
finger007

Post by finger007 »

Hi Yiannis,

thanks a lot - this is really helpful!
I'll definitely try it.

Cheers,
Alex
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

great tip! Thnx Mandrav. I'll try it out. I'm making this thread sticky.
blackmangoes
Posts: 1
Joined: Wed Mar 08, 2006 9:30 pm

Debian / Ubuntu Dependencies

Post by blackmangoes »

I found it helpful to do

apt-get install libgl1-mesa-dev libglu1-mesa-dev libx11-dev x11proto-core-dev x11proto-gl-dev x11proto-kb-dev libpng12-dev zlib1g-dev x11proto-xf86vidmode-dev libxxf86vm-dev libxau-dev libxext-dev libxi-dev x11proto-input-dev x11proto-xext-dev libjpeg62-dev

Before doing make
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

thnx again Mandrav! your tip saved my butt today. I was getting some TextureClamp errors so I decided to erase my source folder and start from scratch again with your "makefile" fix, and it works nicely!

:D :D
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

I have Radeon 9550 and if i compile Irrlicht i have error:
/usr/lib/gcc/i486-linux-gnu/4.0.2/../../../../lib/libGL.a(glxext.o): In function `__glXInitialize':
: undefined reference to `drmMap'

What is wrong?
stodge
Posts: 216
Joined: Fri Dec 05, 2003 5:57 pm

Post by stodge »

-DglXGetProcAddress=glXGetProcAddressARB

This should go into the makefile for sure. :)
juantar
Posts: 9
Joined: Mon Apr 10, 2006 4:02 pm

irrlicht on ubuntu 7.04

Post by juantar »

For ubuntu 7.04 I had to do the following to be able to compile irrlicht apps:

sudo apt-get install g++
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev libx11-dev x11proto-core-dev x11proto-gl-dev x11proto-kb-dev libpng12-dev zlib1g-dev x11proto-xf86vidmode-dev libxxf86vm-dev libxau-dev libxext-dev libxi-dev x11proto-input-dev x11proto-xext-dev libjpeg62-dev
cd /usr/lib
sudo cp libGL.so.1.0.9631 libGL.so
sudo cp libGLU.so.1.3.060502 libGLU.so
sudo cp libXxf86vm.so.1.0.0 libXxf86vm.so
sudo cp libXext.so.6.4.0 libXext.so
sudo cp libX11.so.6.2.0 libX11.so
sudo ldconfig

I did the modifications to the makefile already mentioned but also I did change some things to 2 lines in the file. The lines now look like this:



LDFLAGS = -L/usr/lib --no-export-all-symbols --add-stdcall-alias -lGLU -lGL -lXxf86vm
CXXINCS = -DglXGetProcAddress=glXGetProcAddressARB -I"../../include/" -I"zlib/" -Ijpeglib -Ilibpng #-I/usr/include/X11

For the makefiles for the samples I had to change the OPTS line into:

OPTS = -I"../../include" -I"/usr/include/X11" -L"/usr/lib" -L"../../lib/Linux" -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
--------------------------------------------------------
juantar
tarpri.com
FlyingIsFun1217
Posts: 219
Joined: Fri Apr 13, 2007 8:29 pm
Location: Illinois
Contact:

Post by FlyingIsFun1217 »

On Ubuntu 7.04 w/ Radeon Mobility 9000 (M6 LY), I can compile with no makefile editing at all :)

FlyingIsFun1217
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

That should indeed be the default for most Linux distros. Moreover, if you use apt-get and you have to add the .so links on your own there seems to be something completely wrong with your system. And even in that case you should call ldconfig instead of creating the links on your own!
paradoximo
Posts: 18
Joined: Sun Jan 24, 2010 6:13 pm

Post by paradoximo »

I have stupid problem while i'm compiling source of downloaded irrlicht from svn...
check this out:

[log from Terminal]


kamil@kamil-laptop:~/irrlicht/source/Irrlicht$ make
g++ -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing -g -D_DEBUG -I../../include -Izlib -Ijpeglib -Ilibpng -I/usr/X11R6/include -DIRRLICHT_EXPORTS=1 -c -o CIrrDeviceLinux.o CIrrDeviceLinux.cpp
CIrrDeviceLinux.cpp:26:33: error: X11/Xcursor/Xcursor.h: No such file or directory
CIrrDeviceLinux.cpp: In member function ‘virtual bool irr::CIrrDeviceLinux::run()’:
CIrrDeviceLinux.cpp:1023: warning: dereferencing type-punned pointer will break strict-aliasing rules
CIrrDeviceLinux.cpp: In member function ‘Cursor irr::CIrrDeviceLinux::TextureToARGBCursor(irr::video::ITexture*, const irr::core::rect<int>&, const irr::core::vector2d<int>&)’:
CIrrDeviceLinux.cpp:2011: error: ‘XcursorImage’ was not declared in this scope
CIrrDeviceLinux.cpp:2011: error: ‘image’ was not declared in this scope
CIrrDeviceLinux.cpp:2011: error: ‘XcursorImageCreate’ was not declared in this scope
CIrrDeviceLinux.cpp:2020: error: ‘XcursorPixel’ was not declared in this scope
CIrrDeviceLinux.cpp:2020: error: ‘target’ was not declared in this scope
CIrrDeviceLinux.cpp:2032: error: expected ‘;’ before ‘pixelCol’
CIrrDeviceLinux.cpp:2039: error: ‘XcursorImageLoadCursor’ was not declared in this scope
CIrrDeviceLinux.cpp:2041: error: ‘XcursorImageDestroy’ was not declared in this scope
make: *** [CIrrDeviceLinux.o] Błąd 1



My version of Linux is Ubuntu 10.4...
I don't know why it isn't compiling.... few moths ago i had Ubuntu 9.10 and it compiled perfectly with no errors or something.


Help :)??
Image
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

It is because in the meantime we added cursor-support into Irrlicht. And on Linux it's by default using XCursor because I wanted the Cursor-support on Linux to be as good as the one on Windows. So when you install the XCursor dev package for Ubuntu it should compile again. Alternatively you can disable _IRR_LINUX_XCURSOR_ in IrrCompileConfig.h.

I'm still considering disabling that by default, because I fear a lot of people will complain after the 1.8 release. But well, then again I really like to have color-cursors also on Linux by default...
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
conallmmcg
Posts: 23
Joined: Sun Oct 19, 2008 2:35 pm

Post by conallmmcg »

i think simply updating the wiki ( linux build instructions) and adding the libxcursor-dev to dependency list and also the large apt-get command should solve most issues linux users ( debian based ) should be having ( as tbh they should be following the wiki instructions anyway)
Post Reply