← All tasks
cppwjakob/nanobind #1350Not a task: not reproduced

[BUG]: add_module names .so after some python version, not the one compiled against if EXACT is specified when searching Python

envgap__wjakob__nanobind-1350

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
5b1a8df475ef53c3271275d3c3cf71b25af0d08d
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

wjakob/nanobind #1350 · read the original issue
### Problem description

I'm currently using master branch (2deac96697d1b304f3c973cef7de5f94cbad5a57) with cmake version 4.3.2 and noticed that the .so generated gets named after *a* python version found on the system, not necessarily the one it was compiled against.

### Reproducible example code

Install two versions of Python, in my case 3.13 and 3.14 and use the following CMakeLists.txt

```cmake
cmake_minimum_required(VERSION 3.19)

project(buggy)

# notice the EXACT and the missing "Interpreter" component

find_package(Python 3.13 EXACT COMPONENTS Development.Module REQUIRED)

add_subdirectory(nanobind)

nanobind_add_module(my_ext my_ext.cpp)
```

Running CMake results in an output like this

```text
-- Found Python: /usr/include/python3.13 (found suitable exact version "3.13.12") found components: Development.Module
-- Found Python: /home/dennis/.local/bin/python3.14 (found suitable version "3.14.3", minimum required is "3.9") found components: Interpreter Development.Module Development.SABIModule
```
It found 3.14 and 3.13 but chose 3.13 since it's the exact match. (The order in which these messages appear does not seem to matter, in my real project 3.14 gets found first, but the issue remains.)

Compiling the project will correctly compile against Python 3.13, but the filename will be something like `my_ext.cpython-314-x86_64-linux-gnu.so`, the 314 should be 313.
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]