Advertisement

Trouble making lessons under Debian Linux.

Started by June 20, 2003 10:21 PM
1 comment, last by Krylloan 21 years, 8 months ago
I''m just attempting to make Lesson2 (Your first polygon, the basic one) from the downloadable Linux lesson source. (lesson02.tar.gz) I''m kinda new to linux, so this is probably something rather basic. I would''ve thought the pthread stuff would''ve been included (the GL headers should, if they use it, so I assume it is) and lunk from the default gcc libs, or maybe somewhere in the libs list on line 5 (although these all seem to have something to do with X or GL). I have GL installed (I assume my GL driver comes from my graphics card - NVidia GF3). The lesson mentions you need mesa, aptitude says I have it. (xlibmesa-gl-dev and xlibmesa-glu-dev). I see no xlibmesa-glut-dev so I assume that none exists. I assume the exit being undefined is not a problem here. This is the make output, (and the command used to generate it).

krylloan@krylloan:~/Code/Doc/OpenGL/NeHe/Lesson2$ make lesson2
gcc -Wall -I/usr/include/   -c -o lesson2.o lesson2.c
lesson2.c: In function `keyPressed'':
lesson2.c:94: warning: implicit declaration of function `exit''
gcc -Wall -I/usr/include/ -o lesson2 -L/usr/X11R6/lib  lesson2.o -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm
/usr/X11R6/lib/libGL.a(glxext.o)(.text+0x1a): In function `__glXGetCurrentContext'':
: undefined reference to `pthread_key_create''
/usr/X11R6/lib/libGL.a(glxext.o)(.text+0x3a): In function `__glXGetCurrentContext'':
: undefined reference to `pthread_getspecific''
/usr/X11R6/lib/libGL.a(glxext.o)(.text+0x6c): In function `__glXSetCurrentContext'':
: undefined reference to `pthread_setspecific''
/usr/X11R6/lib/libGL.a(glxext.o)(.text+0x7f): In function `__glXSetCurrentContext'':
: undefined reference to `pthread_key_create''
/usr/X11R6/lib/libGL.a(glthread.o)(.text+0x1a): In function `_glthread_InitTSD'':
: undefined reference to `pthread_key_create''
/usr/X11R6/lib/libGL.a(glthread.o)(.text+0x6f): In function `_glthread_GetTSD'':
: undefined reference to `pthread_getspecific''
/usr/X11R6/lib/libGL.a(glthread.o)(.text+0xa7): In function `_glthread_SetTSD'':
: undefined reference to `pthread_setspecific''
collect2: ld returned 1 exit status
make: *** [lesson2] Error 1
rm lesson2.o
Probably irrelevant details: I use Debian / KDE. Tuxracer works fine, (so GL is fine). Any ideas what I''m doing wrong? Thanks for all help Simon Hill.
Seems you need to link using the pthread library, so you may add "-lpthread" after "-lGL". The order of the "-l" options can be important (not sure, and not sure I can give you the correct order).

For the "exit" warning, you shoud include stdlib.h
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
Advertisement
Thanks. It works now.

For the author, this code probably worked as it was, without my modifications.

Should I email the author?
Does the problem of pthread not being linked by default sound odd? or is it likely that the error was with my linux setup.

As far as the undeclared exit, I should''ve seen that keyPressed was part of the code, and not a glut command. So, in this case, it seems the author is wrong and needs to include stdlib.

This topic is closed to new replies.

Advertisement