On Mon, 5 Nov 2007, Chris Marshall via RT wrote:
Show quoted text>
> <URL:
http://rt.cpan.org/Ticket/Display.html?id=30353 >
>
> On Mon Oct 29 23:16:30 2007, twc@aaocbn.aao.gov.au wrote:
> >
> > in Graphics/Makefile.PL, guessogllibs() tries to work out which libs
> > to compile with to get -lGL.
> >
> > In my case, testfile appears to need:
> > gcc -o /tmp/testfile /tmp/testfile.c -L/usr/X11R6/lib -lGL
> -lXext -lX11 -lpthreads
> > (this is with the nvidia GL libraries in /usr/lib/libGL)
> >
> > pthread is only tested for in the mesa case, which we don't
> > have here. But furthermore, as far as I can work out,
> > pthread would never be included anyway, because in libs(),
> > ExtUtils::Liblist->ext("...-lpthread -lGL...") finds the libpthread,
> > but then works out it is already within perl, and so doesn't include
> > it in the output:
> >
> > /usr/lib/perl5/5.8.8/ExtUtils/Liblist/Kid.pm
> > 170 # Do not add it into the list if it is already linked in
> > 171 # with the main perl executable.
> > 172 # We have to special-case the NeXT, because math and ndbm
> > 173 # are both in libsys_s
> > 174 unless ($in_perl || ....
> >
> > This then means that the standalone testfile.c is not linked in with
> > pthread. Anyway, I added a libGL with pthread test, and this is what
> > I get, after ExtUtils::Liblist->ext strips out the pthread library
> > from the linker arguments --
> >
> > Trying libGL with pthread...
> > gcc -o /tmp/testfile /tmp/testfile.c -L/usr/X11R6/lib -lGL
> > -lXext -lX11 ...
> > /usr/X11R6/lib/libGL.a(glthread.o)(.text+0x1f): In function
> > `_glthread_InitTSD':: undefined reference to `pthread_key_create'
> > /usr/X11R6/lib/libGL.a(glthread.o)(.text+0x6d): In function
> > `_glthread_GetTSD':: undefined reference to `pthread_getspecific'
> > /usr/X11R6/lib/libGL.a(glthread.o)(.text+0xa5): In function
> > `_glthread_SetTSD':: undefined reference to `pthread_setspecific'
> > collect2: ld returned 1 exit status
> > NO
> >
> > So, what is being done wrong here -- is MakeMaker being used
> > incorrectly?
>
> Thanks again for another problem report. I did a quick google for
> Nvidia Linux information and apparently the Nvidia drivers are a
> replacement for the MesaGL drivers so the Mesa flag options are
> probably correct.
Well, All the GL libs have the same API -- you install Mesa if you don't
have any of other libs. At linking time, you appear to need -lGLU -lGL
(-lpthread) over the top of any other X libs, where mesa wants -lMesaGLU
-lMesaGL (-lpthread).
Show quoted text> Note that the autoprobing can be skipped by hand editing the
> perldl.conf file in the top level PDL directory and setting WITH_3D
> to true (1), and manually defining the OPENGL_LIBS, OPENGL_DEFINE,
> and OPENGL_INC as in the examples given. If you hardwire in the
> Mesa stuff (modified for your system paths as needed) does the TriD
> module build successfully?
There's an unfortunate test in /Makefile.PL:
for(keys %PDL_CONFIG) {
if(!exists($PDL_CONFIG_DIST{$_})) {
die << "EOD";
Invalid key $_ found in user supplied $pdl_conf_file
- this key appears to be no longer in use.
Please review configuration options and check the comments in
the file perldl.conf that came with this distribution
EOD
}
}
The supplied ./perldl.conf file doesn't have OPENGL_LIBS declared (perhaps
the "Let perl try to figure it out" *=undef lines should be uncommented
in the supplied ./perldl.conf file), and so
when you provide one in ~/.perldl.conf, it bails with that error message.
This makes it impossible to test via the cpan shell, as far as I can tell,
because I can't work out how to stop cpan from unpacking the .tar file
everytime. I tried modifying the .tar file it has cached, but of course,
it checks its md5sum. Anyone know how to override cpan?
When it comes time to rolling this out, I'll be wanting to do it via
cpan, but for testing, I'll show the results from a manual perl
Makefile.PL below...
Show quoted text> As for the libs function, it won't pick and choose libraries from
> the test strings given so when guessogllibs tries '-lMesaGLU -lMesaGL
> -lpthread'
> and it works, the -lpthread is not omitted.
It is though in the ExtUtils::Liblist->ext("...-lpthread -lGL...") test,
which returns a string with the -lpthread removed, which then gets passed
to gcc, which then links in the test program without libpthread, and
fails, so the test comes back negative, and Makefile.PL thinks those
supplied libraries don't work.
So the result is:
WITH_3D: Looking for xdpyinfo to check GLX
WITH_3D: Trying OpenGL initial OPENGL_LIB configuration ->-L/usr/X11R6/lib -lGL -lXext -lX11 -lpthread -lm<-
processed LIBS: -L/usr/X11R6/lib -L/usr/X11R6/lib -lGL -lXext -lX11 -lXext -lX11
Trying -L/usr/X11R6/lib -lGL -lXext -lX11 -lpthread -lm...
gcc -o /tmp/testfile /tmp/testfile.c -L/usr/X11R6/lib -L/usr/X11R6/lib -lGL -lXext -lX11 -lXext -lX11 ...
/usr/X11R6/lib/libGL.a(glthread.o)(.text+0x1f): In function `_glthread_InitTSD':: undefined reference to `pthread_key_create'
/usr/X11R6/lib/libGL.a(glthread.o)(.text+0x6d): In function `_glthread_GetTSD':: undefined reference to `pthread_getspecific'
/usr/X11R6/lib/libGL.a(glthread.o)(.text+0xa5): In function `_glthread_SetTSD':: undefined reference to `pthread_setspecific'
collect2: ld returned 1 exit status
NO
User specified OpenGL configuration did not work
trying to guess...
Darn, still trying to outsmart me. See how the -lpthread is not passed
through to gcc?
--
Tim Connors