◐ Shell
clean mode source ↗

gh-148294: Make configure find g++ correctly by sendaoYan · Pull Request #148298 · python/cpython

@sendaoYan

@sendaoYan

@sendaoYan

@zware

@zware

@zware

@zware zware enabled auto-merge (squash)

May 21, 2026 20:37

@zware zware changed the title GH-148294: Make configure found g++ correctly gh-148294: Make configure find g++ correctly

May 22, 2026

@lazka lazka mentioned this pull request

Jun 10, 2026

rapids-bot Bot pushed a commit to rapidsai/ci-imgs that referenced this pull request

Jun 12, 2026
…421)

Contributes to #420 (hopefully "fixes", but we'll see 😅)

As described there, we observed wheel builds using `scikit-build-core` falling back to the GCC 8.5 at `/usr/bin/g++`.

```text
  -- The CXX compiler identification is GNU 8.5.0
  -- The CUDA compiler identification is NVIDIA 12.9.86 with host compiler GNU 14.2.1
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/g++ - skipped
```

Despite enabling the GCC 14 toolset:

https://github.com/rapidsai/ci-imgs/blob/2bbcab77116642b15f764df2b33fe3ff1bd57b90/ci-wheel.Dockerfile#L143-L144

It looks like the root cause is something like:

* `sysconfig.get_config_var("CXX")` returns the compiler the Python interpreter was built with
* at some point recently (possibly python/cpython#148298), CPython started recording an absolute path like `/usr/bin/g++`
* we build CPython from source in the `ci-wheel` images used in RAPIDS, `/usr/bin/g++` is the first C++ compiler on `PATH` at the time that build happens
* `scikit-build-core` reads that value when configuring CMake projects ([scikit-build/scikit-build-core - src/scikit_build_Core/builder/generator.py](https://github.com/scikit-build/scikit-build-core/blob/05948f43ffa21f5ab84c0c2d239f1509d5e39882/src/scikit_build_core/builder/generator.py#L118))
* activating the GCC toolset doesn't work because that absolute path circumvents any `PATH` lookup at CMake configure time... `/usr/bin/g++` is used unconditionally

This attempts to fix it by activating the GCC toolset before building CPython.

## Notes for Reviewers

I haven't tested this locally, getting the PR up to start CI before I have to step away for a bit. Will try to return to it tonight.

I also think I have an idea of which CPython change caused this, will report an issue upstream tonight.

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Bradley Dice (https://github.com/bdice)

URL: #421