Compilation fails on Pypy, not on CPython

Issue #41 on hold
Anonymous created an issue

Hi there,

I'm seeing a difference between Pypy (2.0beta1) and CFFI (0.4) when compiling on Linux. With Pypy, I get this error:

creating /home/alvaro/Development/evy/evy/uv/__pycache__/evy
creating /home/alvaro/Development/evy/evy/uv/__pycache__/evy/uv
creating /home/alvaro/Development/evy/evy/uv/__pycache__/evy/uv/__pycache__
cc -fPIC -Wimplicit -fPIC -Wimplicit  -I/home/alvaro/Development/evy/evy/uv/../../libuv/include -I/usr/local/pypy/include -c evy/uv/__pycache__/_cffi__g2f8b11b9xee66c35f.c -o /home/alvaro/Development/evy/evy/uv/__pycache__/evy/uv/__pycache__/_cffi__g2f8b11b9xee66c35f.o
cc: error: : No such file or directory
Traceback (most recent call last):
  File "", line 52, in run_toplevel
  File "", line 62, in <module>
    "Development Status :: 4 - Beta"]
  File "/usr/local/pypy/lib-python/2.7/distutils/", line 152, in setup
  File "/usr/local/pypy/lib-python/2.7/distutils/", line 953, in run_commands
  File "/usr/local/pypy/lib-python/2.7/distutils/", line 972, in run_command
  File "/usr/local/pypy/lib-python/2.7/distutils/command/", line 127, in run
  File "/usr/local/pypy/lib-python/2.7/distutils/", line 326, in run_command
  File "/usr/local/pypy/lib-python/2.7/distutils/", line 972, in run_command
  File "/usr/local/pypy/lib-python/2.7/distutils/command/", line 344, in run
  File "/home/alvaro/Development/evy/", line 107, in build_extensions
    import evy.uv.interface
  File "/home/alvaro/Development/evy/evy/uv/", line 34, in <module>
    from interface import libuv, ffi, get_version
  File "/home/alvaro/Development/evy/evy/uv/", line 637, in <module>
    extra_link_args = extra_link_args)
  File "/usr/local/pypy/site-packages/cffi/", line 286, in verify
    lib = self.verifier.load_library()
  File "/usr/local/pypy/site-packages/cffi/", line 61, in load_library
  File "/usr/local/pypy/site-packages/cffi/", line 49, in compile_module
  File "/usr/local/pypy/site-packages/cffi/", line 130, in _compile_module
    outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
  File "/usr/local/pypy/site-packages/cffi/", line 25, in compile
    outputfilename = _build(tmpdir, ext)
  File "/usr/local/pypy/site-packages/cffi/", line 50, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))
VerificationError: CompileError: command 'cc' failed with exit status 1

but with CPython everything works fine:

creating /home/alvaro/Development/evy/evy/uv/__pycache__/home
creating /home/alvaro/Development/evy/evy/uv/__pycache__/home/alvaro
creating /home/alvaro/Development/evy/evy/uv/__pycache__/home/alvaro/Development
creating /home/alvaro/Development/evy/evy/uv/__pycache__/home/alvaro/Development/evy
creating /home/alvaro/Development/evy/evy/uv/__pycache__/home/alvaro/Development/evy/evy
creating /home/alvaro/Development/evy/evy/uv/__pycache__/home/alvaro/Development/evy/evy/uv
creating /home/alvaro/Development/evy/evy/uv/__pycache__/home/alvaro/Development/evy/evy/uv/__pycache__
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/alvaro/Development/evy/evy/uv/../../libuv/include -I/usr/include/python2.7 -c /home/alvaro/Development/evy/evy/uv/__pycache__/_cffi__x2f8b11b9xee66c35f.c -o /home/alvaro/Development/evy/evy/uv/__pycache__/home/alvaro/Development/evy/evy/uv/__pycache__/_cffi__x2f8b11b9xee66c35f.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro /home/alvaro/Development/evy/evy/uv/__pycache__/home/alvaro/Development/evy/evy/uv/__pycache__/_cffi__x2f8b11b9xee66c35f.o -L/home/alvaro/Development/evy/evy/uv/../../libuv -luv -o /home/alvaro/Development/evy/evy/uv/__pycache__/ -lrt

Any ideas?


Comments (7)

  1. Armin Rigo

    Cannot do anything without seeing how you're calling this: ffi.verify() and the previous ffi.cdef(). Moreover it seems that you're not comparing the same versions of CFFI: the CPython version seems to be a bit older.

  2. Alvaro Saurin

    I have upgraded the cffi version, so I'm using CFFI 0.4 in both. The problem is that, when using CPython, it uses gcc and uses the right command line options, but if I use Pypy, it goes for 'cc' and fails with a cryptic "cc: error: : No such file or directory", but if I run the same line it was trying to run, is succeeds:

    cc -fPIC -Wimplicit -fPIC -Wimplicit -I/home/alvaro/Development/evy/evy/uv/../../libuv/include -I/usr/local/pypy/include -c evy/uv/pycache/_cffig2f8b11b9xee66c35f.c -o /home/alvaro/Development/evy/evy/uv/pycache/evy/uv/pycache/_cffig2f8b11b9xee66c35f.o

    Could it have anything to do with the distutils version or anything? I'm using 'distribute' 0.6.30 in both...

    Thanks in advance

  3. Armin Rigo

    Please provide as many details as you can so that I can reproduce the bug. If it's a closed-source one, please try to reduce it to a small example. I cannot do anything but guess without an example that I can inspect.

  4. Armin Rigo

    Do you also get the error without trying to use "distribute"? For me, this command line "works" identically on both CPython and PyPy:

    LD_LIBRARY_PATH=~/git/evy/libuv python

    I say "works" because it actually hits a different crash, caused by incorrect usage of "typedef ... uv_handle_type;". It works on CPython anyway as long as we never try to actually call the uv_guess_handle() function, whereas on PyPy it errors out earlier. (This has been fixed, as in: now on both CPython and PyPy the error is reported earlier and more clearly.)

    This is all unrelated to the bug you're reporting, which I cannot reproduce. Please tell me if you also see it when running the above line on PyPy.

  5. Armin Rigo

    Sorry if I seem to insist, but I need to reproduce the bug first. Please give me a step-by-step instruction, like: installing libuv, then grabbing the git image of evy, then typing this command line "xxx".

  6. Log in to comment