pybind / pybind/pybind11

[BUG] Failing to find Python.h when building against a Flatpak runtime

Open
#2,989 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

OS: Linux, Freedesktop 20.08 Flatpak runtime.
Building f1abf5d9159b805674197f6bc443592e631c9130 as a module of iminuit 2.4.0.

This issue has been mentioned by another user here but I can replicate it.
The problem is with print(s.get_python_inc(plat_specific=True)); in FindPythonLibsNew.cmake which gives the result
/usr/include/x86_64-linux-gnu/python3.8 but only pyconfig.h is there.
When setting plat_specific=False I'm getting /usr/include/python3.8 which is where Python.h resides.

One suggested fix is to change plat_specific to False but I don't know if this is correct.
Another fix for this is to determine if we are running in Flatpak by checking the existence of /.flatpak-info and then set plat_specific to False.

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 in FindPythonLibsNew.cmake and inspect the get_python_inc(plat_specific=True) path selection described in the issue. Reproduce the lookup in the Freedesktop 20.08 Flatpak runtime, compare the plat_specific values, and verify that building pybind11 as part of iminuit can locate Python.h without a manual workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.