-
Notifications
You must be signed in to change notification settings - Fork 116
Fix import error on aarch64: define 'long' using ctypes.c_long #146
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
base: master
Are you sure you want to change the base?
Fix import error on aarch64: define 'long' using ctypes.c_long #146
Conversation
### Fix issue with PyOpenGL-accelerate on MacOS x86_64 ### Linked issues n/a ### Summarize your change. This PR adds a temporary changes to build PyOpenGL-accelerate from source on MacOS x86_64. The source is patched with the changes from a pending [PR](mcfletch/pyopengl#146) in the PyOpenGL repository. ### Describe the reason for the change. Cython was updated to version 3.1.0+ on May 8, causing compatibility issues with PyOpenGL-accelerate on macOS x86_64. Until a pending [PR](mcfletch/pyopengl#146) is merged in the official PyOpenGL repository, PyOpenGL-accelerate will be built from source on macOS x86_64. ### Describe what you have tested and on which operating system. ### Add a list of changes, and note any that might need special attention during the review. ### If possible, provide screenshots. Signed-off-by: Cédrik Fuoco <[email protected]>
…undation#777) ### Fix issue with PyOpenGL-accelerate on MacOS x86_64 ### Linked issues n/a ### Summarize your change. This PR adds a temporary changes to build PyOpenGL-accelerate from source on MacOS x86_64. The source is patched with the changes from a pending [PR](mcfletch/pyopengl#146) in the PyOpenGL repository. ### Describe the reason for the change. Cython was updated to version 3.1.0+ on May 8, causing compatibility issues with PyOpenGL-accelerate on macOS x86_64. Until a pending [PR](mcfletch/pyopengl#146) is merged in the official PyOpenGL repository, PyOpenGL-accelerate will be built from source on macOS x86_64. ### Describe what you have tested and on which operating system. ### Add a list of changes, and note any that might need special attention during the review. ### If possible, provide screenshots. Signed-off-by: Cédrik Fuoco <[email protected]> Signed-off-by: [email protected] <[email protected]>
…undation#777) ### Fix issue with PyOpenGL-accelerate on MacOS x86_64 ### Linked issues n/a ### Summarize your change. This PR adds a temporary changes to build PyOpenGL-accelerate from source on MacOS x86_64. The source is patched with the changes from a pending [PR](mcfletch/pyopengl#146) in the PyOpenGL repository. ### Describe the reason for the change. Cython was updated to version 3.1.0+ on May 8, causing compatibility issues with PyOpenGL-accelerate on macOS x86_64. Until a pending [PR](mcfletch/pyopengl#146) is merged in the official PyOpenGL repository, PyOpenGL-accelerate will be built from source on macOS x86_64. ### Describe what you have tested and on which operating system. ### Add a list of changes, and note any that might need special attention during the review. ### If possible, provide screenshots. Signed-off-by: Cédrik Fuoco <[email protected]> Signed-off-by: [email protected] <[email protected]>
I think this is only an issue with Cython 3 -- but we should be using Cython 3 by now! Does this seem to work with Cython3 across the board? NOTE: I'm working on a conda-forge recipe -- so I may apply this as a patch to build .... (though pinning to Cython<3 may be the more expedient route...) |
Got it all working on conda-forge -- but I had to add this patch -- so it would be nice to get this merged. I do wonder how the wheels got built ???? |
Yes, this fix should work across the board with Cython 3. Using |
Indeed -- and it is working for me -- with this patch and Cython 3 -- and with Cython <3, I got segfaults. I think -- numpy 2 changed a bit how it handles the C long types, which might explain the segfaults. I've had other issues with that). I curse C for defining "short" and "long" way back when, rather than the modern int32 and int64, etc ... oh well. Anyway, no need to understand all the details -- what I think we need isthis patch and also to pin Cython to >3 Maybe add that pin to this PR? Also: I see in the MANIFEST.in file that the generated c files are still being included in the source distro -- that probably should change. |
As you requested, I've added the version pin to require |
Thanks! now we just need a merge ... |
I've been looking forward to this for a month. 😄 |
@mcfletch: This is actually pretty bad -- pip install of accelerate on OS-X Intel fails for this reason. There is no wheel for OS-X Intel -- so ti tries to build from source. Also -- I'm curious how the wheels that are there were successfully built, and if they actually work (I could build with Cython < 3, but got segfaults when trying to run the tests). BTW -- I'm sure there's a couple of us that would be glad to help with maintenance of you don't have the time. |
NOTE: I've got a build for conda-forge working: https://anaconda.org/conda-forge/pyopengl-accelerate But I needed to apply this patch to get it to build -- see: https://github.com/conda-forge/pyopengl-accelerate-feedstock |
Summary
On Linux ARM64 (aarch64) platforms, installing PyOpenGL_accelerate fails with the following error:
This happens because the built-in long type is not defined in Python 3 on ARM64 platforms, unlike some legacy Python 2 or x86-based assumptions. This breaks Cython compilation when trying to cast buffer identifiers.
This patch imports
long
fromctypes.c_long
, which resolves the issue on these platforms.Changes
from ctypes import c_long as long
to handle missinglong
type on aarch64.Platform tested