Fix: expand ~ in CCACHE_CONFIGPATH to actual home directory#741
Fix: expand ~ in CCACHE_CONFIGPATH to actual home directory#741b95702041 wants to merge 26 commits intoCytnx-dev:release_to_pypifrom
Conversation
b95702041
commented
Jan 31, 2026
- Use os.path.expanduser() to properly expand ~ in ccache config path
- Fixes FileNotFoundError on macOS builds in cibuildwheel
- Resolves CI failure in PR Release to PyPI #711
- Use os.path.expanduser() to properly expand ~ in ccache config path - Fixes FileNotFoundError on macOS builds in cibuildwheel - Resolves CI failure in PR Cytnx-dev#711
|
New error, failed on Building wheel steps but passed the Running before_build step. https://github.com/b95702041/Cytnx/actions/runs/21540314619 working on fix it now. |
- Create symlink from /usr/include/openblas/cblas.h to /usr/include/cblas.h - Fixes compilation error: 'cblas.h: No such file or directory' - Similar to existing lapacke.h, lapack.h symlinks
- cblas.h requires openblas_config.h - Create symlink from /usr/include/openblas/openblas_config.h
- Add CPATH to environment to include /usr/include/openblas - Create symlinks for all OpenBLAS headers - Fixes openblas_config-x86_64.h not found error
- Install gcc-c++, glibc-devel, kernel-headers - Fixes math.h not found error with gcc-toolset-14
- Add CFLAGS and CXXFLAGS with -I/usr/include for Linux builds - Helps gcc-toolset-14 find standard headers like math.h - macOS configuration unchanged
- Install gcc-c++, glibc-devel, kernel-headers - Add cblas.h and openblas_config.h symlinks - Use ln -sf to force overwrite - Add verification steps
|
Fix Linux wheel builds for PyPI release It is successfully built now. |
IvanaGyro
left a comment
There was a problem hiding this comment.
Great work! I have some questions.
| @@ -1,5 +1,5 @@ | |||
| [build-system] | |||
| requires = ["scikit-build-core >=0.11", "pybind11 >=3.0"] | |||
| requires = ["scikit-build-core >=0.11", "pybind11 >=3.0", "setuptools"] | |||
There was a problem hiding this comment.
Why setuptools is needed?
There was a problem hiding this comment.
distutils was deprecated in Python 3.10 and removed in Python 3.12.
Since the build uses Python 3.12, build 8 failed with:
ModuleNotFoundError: No module named 'distutils'
Adding setuptools resolves this because it provides a distutils compatibility layer.
Reference: https://github.com/b95702041/Cytnx/actions/runs/21543068253
There was a problem hiding this comment.
Can you try to figure out which package provide the outdated FindPythonLibsNew.cmake? pybind11 has fixed the issue about distutils few years ago: pybind/pybind11#3677
There was a problem hiding this comment.
The file ./cmake/Modules/FindPythonLibsNew.cmake was copied from pybind11 on January 6, 2020 and has never been updated since.
There was a problem hiding this comment.
I checked the git history:
gitlog --follow ./cmake/Modules/FindPythonLibsNew.cmake
commit 4af776705ff03bf6ef32a2de32b6ef58e053a214 Author: kaihsin [kaihsinwu@gmail.com](mailto:kaihsinwu@gmail.com) Date: Mon Jan 6 01:22:33 2020 -0500 update, merge complete, clean container base
This file was manually added by kaihsin in 2020, not installed from the pybind11 package.
There was a problem hiding this comment.
I think its fine to remove it because we have bound with pybind11 now.
There was a problem hiding this comment.
Removed the outdated FindPythonLibsNew.cmake. CI now uses pybind11 3.0.2's version and passes.
|
There is a thing that I have not finished. cibuildwheel builds wheels in containers on Linux, which will make ccache fails to cache across the builds with different python version. We have to mount the system directory used by ccache in the docker containers. |
pcchen
left a comment
There was a problem hiding this comment.
PR #741 Review — Fix: expand ~ in CCACHE_CONFIGPATH
Posted by Claude Code on behalf of @pcchen
Critical Issues (1)
1. expanduser called before null check — TypeError if env var is unset
tools/cibuildwheel_before_build.py
ccache_config_path = os.getenv('CCACHE_CONFIGPATH')
# Expand ~ to actual home directory
ccache_config_path = os.path.expanduser(ccache_config_path) # ← called with None if var unset
if not ccache_config_path:
raise RuntimeError('The CCACHE_CONFIGPATH environment variable must be set.')os.getenv() returns None if the variable is not set. os.path.expanduser(None) raises TypeError in Python 3, masking the real error message. The null check must come first:
ccache_config_path = os.getenv('CCACHE_CONFIGPATH')
if not ccache_config_path:
raise RuntimeError('The CCACHE_CONFIGPATH environment variable must be set.')
ccache_config_path = os.path.expanduser(ccache_config_path)Important Issues (3)
2. libomp-devel dropped from dnf/yum install
tools/cibuildwheel_before_all.sh
The old script installed libomp-devel (OpenMP). The new dnf and yum branches omit it. If the C++ build uses OpenMP (-fopenmp), this will cause silent link failures. Only the apk branch doesn't need it because Alpine ships OpenMP with GCC. Add libomp-devel back to the dnf/yum branches.
3. .bak file committed to git
cmake/Modules/FindPythonLibsNew.cmake.bak
Renaming FindPythonLibsNew.cmake → FindPythonLibsNew.cmake.bak commits a backup artifact to the repo. Either delete the file if it's no longer needed, or keep the original name. A .bak file in cmake/Modules will confuse future developers.
4. Boost_NO_BOOST_CMAKE=ON only applied to Linux, not macOS
pyproject.toml
CMAKE_ARGS = "-DBoost_NO_BOOST_CMAKE=ON" is set in [tool.cibuildwheel.linux] environment but not [tool.cibuildwheel.macos]. Combined with the CMakeLists.txt change removing CONFIG from find_package(Boost REQUIRED), this may behave inconsistently: Linux forces the find-module path, macOS uses whatever CMake defaults to with Homebrew Boost. If macOS already works, add a comment explaining why the flag is not needed there.
Minor Issues (2)
5. ~ in CCACHE_CONFIGPATH is fragile
pyproject.toml: CCACHE_CONFIGPATH = "~/ccache.conf" — cibuildwheel passes this as a literal string; shell expansion does not apply. The Python fix makes it work, but $HOME/ccache.conf would be more conventional and self-documenting.
6. setuptools added without version pin
pyproject.toml: "setuptools" added to build-system.requires with no version constraint. This may cause non-reproducible builds as setuptools makes breaking changes. Consider "setuptools>=68" or similar.
Strengths
- The
execinfo.h/HAS_EXECINFOguard incytnx_error.hppis correct and necessary for non-glibc platforms (macOS, musl/Alpine). - Multi-distro
apk/dnf/yumdispatch incibuildwheel_before_all.shis clean and extensible. ln -sfinstead ofln -sprevents errors on re-runs.manylinux_2_28downgrade is a reasonable compatibility improvement.