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

Compilation Error for pi-heif Package Due to Deprecated Optimization Flag #304

Closed
Manamama opened this issue Oct 31, 2024 · 3 comments · Fixed by #305
Closed

Compilation Error for pi-heif Package Due to Deprecated Optimization Flag #304

Manamama opened this issue Oct 31, 2024 · 3 comments · Fixed by #305
Labels
bug Something isn't working

Comments

@Manamama
Copy link

Manamama commented Oct 31, 2024

Describe the bug

Issue Description

I encountered an error while trying to build the pi-heif package on Termux due to the use of a deprecated optimization flag in the compilation command. Works fine on Prooted Debian there. The specific error message is as follows:

clang: error: argument '-Ofast' is deprecated; use '-O3 -ffast-math' for the same behavior, or '-O3' to enable only conforming optimizations [-Werror,-Wdeprecated-ofast]
error: command '/data/data/com.termux/files/usr/bin/clang' failed with exit code 1

Current Environment Variables

PATH: /data/data/com.termux/files/home/.opam/default/bin:/data/data/com.termux/files/usr/google-cloud-sdk/bin:/data/data/com.termux/files/usr/bin:/system/bin/:/data/data/com.termux/files/usr/bin:/system/bin/:/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/home/.local/bin:/data/data/com.termux/files/home/.local/bin
LD_PRELOAD:
LD_LIBRARY_PATH: /data/data/com.termux/files/home/.local/lib:
CC: clang
CXX: clang++
C_INCLUDE_PATH: :/data/data/com.termux/files/usr/include/flang/Evaluate/:/data/data/com.termux/files/usr/include/:/data/data/com.termux/files/usr/include/flang/Evaluate/:/data/data/com.termux/files/usr/include/:/data/data/com.termux/files/usr/opt/libllvm-16/include/llvm/Frontend/OpenMP
FC: gfortran
CFLAGS:
CXXFLAGS:
LDFLAGS: -lm -lpython3.12 -llog
CPPFLAGS:
ANDROID_NDK: /storage/7B27-F244/Installs/Android_ndk_sdk/android-ndk-r26b

Proposed Solution
To resolve this issue, I suggest updating the build configuration to replace the -Ofast optimization flag with either -O3 -ffast-math or just -O3. This change would prevent the deprecation warning from causing the build process to fail.
For now I will try to much in the code for that.

Steps/Code to Reproduce

Steps to Reproduce

  1. Attempt to install the pi-heif package using pip:
    pip install pi-heif
    
    

Expected Results

.

Actual Results

Using pip 24.3.1 from /data/data/com.termux/files/usr/lib/python3.12/site-packages/pip (python 3.12)
Looking in indexes: https://pypi.org/simple, https://termux-user-repository.github.io/pypi/, https://termux-user-repository.github.io/pypi/
Collecting setuptools>=67.8
Obtaining dependency information for setuptools>=67.8 from https://files.pythonhosted.org/packages/90/12/282ee9bce8b58130cb762fbc9beabd531549952cac11fc56add11dcb7ea0/setuptools-75.3.0-py3-none-any.whl.metadata
Using cached setuptools-75.3.0-py3-none-any.whl.metadata (6.9 kB)
...
Looking for libheif using pkg-config.
Checking for include file 'heif.h' in '/data/data/com.termux/files/usr/include'
Checking for include file 'heif.h' in '/data/data/com.termux/files/usr/include/libheif'
Found 'heif.h' in '/data/data/com.termux/files/usr/include/libheif'
building '_pi_heif' extension
creating build/temp.linux-aarch64-cpython-312/pi_heif
clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC -I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/usr/include/flang/Evaluate -I/data/data/com.termux/files/usr/include/python3.12 -c pi_heif/_pi_heif.c -o build/temp.linux-aarch64-cpython-312/pi_heif/_pi_heif.o -Ofast -Werror
clang: error: argument '-Ofast' is deprecated; use '-O3 -ffast-math' for the same behavior, or '-O3' to enable only conforming optimizations [-Werror,-Wdeprecated-ofast]
error: command '/data/data/com.termux/files/usr/bin/clang' failed with exit code 1
error: subprocess-exited-with-error

× Building wheel for pi-heif (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.

Quick fix

sed -i 's/-Ofast/-O3/g' setup.py

@bigcat88
Copy link
Owner

bigcat88 commented Nov 2, 2024

Thanks for reporting this, it should be fixed in the linked PR.

@eelalzep
Copy link

So it should work now or do I have to wait for another update?

@bigcat88
Copy link
Owner

You need to wait for the new version, the expected release of the new version is November 23/24.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants