Compilation fails on Pypy, not on CPython

Anonymous avatarAnonymous 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 "app_main.py", line 52, in run_toplevel
  File "setup.py", line 62, in <module>
    "Development Status :: 4 - Beta"]
  File "/usr/local/pypy/lib-python/2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/local/pypy/lib-python/2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/pypy/lib-python/2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/pypy/lib-python/2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/usr/local/pypy/lib-python/2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/pypy/lib-python/2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/pypy/lib-python/2.7/distutils/command/build_ext.py", line 344, in run
    self.build_extensions()
  File "/home/alvaro/Development/evy/setup_libuv.py", line 107, in build_extensions
    import evy.uv.interface
  File "/home/alvaro/Development/evy/evy/uv/__init__.py", line 34, in <module>
    from interface import libuv, ffi, get_version
  File "/home/alvaro/Development/evy/evy/uv/interface.py", line 637, in <module>
    extra_link_args = extra_link_args)
  File "/usr/local/pypy/site-packages/cffi/api.py", line 286, in verify
    lib = self.verifier.load_library()
  File "/usr/local/pypy/site-packages/cffi/verifier.py", line 61, in load_library
    self.compile_module()
  File "/usr/local/pypy/site-packages/cffi/verifier.py", line 49, in compile_module
    self._compile_module()
  File "/usr/local/pypy/site-packages/cffi/verifier.py", line 130, in _compile_module
    outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
  File "/usr/local/pypy/site-packages/cffi/ffiplatform.py", line 25, in compile
    outputfilename = _build(tmpdir, ext)
  File "/usr/local/pypy/site-packages/cffi/ffiplatform.py", 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__/_cffi__x2f8b11b9xee66c35f.so -lrt

Any ideas?

Cheers

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 interface.py

    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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.