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

cannot build pyopengl-accelerate with clang 15 #107

Open
davidjmeyer opened this issue Nov 17, 2023 · 10 comments
Open

cannot build pyopengl-accelerate with clang 15 #107

davidjmeyer opened this issue Nov 17, 2023 · 10 comments

Comments

@davidjmeyer
Copy link

Clang 15 has upgraded -Wint-conversion from a warning to a default error, and this means we cannot build pyopengl-accelerate

I get the following error:

 src/numpy_formathandler.c:9802:3: error: incompatible pointer to integer conversion returning 'void *' from a function with result type 'int' [-Wint-conversion]

See release notes: https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html

The -Wint-conversion warning diagnostic for implicit int <-> pointer conversions now defaults to an error in all C language modes. It may be downgraded to a warning with -Wno-error=int-conversion, or disabled entirely with -Wno-int-conversion.

@0xorial
Copy link

0xorial commented May 3, 2024

Seems pretty major. Can anyone merge the PR, or find a workaround?

@adamsmatthew
Copy link

adamsmatthew commented Sep 17, 2024

I was able to work around this by using the downgrade mentioned in the top comment via CFLAGS. Specifically, I ran

export CFLAGS="-Wno-error=int-conversion"

before running

python3 -m pip install -r requirements.txt

Since I was also running into #118, my requirements.txt contained the following:

PyOpenGL @ git+https://github.com/mcfletch/[email protected]#egg=PyOpenGL
PyOpenGL_accelerate @ git+https://github.com/mcfletch/[email protected]#egg=PyOpenGL_accelerate&subdirectory=accelerate

(copied from a comment on that issue).

I also tried to get -Wno-error=int-conversion to work through requirements.txt via --config-settings - i.e., without using CFLAGS, but I was unsuccessful.

@ROCKLOTUS
Copy link

I was able to work around this by using the downgrade mentioned in the top comment via CFLAGS. Specifically, I ran

export CFLAGS="-Wno-error=int-conversion"

before running

python3 -m pip install -r requirements.txt

Since I was also running into #118, my requirements.txt contained the following:

PyOpenGL @ git+https://github.com/mcfletch/[email protected]#egg=PyOpenGL
PyOpenGL_accelerate @ git+https://github.com/mcfletch/[email protected]#egg=PyOpenGL_accelerate&subdirectory=accelerate

(copied from a comment on that issue).

I also tried to get -Wno-error=int-conversion to work through requirements.txt via --config-settings - i.e., without using CFLAGS, but I was unsuccessful.

Successfully installed, Thanks

@jimmyken
Copy link

I was able to work around this by using the downgrade mentioned in the top comment via CFLAGS. Specifically, I ran

export CFLAGS="-Wno-error=int-conversion"

before running

python3 -m pip install -r requirements.txt

Since I was also running into #118, my requirements.txt contained the following:

PyOpenGL @ git+https://github.com/mcfletch/[email protected]#egg=PyOpenGL
PyOpenGL_accelerate @ git+https://github.com/mcfletch/[email protected]#egg=PyOpenGL_accelerate&subdirectory=accelerate

(copied from a comment on that issue).
I also tried to get -Wno-error=int-conversion to work through requirements.txt via --config-settings - i.e., without using CFLAGS, but I was unsuccessful.

Successfully installed, Thanks

Yes! It is work!

@BradenM
Copy link

BradenM commented Dec 25, 2024

After setting CFLAGS="-Wno-error=int-conversion", I started running into:

  src/numpy_formathandler.c:6950:43: error: passing argument 1 of ‘(int (*)(PyArrayObject *, PyObject *))*(PyArray_API + 832)’ from incompatible pointer type [-Wincompatible-pointer-types]

Disabling incompatible-pointer-types finally let it install though:

export CFLAGS="-Wno-error=int-conversion -Wno-error=incompatible-pointer-types"

python - 3.12.7
numpy - 2.2.1
Cython - 3.0.11
clang - 18.1.8

@mcfletch
Copy link
Owner

mcfletch commented Jan 3, 2025

Can someone with this setup test that the 3.1.9a2 release fixes the problem. I believe the warnings have now been addressed, as well as those from the Numpy deprecated-api usage in cython.

@TheJester12121
Copy link

To me, this in requirements.txt

PyOpenGL @ git+https://github.com/mcfletch/pyopengl.git@1a0928094ca40f95447df31d2cac5ec262552df4#egg=PyOpenGL PyOpenGL_accelerate @ git+https://github.com/mcfletch/pyopengl.git@1a0928094ca40f95447df31d2cac5ec262552df4#egg=PyOpenGL_accelerate&subdirectory=accelerate

worked... without the mentioned CFLAGS settings.

@mcfletch
Copy link
Owner

mcfletch commented Jan 8, 2025

Sorry, folks, is there anyone who can test this on a clang-based system? i.e. if you do:

pip install --pre PyOpenGL PyOpenGL_accelerate

does your build succeed? The warnings described should be fixed in the a2 release, but I don't have a clang system on which to test it.

@BradenM
Copy link

BradenM commented Jan 8, 2025

@mcfletch Appears to be working for me of at (at least) 1a09280

After a pip uninstall PyOpenGL PyOpenGL_accelerate,

pip install --no-cache-dir --verbose --pre PyOpenGL PyOpenGL_accelerate succeeded fine but appeared to just fetch and install wheels w/o building anything.

To validate for sure, uninstalled again and installed from source at 1a09280, which also worked smoothly with no CFLAGS manipulation:

# PyOpenGL@1a0928
pip install 'PyOpenGL @ git+https://github.com/mcfletch/pyopengl.git@1a0928094ca40f95447df31d2cac5ec262552df4#egg=PyOpenGL' --no-cache-dir --verbose 2>&1 | tee /tmp/pyopengl_install.log

# PyOpenGL_accelerate@1a0928
pip install 'PyOpenGL_accelerate @ git+https://github.com/mcfletch/pyopengl.git@1a0928094ca40f95447df31d2cac5ec262552df4#egg=PyOpenGL_accelerate&subdirectory=accelerate' --no-cache-dir --verbose 2>&1 | tee /tmp/pyopengl_accelerate_install.log

Install Logs for PyOpenGL:
pyopengl_install.log

Install Logs for PyOpenGL_accelerate:
pyopengl_accelerate_install.log

My environment was the same as previously mentioned above:

python - 3.12.7
numpy - 2.2.1
Cython - 3.0.11
clang - 18.1.8

@adamsmatthew
Copy link

@mcfletch, looks fixed to me - thanks!

Using the same system I was on when I commented before, this builds without error:

pip install --pre PyOpenGL PyOpenGL_accelerate

and this still has the same error as before (sanity check):

pip install PyOpenGL PyOpenGL_accelerate

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

8 participants