[pypy-issue] [issue1351] ctypes.util._findLib_gcc can't find a non-system library

Kevin Duffy tracker at bugs.pypy.org
Thu Dec 20 23:04:14 CET 2012


New submission from Kevin Duffy <duffy151+pypy at gmail.com>:

Using cffi 0.4.2 and PyPy 2.0b1 on linux,

- compile a C library
- Write a python extension for it using cffi where ffi.dlopen(<library>) is used 
(not ffi.verify())
- ship the library and python program in this filesystem configuration:

<prog-root>/lib/c-library.so
<prog-root>/bin/prog.py

- Run like:
LD_LIBRARY_PATH=<prog-root>/lib pypy <prog-root>/bin/prog.py

Results:
- the ffi.dlopen() fails to find the user library

Drilling down on this, ffi.dlopen() will eventually call ctypes.util._findLib_gcc 
(on linux anyway). This attempts to have gcc link with the library in order to 
find it. But this doesn't take into account the LD_LIBRARY_PATH so the link fails. 
If you convert the LD_LIBRARY_PATH env variable in to "-L" args to gcc, 
ffi.dlopen() works.

----------
messages: 5100
nosy: duffy151, pypy-issue
priority: bug
status: unread
title: ctypes.util._findLib_gcc can't find a non-system library

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1351>
________________________________________


More information about the pypy-issue mailing list