Skip to content

Fix the cpp C ABI option on Windows - #223

Open
timkpaine wants to merge 2 commits into
mainfrom
fix-windows-consumer-test
Open

timkpaine wants to merge 2 commits into
mainfrom
fix-windows-consumer-test

Conversation

@timkpaine

@timkpaine timkpaine commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Description

Two Windows failures from python-project-templates/python-template-cpp#109, the first Windows run of add_c_abi in the cpp template:

  • The C consumer test added the bundled library's directory to PATH only when the compiler was cl. GitHub's Windows runners have MinGW gcc on PATH before cl, so the test built the program with gcc and it exited with STATUS_DLL_NOT_FOUND. The test now sets PATH on Windows for any compiler.
  • cibuildwheel runs delvewheel repair on Windows by default, and it failed with Unable to find library for the DLL the wheel already ships. The Windows repair command now excludes it, as the rust template does.

In that run the extension import, the ctypes load, and the CMake find_package consumer passed on Windows.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup
  • CI / build configuration
  • Other (describe below)

Checklist

  • Linting passes (make lint)
  • Tests pass (make test)
  • New tests added for new functionality
  • Documentation updated (if applicable)
  • Changelog / version bump (if applicable)

The cpp template's C consumer test added the library directory to PATH only when the compiler was cl. GitHub's Windows runners have MinGW gcc on PATH before cl, so the test built the program with gcc and it exited with STATUS_DLL_NOT_FOUND. Set PATH on Windows for any compiler.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
timkpaine added a commit to python-project-templates/python-template-cpp that referenced this pull request Nov 14, 2026
Windows runners find MinGW gcc before cl, and the program needs the library directory on PATH either way. The same change is in python-project-templates/base#223.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
cibuildwheel runs delvewheel on Windows by default, and it failed with "Unable to find library" for the DLL the wheel already ships.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
@timkpaine timkpaine changed the title Find the C ABI library through PATH in the Windows consumer test Fix the cpp C ABI option on Windows Nov 14, 2026
timkpaine added a commit to python-project-templates/python-template-cpp that referenced this pull request Nov 14, 2026
cibuildwheel runs delvewheel on Windows by default, and it cannot find the DLL the wheel already ships. The same change is in python-project-templates/base#223.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
python-templates-automerge Bot pushed a commit to python-project-templates/python-template-cpp that referenced this pull request Nov 14, 2026
* Enable the C ABI library option

Regenerate from the base template with add_c_abi. The sources split into cpp/python-template-cpp, which builds libpython_template_cpp with a C surface, and cpp/python, the pybind11 extension that links it. cpp/CMakeLists.txt builds and installs the library without Python.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>

* Set PATH for the Windows consumer program with any compiler

Windows runners find MinGW gcc before cl, and the program needs the library directory on PATH either way. The same change is in python-project-templates/base#223.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>

* Exclude the C ABI library from delvewheel repair

cibuildwheel runs delvewheel on Windows by default, and it cannot find the DLL the wheel already ships. The same change is in python-project-templates/base#223.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>

---------

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant