[Python-Dev] Shared libs on Linux (Was: test failures in test_ctypes (HEAD))

Thomas Heller theller at python.net
Wed May 3 20:53:48 CEST 2006


[Crossposting to both python-dev and ctypes-users, please respond to the list
that seems most appropriate]

Guido van Rossum wrote:
> I see test failures in current HEAD on my Google Red Hat Linux desktop
> that the buildbots don't seem to have:
> 
> ./python -E -tt ../Lib/test/regrtest.py test_ctypes
> test_ctypes
> test test_ctypes failed -- errors occurred; run in verbose mode for details
> 
> More details from running this manually:
> $ ./python ../Lib/test/test_ctypes.py
> .
> . (lots of passing tests; then:)
> .
> test_gl (ctypes.test.test_find.Test_OpenGL_libs) ... ERROR
> test_glu (ctypes.test.test_find.Test_OpenGL_libs) ... ERROR
> test_glut (ctypes.test.test_find.Test_OpenGL_libs) ... ERROR
> 
> ======================================================================
> ERROR: test_gl (ctypes.test.test_find.Test_OpenGL_libs)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/guido/projects/python/trunk/Lib/ctypes/test/test_find.py",
> line 42, in setUp
>     self.glut = CDLL(lib_glut)
>   File "/home/guido/projects/python/trunk/Lib/ctypes/__init__.py",
> line 288, in __init__
>     self._handle = _dlopen(self._name, mode)
> OSError: /usr/lib/libglut.so.3: undefined symbol: XGetExtensionVersion

I have now changed the test to ignore the case when the libglut.so library
cannot be loaded because of missing symbols.  I could not reproduce the failure
on any of the systems I have access to.  I've installed fedora 5, but the test
succeeds on this system (I assume redhat desktop is different from fedora, though).

Unfortunately I don't know enough about shared libs on linux to make the test more correct.

I would appreciate explanations or pointers to explanations how shard library loading
on linux works in detail.  The most important questions now is:

- When I load shared libs, sometimes it is required to use the RTLD_GLOBAL flag
 (RTLD_LOCAL is the default), although in most casesthis is not needed.  I think
  I do understand what RTLD_GLOBAL does, I just do not know how to determine if it
  is required or not.  The runtime loader seems to have access to this information -
  is there a way for me to find out?


Thanks,

Thomas



More information about the Python-Dev mailing list