Subject: Re: ThreadedX patch, take 2
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: FUKAUMI Naoki <naoki@fukaumi.org>
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.

hmm...

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

% 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 glxgears.man` `basename glxgears._man`

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

% ldd glxgears
glxgears:
         -lpthread.0 => /usr/lib/libpthread.so.0
         -lGL.1 => /usr/X11R6/lib/libGL.so.1
         -lX11.6 => /usr/X11R6/lib/libX11.so.6
         -lXext.6 => /usr/X11R6/lib/libXext.so.6
         -lm.0 => /usr/lib/libm387.so.0
         -lm.0 => /usr/lib/libm.so.0
         -lc.12 => /usr/lib/libc.so.12

Grr!

% ldd /usr/X11R6/lib/libGL.so.1.2
/usr/X11R6/lib/libGL.so.1.2:
         -lpthread.0 => /usr/lib/libpthread.so.0

% 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>
  :

hmm.

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.

--
FUKAUMI Naoki