Subject: Re: ThreadedX patch, take 2
To: Jason R Thorpe <>
From: FUKAUMI Naoki <>
List: tech-userlevel
Date: 01/27/2003 10:45:09
At Sun, 26 Jan 2003 17:05:47 -0800,
Jason R Thorpe wrote:
>  > I have another question.
>  > 
>  > Do OpenGL (libGL) applications always link (require) libpthread like
>  > glxgears/glxinfo?
> I don't believe they should, no.  That's what the "threadlib" stuff
> is for.


I removed `#include <Threads.tmpl>' line from glxgears/Imakefile, then

% xmkmf -a
imake -DUseInstalled -I/usr/X11R6/lib/X11/config
make Makefiles
make includes
make depend
rm -f .depend
gccmakedep -f-  --   -I/usr/X11R6/include    -DCSRG_BASED  -DFUNCPROTO=15 -DNARROWPROTO     -DUSE_MAKEDEPEND -- glxgears.c > .depend
% make
gcc -O2      -I/usr/X11R6/include    -DCSRG_BASED  -DFUNCPROTO=15 -DNARROWPROTO     -c glxgears.c
rm -f glxgears
gcc -o glxgears -O2      -L/usr/X11R6/lib glxgears.o -lGL -lXext -lX11   -lm   -Wl,-rpath,/usr/X11R6/lib
rm -f glxgears._man
cd `dirname glxgears` &&  ln -s `basename` `basename glxgears._man`

OK. -lpthread is not defined. but...

% ldd glxgears
         -lpthread.0 => /usr/lib/
         -lGL.1 => /usr/X11R6/lib/
         -lX11.6 => /usr/X11R6/lib/
         -lXext.6 => /usr/X11R6/lib/
         -lm.0 => /usr/lib/
         -lm.0 => /usr/lib/
         -lc.12 => /usr/lib/


% ldd /usr/X11R6/lib/
         -lpthread.0 => /usr/lib/

% grep -r xthread_ xfree/xc/lib/GL
GL/glx/glxext.c:static xthread_key_t ContextTSD;
GL/glx/glxext.c:      xthread_key_create(&ContextTSD, NULL);
GL/glx/glxext.c:      xthread_get_specific(ContextTSD, &p);
GL/glx/glxext.c:      xthread_key_create(&ContextTSD, NULL);
GL/glx/glxext.c:   xthread_set_specific(ContextTSD, c);

% head xfree/xc/lib/GL/Imakefile
XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.37 2001/03/23 20:56:28 dawes Exp $

#include <Threads.tmpl>


I don't know that Threads.tmpl is needed or not needed in GL/Imakefile.
But I think -lpthread is not needed for libGL...

This was introduced my change

> I enabled `# define ThreadsLibraries	-lpthread' line again, ...

This change was for programs/ico compile problem.

libGL, glxgears, glxinfo didn't require -lpthread with your first patch.