fijal / jitpy

Library to embed PyPy into CPython
MIT License
242 stars 17 forks source link

Jitpy on OSX raises link error #6

Closed rickvipond closed 7 years ago

rickvipond commented 7 years ago

It's looking for a .so but on OSX it's a dylib: Traceback (most recent call last): File "al_csa_numpy.py", line 28, in <module> setup('/Users/rickvipond/Sites/pypy_binaries/pypy2-v5.7.1-osx64/bin/pypy') File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/jitpy/__init__.py", line 48, in setup raise Exception("Can't find libpypy-c.so, point PYPY_HOME to " Exception: Can't find libpypy-c.so, point PYPY_HOME to directory with libpypy-c.so

Changing the code to dylib spawns a new error

/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/jitpy/__pycache__/_cffi__xb7f78f43x68124feb.c:211:14: fatal error: 
      'numpy/arrayobject.h' file not found
    #include <numpy/arrayobject.h>
             ^
1 error generated.
Traceback (most recent call last):
  File "al_csa_numpy.py", line 28, in <module>
    setup('/Users/rickvipond/Sites/pypy_binaries/pypy2-v5.7.1-osx64/bin/')
  File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/jitpy/__init__.py", line 113, in setup
    """)
  File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/api.py", line 438, in verify
    lib = self.verifier.load_library()
  File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/verifier.py", line 114, in load_library
    self._compile_module()
  File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/verifier.py", line 211, in _compile_module
    outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
  File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/ffiplatform.py", line 20, in compile
    outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
  File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/ffiplatform.py", line 56, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))
cffi.error.VerificationError: CompileError: command 'clang' failed with exit status 1

Thoughts?

rickvipond commented 7 years ago

For anyone reading this, on OSX using Homebrew python changing the .so filenames in jitpy's init.py to .dylib and setting CFLAGS gets it to work export CFLAGS="-I /usr/local/lib/python2.7/site-packages/numpy/core/include $CFLAGS"