FS#57064 - [pypy] libpypy-c.so should be kept inside /opt/pypy for cffi embedding

Attached to Project: Community Packages
Opened by Armin Rigo (arigato) - Friday, 12 January 2018, 09:24 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 29 January 2018, 12:07 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

libpypy-c.so should be kept inside /opt/pypy/bin/, instead of being moved to /usr/lib/. A symlink should be used for /usr/lib/libpypy-c.so => /opt/pypy/bin/libpypy-c.so. In other words, it should be done in the same way as /usr/bin/pypy => /opt/pypy/bin/pypy.

The reason for that is the current situation doesn't work with CFFI's embedding mode: to make programs or libraries which embed PyPy, we link them with libpypy-c.so, but if that file is really in /usr/lib/, then it won't manage to find the PyPy standard library in /opt/pypy/lib-python and /opt/pypy/lib_pypy.


Additional info:
* package version(s): 5.10.0


Steps to reproduce:


=== File embed_build.py ===
import cffi
ffibuilder = cffi.FFI()
ffibuilder.embedding_api("""
void f(void);
""")
ffibuilder.embedding_init_code("""
from _pypy_side_cffi import ffi
@ffi.def_extern()
def f():
print "hi"
""")
ffibuilder.set_source("_pypy_side_cffi", "")
ffibuilder.emit_c_code("_pypy_side_cffi.c")


=== File x.c ===
extern void f(void);
int main() { f(); }


=== Build ===
pypy embed_build.py
gcc x.c _pypy_side_cffi.c -I/opt/pypy/include -lpypy-c -pthread


=== Expected result ===
$ a.out
hi


=== We get instead ===
$ a.out
debug: pypy_setup_home: directories 'lib-python' and 'lib_pypy' not found in pypy's shared library location or in any parent directory

PyPy initialization failure when loading module '_pypy_side_cffi':
pypy_setup_home() failed
function _pypy_side_cffi.f() called, but initialization code failed. Returning 0.
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Monday, 29 January 2018, 12:07 GMT
Reason for closing:  Fixed
Additional comments about closing:  pypy 5.10.0-4
Comment by Sven-Hendrik Haase (Svenstaro) - Saturday, 13 January 2018, 18:08 GMT
Please test the new packages.
Comment by Armin Rigo (arigato) - Saturday, 13 January 2018, 19:19 GMT
Thanks! Seems to work as expected.
Comment by Sven-Hendrik Haase (Svenstaro) - Saturday, 13 January 2018, 20:22 GMT
Closing the bug. Keep up the good work. See you at EuroPython.
Comment by Eric Culp (singron) - Monday, 29 January 2018, 01:49 GMT
  • Field changed: Percent Complete (100% → 0%)
Comment by Doug Newgard (Scimmia) - Monday, 29 January 2018, 01:49 GMT
Looks like there was a gdbm rebuild in testing, but this change never got there. Got overwritten/downgraded when packages moved out of testing.

Loading...