Debugging

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
Yarcanox
Posts: 33
Joined: Sat Apr 14, 2007 11:23 pm

Debugging

Post by Yarcanox »

When compiling the irrlicht engine/irrklang engine (I included them both) with -g for debuginfo (to view the source code in gdb/ddd), I get the following error:
g++ -I./include -I/usr/X11R6/include -g -O3 -ffast-math bagaioseph.cpp -o ./game -L/usr/X11R6/lib -L./lib -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11 -I"./irrKlang/include" -L"/usr/lib" ./irrKlang/bin/linux-gcc/irrKlang.so -pthread
'++: unrecognized option '-pthread
./irrKlang/bin/linux-gcc/irrKlang.so: undefined reference to `pthread_create'
Because I got a segmentation fault...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1223293200 (LWP 11000)]
0x0804eeb8 in main ()
(gdb) cont

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb)
...I'd like to know if it is my fault or an Irrlicht bug, and I have no idea how to do this without being able to view the line where the error happened in gdb/ddd.

EDIT: PS: btw: compiling works fine without the -g option without any error messages - but of course I don't have the debug info then :(
I'm not a native English speaker.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Debugging

Post by CuteAlien »

Yarcanox wrote:'++: unrecognized option '-pthread
Try what happens if you add this as -l option like: -lpthread
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
Yarcanox
Posts: 33
Joined: Sat Apr 14, 2007 11:23 pm

Post by Yarcanox »

/usr/bin/ld: cannot find -lpthread
EDIT: platform is ubuntu linux. and it works fine with -pthread as I wrote above - if I don't use -g at the same time
I'm not a native English speaker.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

As said on IRC: There's no such switch so you're doing something wrong. If irrKlang needs pthreads you have to link against it, and therefore use -lpthreads. If it does not find the library you have to add a link path via -L
Yarcanox
Posts: 33
Joined: Sat Apr 14, 2007 11:23 pm

Post by Yarcanox »

So why has the developer of irrKlang added exactly this switch to the example makefile? And why doesn't it work anymore when removing this switch?

It seems to me that this switch exists, but somehow it doesn't like -g :/ and I need -g to find out where I have this ugly segmentation fault :(
I'm not a native English speaker.
Yarcanox
Posts: 33
Joined: Sat Apr 14, 2007 11:23 pm

Post by Yarcanox »

I found the segmentation fault with several printf-lines and fixed it. The -g thingy is nevertheless interesting... @hybrid I'll try out your suggestion (-L), maybe it helps.
I'm not a native English speaker.
Post Reply