Skip to content

Fix Windows wheel build for free-threaded Python#219

Merged
dfm merged 2 commits intomainfrom
copilot/debug-windows-wheel-build
Mar 15, 2026
Merged

Fix Windows wheel build for free-threaded Python#219
dfm merged 2 commits intomainfrom
copilot/debug-windows-wheel-build

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 15, 2026

The cp314t-win_amd64 wheel build fails with LINK : fatal error LNK1104: cannot open file 'python314.lib' because pybind11 3.x doesn't recognize the deprecated PYBIND11_NEWPYTHON variable, falls back to FindPythonLibsNew.cmake, and that module doesn't handle the t suffix for free-threaded Python on Windows.

The build logs even tell us the fix:

preferably upgrade to using FindPython, either by calling it explicitly before pybind11, or by setting PYBIND11_FINDPYTHON ON before pybind11.

  • Replace PYBIND11_NEWPYTHON with PYBIND11_FINDPYTHON in CMakeLists.txt so pybind11 uses CMake's FindPython module, which correctly resolves python314t.lib

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • gitlab.com
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…d PYBIND11_NEWPYTHON

The free-threaded CPython 3.14 (cp314t) build on Windows fails with:
  LINK : fatal error LNK1104: cannot open file 'python314.lib'

The root cause is that PYBIND11_NEWPYTHON is deprecated/unrecognized in
pybind11 3.0.x, causing it to fall back to FindPythonLibsNew.cmake which
doesn't properly handle the 't' suffix for free-threaded Python on Windows.

PYBIND11_FINDPYTHON is the correct variable that tells pybind11 to use
CMake's modern FindPython module, which correctly handles free-threaded
Python library naming (python314t.lib vs python314.lib).

Co-authored-by: dfm <350282+dfm@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix windows wheel build issue Fix Windows wheel build for free-threaded Python Mar 15, 2026
Copilot AI requested a review from dfm March 15, 2026 15:05
Copilot finished work on behalf of dfm March 15, 2026 15:05
@dfm dfm marked this pull request as ready for review March 15, 2026 15:08
@dfm dfm merged commit b502375 into main Mar 15, 2026
11 checks passed
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.

2 participants