From 19e38c0d4f40f71088e527a7c22c97bb55d6d6ce Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Fri, 13 Nov 2026 20:06:30 -0500 Subject: [PATCH 1/2] Find the C ABI library through PATH in the Windows consumer test 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> --- python/cpp/{{module}}/tests/test_all.py.jinja | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/cpp/{{module}}/tests/test_all.py.jinja b/python/cpp/{{module}}/tests/test_all.py.jinja index 97a7aad..536a0f5 100644 --- a/python/cpp/{{module}}/tests/test_all.py.jinja +++ b/python/cpp/{{module}}/tests/test_all.py.jinja @@ -65,9 +65,11 @@ def test_c_consumer_builds_against_the_installed_package(tmp_path): source.write_text(C_CONSUMER) executable = tmp_path / ("consumer.exe" if platform == "win32" else "consumer") env = dict(os.environ) + if platform == "win32": + # Windows has no rpath, so the program finds the DLL through PATH whichever compiler built it. + env["PATH"] = library_dir + os.pathsep + env["PATH"] if Path(compiler).stem.lower() == "cl": command = [compiler, "/nologo", f"/I{get_include()}", str(source), f"/Fe:{executable}", "/link", f"/LIBPATH:{library_dir}", f"{library}.lib"] - env["PATH"] = library_dir + os.pathsep + env["PATH"] else: command = [ compiler, From 69fea86447352b3aad5a33c6feedc3b11f5b40b1 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Fri, 13 Nov 2026 20:11:43 -0500 Subject: [PATCH 2/2] Exclude the C ABI library from delvewheel repair in the cpp template 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> --- python/cpp/pyproject.toml.jinja | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/cpp/pyproject.toml.jinja b/python/cpp/pyproject.toml.jinja index 47b64bc..7b1e451 100644 --- a/python/cpp/pyproject.toml.jinja +++ b/python/cpp/pyproject.toml.jinja @@ -110,7 +110,10 @@ repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} --exclud [tool.cibuildwheel.windows] archs = "AMD64" skip = "*win32 *arm64" - +{% if add_c_abi -%} +# The C ABI library ships inside the wheel; delvewheel must not look for it on PATH. +repair-wheel-command = "delvewheel repair --exclude lib{{ module }}.dll -w {dest_dir} {wheel}" +{% endif %} {% if add_pyodide -%} [tool.cibuildwheel.pyodide] test-command = "python -m pytest -vvv --pyargs {{ module }}.tests"