Branch: refs/heads/main
Revision: 48ef8144b12621f83e28e1c87dddd2237aff37dd
Author: jabraham17
Link: Handle CC/CXX for the chapel-py build by jabraham17 · Pull Request #27508 · chapel-lang/chapel · GitHub
Log Message:
Handle CC/CXX for the chapel-py build (#27508)
Fixes the issue that Prevent cmake from breaking printchplenv by setting CC/CXX by jabraham17 · Pull Request #27502 · chapel-lang/chapel · GitHub
tried to fix, where an incorrect CC/CXX was inferred by Python/CMake.
The fix of CC/CXX broke more configurations than it fixed, because in
many situations we rely on CC/CXX to infer HOST_CC/HOST_CXX
details of issue
The problem is that CC/CXX are being set to some value and passed to the
CMakeLists.txt, which is then passed along as a part of the environment
when invoking printchplenv. On some systems, this can break
printchplenv's detection of the host compiler. Some of these problems
where fixed by improving printchplenv, but fundamentally one problem
that can occur is that chapel-py and dyno end up using different
compilers, which can have ABI problems.
I originally thought this problem was caused by CMake setting CC/CXX to
default values, but after further investigation I don't think thats the
case. In a standalone CMake file,
CC/CXX/CMAKE_C_COMPILER/CMAKE_CXX_COMPILER are all unset (unless set by
the user). The way CMake is invoked for chapel-py, we run pip install tools/chapel-py, which invokes the build tool (scikit-build-core),
which invokes cmake. scikit-build-core explicitly sets CC/CXX.
In the event CC/CXX are unset in the environment, scikit-build-core
will infer them based on
sysconfig,
essentially the CC/CXX used to build python.
Most of the time, I think this ends up being fine. But with spack
installs and Cray PE modules, things break.
In the future if this continues to be a problem we should consider
switching to py-build-cmake, an alternative build tool to
scikit-build-core. My impression is that scikit-build-core has wider
adoption and better support, so I am disinclined to switch. Resolving
Ability to set environment variables in pyproject.toml · Issue #1114 · scikit-build/scikit-build-core · GitHub will fix
things properly for us.
The solution is to make sure CC/CXX is always set in the env, which
means that users who wish to manually install the Python bindings will
need to override CC/CXX. This PR documents this.
[Reviewed by @lydia-duncan]
Diff:
M doc/rst/tools/chapel-py/chapel-py.rst
M third-party/chpl-venv/Makefile
M tools/chapel-py/CMakeLists.txt
https://github.com/chapel-lang/chapel/pull/27508.diff