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


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

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

More information about the pypy-issue mailing list