Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying Python version when running cmake #1893

Closed
ngleb opened this issue May 4, 2020 · 5 comments · Fixed by #1909
Closed

Specifying Python version when running cmake #1893

ngleb opened this issue May 4, 2020 · 5 comments · Fixed by #1909
Labels
build Build problems
Milestone

Comments

@ngleb
Copy link

ngleb commented May 4, 2020

Hi!

I'm trying to build 3.2.0 with Python support. All dependencies are installed, however I have issue with adding Python support.

When running cmake -DUSE_PYTHON=yes ., it does detect Python, but only the latest version installed which is 3.8.2, but the main version I have is python 3.7 and Boost is also built only with python 3.7.

I tired passing -DPYTHON_EXECUTABLE=/usr/bin/python3.7 but that doesn't work:
ledger-1.log

If I remove Python 3.8, then cmake -DUSE_PYTHON=yes . finishes without errors:
ledger-2.log

I'm on Gentoo, the following deps are installed:

  • Python 3.6, Python 3.7 (this is the main version that is used by the system and is supported by Boost), Python 3.8,
  • GCC 9.3.0
  • Cmake 3.16.5
  • ledger 3.2.0

Is there another option that could help?

@ngleb
Copy link
Author

ngleb commented May 7, 2020

I found was was causing the issue.

ledger sources has its own FindPython cmake module. If I remove this module, and cmake uses its own modules, then I can build ledger with the following command:

cmake -DPython_EXECUTABLE=/usr/bin/python3.7 -DPython_INCLUDE_DIR="/usr/include/python3.7m" -DUSE_PYTHON=yes .

@ngleb
Copy link
Author

ngleb commented May 7, 2020

It looks like these options were added in 3.16, but FindPython module in ledger sources is from 3.15:
Kitware/CMake@06d9e67#diff-19d61b7db7059e6b1e00d0e31d827b73

@tbm
Copy link
Contributor

tbm commented May 8, 2020

@q3aiml can you look into this?

@tbm
Copy link
Contributor

tbm commented May 13, 2020

It looks like these options were added in 3.16, but FindPython module in ledger sources is from 3.15

Can you update the FindPython module in ledger and submit a PR?

@ngleb
Copy link
Author

ngleb commented May 13, 2020

Can you update the FindPython module in ledger and submit a PR?

That's strange, but tests are failing as new FindPython can't properly locate Python include path now and builds are failing. It can be manually specified in CMake arguments like this, but it has to be interpreter and include dirs together:
cmake . -DPython_EXECUTABLE=/usr/bin/python3.7 -DPython_INCLUDE_DIR="/usr/include/python3.7m" -DUSE_PYTHON=yes

Gentoo offers it's own functions for finding Python and passing it as arguments to CMake, so I didn't even check it without arguments.

@tbm tbm added the build Build problems label May 15, 2020
@tbm tbm closed this as completed in #1909 May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build problems
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants