[pypy-issue] [issue1506] PIL: distutils.unixccompiler requires static libraries on PyPy

dktc tracker at bugs.pypy.org
Sat Jun 1 01:49:04 CEST 2013


New submission from dktc <dkruglyak+pypy at gmail.com>:

I've been trying to find out why I cannot build PIL with JPEG support on PyPy while this works fine on CPython. The problem was traced to C compiler looking for static 
libraries on PyPy, while being able to properly use dynamic ones on CPython. Since most devel packages are only distributed with dynamic libs that's a serious problem.

To reproduce the problem in PIL/setup.py, replace find_library_file function with this:

def find_library_file(self, library):
    print
    print "find_library_file: %s" % library
    print self.compiler
    print self.compiler.library_dirs
    print self.compiler.include_dirs
    result = self.compiler.find_library_file(self.compiler.library_dirs, library)
    print 'RESULT = %s' % result
    print
    return self.compiler.find_library_file(self.compiler.library_dirs, library)

Here is the output on PyPy 2.0.2 -

    find_library_file: z
    <distutils.unixccompiler.UnixCCompiler instance at 0x00002b486c827980>
    ['/usr/local/lib', '/usr/lib']
    ['libImaging', '/opt/pypy-2.0.2/include', '/usr/local/include', '/usr/include', '/opt/pypy-2.0.2/include']
    RESULT = /usr/lib/libz.a

    find_library_file: jpeg
    <distutils.unixccompiler.UnixCCompiler instance at 0x00002b486c827980>
    ['/usr/local/lib', '/usr/lib']
    ['libImaging', '/opt/pypy-2.0.2/include', '/usr/local/include', '/usr/include', '/opt/pypy-2.0.2/include']
    RESULT = None

Here is the output on CPython 2.7.3 -

    find_library_file: z
    <distutils.unixccompiler.UnixCCompiler instance at 0x10c15c20>
    ['/usr/local/lib', '/opt/pinax0.9a2/lib', '/usr/lib', '/opt/python2.7.3/lib']
    ['libImaging', '/opt/pinax0.9a2/include', '/usr/local/include', '/usr/include', '/opt/python2.7.3/include/python2.7']
    RESULT = /usr/lib/libz.so

    find_library_file: jpeg
    <distutils.unixccompiler.UnixCCompiler instance at 0x10c15c20>
    ['/usr/local/lib', '/opt/pinax0.9a2/lib', '/usr/lib', '/opt/python2.7.3/lib']
    ['libImaging', '/opt/pinax0.9a2/include', '/usr/local/include', '/usr/include', '/opt/python2.7.3/include/python2.7']
    RESULT = /usr/lib/libjpeg.so

Creating fake /usr/lib/libjpeg.a with touch command fools the build, but the tests later fail, because looks like actual static linking is expected.

Is there a way to fix this?

----------
messages: 5802
nosy: pypy-issue
priority: bug
status: unread
title: PIL: distutils.unixccompiler requires static libraries on PyPy

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


More information about the pypy-issue mailing list