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

Compiling Cython code #830

Open
x1mus opened this issue Apr 16, 2024 · 5 comments
Open

Compiling Cython code #830

x1mus opened this issue Apr 16, 2024 · 5 comments

Comments

@x1mus
Copy link

x1mus commented Apr 16, 2024

I am trying to compile a python mobule (C code generated with cython) but I am facing an issue while compiling.

I have extended the Dockcross image as specified in the README:

FROM dockcross/android-x86_64

ENV DEFAULT_DOCKCROSS_IMAGE dockcross/py-android-x86_64

RUN apt-get install -y python3

The compilation command is the following:

$ ./dockcross-py-android-x86_64 bash -c '$CC -g -shared -pthread -fPIC -fwrapv -Wall -fno-strict-aliasing -I/usr/include/python3.11 -o hello.so hello.c'
In file included from hello.c:6:
In file included from /usr/include/python3.11/Python.h:12:
/usr/include/python3.11/pyconfig.h:3:12: fatal error: 'x86_64-linux-gnu/python3.11/pyconfig.h' file not found
#  include <x86_64-linux-gnu/python3.11/pyconfig.h>
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

However, pyconfig.h is actually present in the docker when verifying it manually. I also tried to add python3-dev which doesn't change anything since python-dev-is-python3. Also adding libraries mentioned across other issues related to this but didn't fix the issue.

@x1mus x1mus closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2024
@x1mus x1mus changed the title Cross-compiling for android - Python lib Compiling Cython code Apr 17, 2024
@x1mus x1mus reopened this Apr 17, 2024
@thewtex
Copy link
Collaborator

thewtex commented Apr 18, 2024

Hi,

RUN apt-get install -y python3
/usr/include/python3.11/pyconfig.h

This is building against python for the host system, not the target system, which is not what you want.

To build python for the target system, see

or

For cross-compling cython, we are considering a hackathon at the SciPy conference this summer to improve support in scikit-build-core.

@x1mus
Copy link
Author

x1mus commented Apr 18, 2024

Thanks for the clarification. If I understood correctly installing python3 for the target machine can be achieved by modifying the main workflow but compiling cython (for android in my case) isn't available right now ?

@thewtex
Copy link
Collaborator

thewtex commented Apr 18, 2024

Cross-compiling Cython with dockcross is not well tested yet.

CC @jcfr @henryiii

@x1mus
Copy link
Author

x1mus commented Apr 20, 2024

Is there any way to get the experimental branch running for testing purposes by any chance ?

@thewtex
Copy link
Collaborator

thewtex commented Apr 21, 2024

scikit-build-core main could be tested. Cython support was improved recently. There are likely issues cross-compiling as discussed here: https://github.com/orgs/scikit-build/discussions/1077

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

2 participants