[pypy-dev] 2.6.1 and freebsd-9

David Naylor naylor.b.david at gmail.com
Tue Aug 25 20:26:07 CEST 2015


On Monday, 24 August 2015 23:07:20 David Naylor wrote:
> On Saturday, 22 August 2015 21:25:44 Matti Picus wrote:
> > I would like to add the freebsd-9-x86-64 binary tgz to our released
> > downloads. We still have a number of failing tests showing up on
> > http://buildbot.pypy.org/summary?category=freebsd64
> > among them many
> > DLOpenError: "opening 'libm.so' with ctypes.CDLL() works, but not with
> > c_dlopen()??"
> > and the more worrying SIGSEGV in
> > http://buildbot.pypy.org/summary/longrepr?testname=unmodified&builder=pypy
> > -c -jit-freebsd-9-x86-64&build=655&mod=lib-python.2.7.test.test_io
> > 
> > Could someone proficient in freebsd suggest what is going on?
> 
> Hi Matti,
> 
> I am able to reproduce this on FreeBSD 10.2:
> # cat > test.py << __EOF
> from ctypes import *
> 
> libc = CDLL("libc.so.7")
> dlopen = libc["dlopen"]
> 
> # see <dlfnc.h>: void    *dlopen(const char *, int);
> dlopen.argtypes = [c_char_p, c_int]
> dlopen.restype = c_void_p
> 
> print dlopen(c_char_p("libm.so"), c_int(0))
> __EOF
> # python test.py
> None

I have found the root cause of this problem (from the FreeBSD-Python team):
"""
Because dlopen symbol is magic.  It is provided by the shared libc.so
to satisfy the static linker, but real definition comes from the dynamic
linker.  The libc.so dlopen() is a null stub.

You are asking for the dlopen symbol from libc, which is returned to
you in faith, and which cannot load a library for real. While in the C
example, you use normal symbol resolution and get the dlopen from the
loader.

To get a handle to real dlopen with dlopen/dlsym, you should do in C:
        dlopenX = dlsym(RTLD_DEFAULT, "dlopen");
""" - Konstantin Belousov

Please find attached for a patch that fixes this issue.  Would you like me to 
submit a bug report for this patch?  

I have not translation tested this patch as yet.  

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-rpython_rtyper_lltypesystem_ll2ctypes.py
Type: text/x-python
Size: 2361 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20150825/7c91b631/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20150825/7c91b631/attachment.sig>


More information about the pypy-dev mailing list