homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients meador.inge, shjohnson.pi
Date 2013年07月23日.01:32:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1374543131.46.0.204980200447.issue18502@psf.upfronthosting.co.za>
In-reply-to
Content
On Linux gcc and ld are used to implement 'find_library' and 'dlopen' is used to implement 'CDLL'. ld searches /usr/local/lib. 'dlopen' might not if the LD_LIBRARY_PATH isn't set up to do so. For example:
[meadori@li589-207 cpython]$ ls /usr/local/lib
libfoo.so libfoo.so.1 libfoo.so.1.0 linode
[meadori@li589-207 cpython]$ ./python 
Python 3.4.0a0 (default:d6213012d87b, Jul 23 2013, 01:00:24) 
[GCC 4.7.2 20120921 (Red Hat 4.7.2-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> import ctypes.util
>>> ctypes.util.find_library('foo')
'libfoo.so.1'
>>> CDLL(_)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/home/meadori/src/cpython/Lib/ctypes/__init__.py", line 351, in __init__
 self._handle = _dlopen(self._name, mode)OSError: libfoo.so.1: cannot open shared object file: No such file or directory
>>> quit()
[meadori@li589-207 cpython]$ echo $LD_LIBRARY_PATH
[meadori@li589-207 cpython]$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
[meadori@li589-207 cpython]$ ./python 
Python 3.4.0a0 (default:d6213012d87b, Jul 23 2013, 01:00:24) 
[GCC 4.7.2 20120921 (Red Hat 4.7.2-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> import ctypes.util
>>> ctypes.util.find_library('foo')
'libfoo.so.1'
>>> CDLL(_)
<CDLL 'libfoo.so.1', handle 28e4b50 at 7f31e062b608>
I am OK with this behavior in ctypes since it matches the system behavior with 'gcc' and 'dlopen'. So, I would fixup LD_LIBRARY_PATH or /etc/ld.so.conf if you want /usr/local/lib to be searched at load time.
History
Date User Action Args
2013年07月23日 01:32:11meador.ingesetrecipients: + meador.inge, shjohnson.pi
2013年07月23日 01:32:11meador.ingesetmessageid: <1374543131.46.0.204980200447.issue18502@psf.upfronthosting.co.za>
2013年07月23日 01:32:11meador.ingelinkissue18502 messages
2013年07月23日 01:32:09meador.ingecreate

AltStyle によって変換されたページ (->オリジナル) /