Clang unusual switches wrongly hardcoded in resulting setup.py
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 536
- Avg merge
- 12h 12m
- Merged PRs (30d)
- 4
Description
After compiling manually (cmake and make with many switches and changes to CmakeList.txt file), Python kvetches that:
clang++: error: unknown argument: '-fno-openmp-implicit-rpath' clang++: error: unknown argument: '-fno-openmp-implicit-rpath' error: command '/data/data/com.termux/files/usr/bin/clang++' failed with exit code 1 error: subprocess-exited-with-error
amd:
clang++: error: unknown argument: '-fno-openmp-implicit-rpath'
Grep shows it hardcoded:
~/.../CTranslate2/python $ grep visibility . -r ./setup.py:cflags = ["-std=c++17", "-fvisibility=hidden"]
...
~/.../CTranslate2/python $ grep rpath . -r ./setup.py: ldflags.append("-Wl,-rpath,/usr/local/lib") ~/.../CTranslate2/python $
so we must trim it to:
./setup.py:cflags = ["-std=c++17"]
etc.
-> Do change.
With fixes:
~/.../CTranslate2/python $ pip install -v . Using pip 24.0 from /data/data/com.termux/files/usr/lib/python3.11/site-packages/pip (python 3.11)
...
clang -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fuse-ld=lld -pthread -g -march=armv8-a -mtune=cortex-a53 -Wall -Wextra -fPIC -I/data/data/com.termux/files/usr/lib/python3.11/site-packages/pybind11/include -I/data/data/com.termux/files/usr/include/python3.11 -c cpp/mpi.cc -o build/temp.linux-aarch64-cpython-311/cpp/mpi.o -std=c++17
...
etc and installs.
My box:
Compiler:
- GCC Version: ndk-sysroot/tur-packages, (26b-3).
- g++ (symbolic link to clang-18), clang version 18.1.5
Target: aarch64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin - Make version:
GNU Make 4.4.1
Built for aarch64-unknown-linux-android - Abseil C++ library: 20240116.2 for the AArch64
Python Environment:
- Python Version: 3.11.9
- pip Version: 24.0
- Cython Version: 3.0.10
- setuptools Version: 69.5.1
- PyTorch Version: 2.1.2 *
- numpy Version: 1.26.4 *
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in python/setup.py, where the issue reports hardcoded C++ flags and the /usr/local/lib rpath. Run pip install -v . in the reported environment to reproduce the generated compiler command. Done means the unsupported Clang switches are no longer added and the package installs successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100