pybind / pybind/pybind11

[BUG]: Is Pybind11 cmake work for Windows py3.14t if only set `PYTHON_EXECUTABLE`?

Open
#5,884 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

Required prerequisites
What version (or hash if on master) of pybind11 are you using?

3.0.2 patch2a0

Problem description

I downloaded the official 3.14 python windows release from python.org and install the python 3.14t therein. When I compiles my extension with mingw (similar should be for MSVC), I explicitly assign in CMakeLists.txt that

set(PYTHON_EXECUTABLE "C:\Program Files\Python314\python3.14t.exe")

I found two questionable things:

  1. the PYTHON_LIBRARY variable generated by python+"VERSION" will result in linking python314.dll instead of the expected python314t.dll
  2. I found no where to detect free-threading setting and define Py_GIL_DISABLED=1
Reproducible example code
CMakeLists.txt:

set(PYTHON_EXECUTABLE "C:\Program Files\Python314\python3.14t.exe")

# still need set following to work?
set(PYTHON_LIBRARY "C:\Program Files\Python314\libs\python314t.lib")
set(CMAKE_CXX_FLAG "${CMAKE_CXX_FLAGS} -DPy_GIL_DISABLED=1")  # mingw, for example; /D for MSVC
Is this a regression? Put the last known working version here if it is.

Not a regression

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CMake configuration and the CMakeLists.txt settings shown in the report, then reproduce the build on Windows with Python 3.14t. Check whether PYTHON_EXECUTABLE selects python314t.lib and whether Py_GIL_DISABLED=1 is defined automatically; done means the extension builds without the manual PYTHON_LIBRARY and compiler-flag overrides.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.