Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python binding no longer gets built/fails building #54

Closed
simonvanderveldt opened this issue Sep 23, 2017 · 6 comments
Closed

Python binding no longer gets built/fails building #54

simonvanderveldt opened this issue Sep 23, 2017 · 6 comments

Comments

@simonvanderveldt
Copy link
Member

simonvanderveldt commented Sep 23, 2017

I guess this is caused by the update to waf 2.0 (or maybe waf's behaviour already changed in an earlier version).

First of all bld.env.CYTHON no longer gets set, no clue why yet.
And when I change that so it forces building the python bindings waf errors with the following message

File /home/simon/src/forks/libmonome/bindings/python/monome.pyx has no mapping in ['.py', '.c', '.obj', '.o', '.pc.in'] (load a waf tool?)

There's probably a way to fix this, but I couldn't find anything useful in the waf docs.
I was hoping the cython example in waf would be useful, but that has the same error :x
https://github.com/waf-project/waf/issues/2047

@simonvanderveldt simonvanderveldt changed the title Python binding no longer gets compiled Python binding no longer gets built/fails building Sep 23, 2017
@wrl
Copy link
Member

wrl commented Sep 23, 2017

you need to build your own waf executable with the tool included. clone the waf repo and do
./waf-light --tools=cython

@simonvanderveldt
Copy link
Member Author

you need to build your own waf executable with the tool included. clone the waf repo and do
./waf-light --tools=cython

@wrl I manged to get it to work by including the waf cython tool which is part of the extra modules https://github.com/waf-project/waf/blob/master/waflib/extras/cython.py.

Which way would you prefer to fix this? Build the waf executable which includes the cython waf tool or include the above mentioned file in the repo?

@wrl
Copy link
Member

wrl commented Sep 23, 2017

would much prefer building the waf executable.

@simonvanderveldt
Copy link
Member Author

would much prefer building the waf executable.

OK, I'll create a PR

@coreyker
Copy link

coreyker commented Aug 4, 2019

Just tried to build this with

./waf configure --enable-python --python=/usr/local/bin/python2.7
./waf build
./waf install

but the python bindings aren't showing up in /usr/local/lib/python2.7/site-packages, and import monome fails. Not sure if I'm doing something wrong as I thought this issue was resolved...

@coreyker
Copy link

coreyker commented Aug 4, 2019

I was able to build it manually by making a setup.py file with the contents:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

ext_modules = [
    Extension("monome",
              sources=["monome.pyx"],
              libraries=["monome"]  # Unix-like specific
              )
]

setup(name="Demos",
      ext_modules=cythonize(ext_modules))

and invoking python setup.py build_ext --inplace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants