pybind / pybind/pybind11

[BUG] cmake detects wrong PYTHON_LIBRARIES even if PYTHON_EXECUTABLE is set

Open
#2,661 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Issue description

When building on a system with multiple python installations, pybind11's cmake script set PYTHON_LIBRARIES to the wrong values.

I was suggested in the gitter chat to set PYTHON_EXECUTABLE.
With that it shows the right interpreter, but the libraries are still pulled from the wrong path.

Reproducible example code

It happened to me when trying to link to the MSYS2 python in an Appveyor job, but I've head people had the same issue in other systems as well.

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 by reproducing the issue with multiple Python installations, including the MSYS2/Appveyor setup described in the report, and inspect pybind11's CMake Python discovery. Done means PYTHON_LIBRARIES resolves to the libraries belonging to the interpreter selected by PYTHON_EXECUTABLE across the affected systems.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.