MantisBT - CMake |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0013794 | CMake | CMake | public | 2012-12-13 19:47 | 2015-04-06 09:07 |
|
Reporter | Tobias Pfaff | |
Assigned To | Matt McCormick | |
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | Linux | OS | Ubuntu | OS Version | 12.10 |
Product Version | CMake 2.8.10.2 | |
Target Version | | Fixed in Version | CMake 3.1 | |
|
Summary | 0013794: find_package(PythonLibs) finds different version of Python headers and libraries |
Description | PythonLibs returns inconsistent versions for lib and include dir:
PYTHON_INCLUDE_DIR = /usr/include/python2.7
PYTHON_LIBRARIES = /usr/lib/python3.2/config/libpython3.2.so
resulting in linker errors.
The latter is probably the culprit, see cmake output:
Found PythonLibs: /usr/lib/python3.2/config/libpython3.2.so (found version "2.7.3")
The 2.7 version is in /usr/lib/python2.7/config/libpython2.7.so
This problem is probably specific to Ubuntu 12.10. It ships with 3.2 libraries on default, but no headers (unless you install python3-dev). It applies to both cmake version 2.8.9 (which comes with the distribution) and the newest 2.8.10.2.
I have not found a workaround yet -- apart from directly specifying the directories, which is not an option as I am distributing my code, and it should run on all client configurations.
Python_ADDITIONAL_VERSIONS e.g. do not help. |
Steps To Reproduce | find_package(PythonLibs REQUIRED)
message(${PYTHON_INCLUDE_DIRS})
message(${PYTHON_LIBRARIES})
on Ubuntu 12.10, with package python-dev installed (but python3-dev NOT installed) |
Additional Information | |
Tags | No tags attached. |
Relationships | has duplicate | 0010077 | closed | | FindPythonInterp and FindPythonLibs result in inconsistent python versions | related to | 0014271 | closed | Matt McCormick | find_package PythonInterp and PythonLibs are not consistent |
|
Attached Files | adamwwolf-FindPythonLibs.patch (1,050) 2013-04-29 14:35 https://public.kitware.com/Bug/file/4752/adamwwolf-FindPythonLibs.patch |
|
Issue History |
Date Modified | Username | Field | Change |
2012-12-13 19:47 | Tobias Pfaff | New Issue | |
2012-12-14 03:04 | Marcel Loose | Note Added: 0031885 | |
2013-04-03 13:28 | Orion Poplawski | Note Added: 0032751 | |
2013-04-29 14:34 | Adam Wolf | Note Added: 0032961 | |
2013-04-29 14:35 | Adam Wolf | File Added: adamwwolf-FindPythonLibs.patch | |
2013-08-28 12:11 | Orion Poplawski | Note Added: 0033755 | |
2013-08-28 13:12 | Orion Poplawski | Note Added: 0033756 | |
2014-02-26 07:09 | Gert Wollny | Note Added: 0035201 | |
2014-02-26 21:59 | Matthew McCormick | Note Added: 0035211 | |
2014-03-03 10:04 | Brad King | Note Added: 0035233 | |
2014-03-03 10:05 | Brad King | Assigned To | => Matt McCormick |
2014-03-03 10:05 | Brad King | Status | new => resolved |
2014-03-03 10:05 | Brad King | Resolution | open => fixed |
2014-03-03 10:05 | Brad King | Fixed in Version | => CMake 3.1 |
2014-03-03 10:05 | Brad King | Target Version | => CMake 3.1 |
2014-03-05 11:46 | Brad King | Relationship added | has duplicate 0010077 |
2014-03-05 11:48 | Brad King | Note Added: 0035306 | |
2014-03-05 11:48 | Brad King | Status | resolved => assigned |
2014-03-05 11:48 | Brad King | Resolution | fixed => reopened |
2014-03-05 12:02 | Brad King | Note Added: 0035307 | |
2014-03-05 12:02 | Brad King | Note Edited: 0035307 | bug_revision_view_page.php?bugnote_id=35307#r1396 |
2014-03-05 12:38 | Brad King | Resolution | reopened => open |
2014-03-05 12:38 | Brad King | Fixed in Version | CMake 3.1 => |
2014-03-05 13:59 | Matthew McCormick | Note Added: 0035314 | |
2014-03-05 14:38 | Brad King | Note Added: 0035316 | |
2014-03-05 17:39 | Matthew McCormick | Note Added: 0035322 | |
2014-03-05 17:52 | Matthew McCormick | Note Added: 0035323 | |
2014-03-06 10:57 | Orion Poplawski | Note Added: 0035328 | |
2014-03-13 09:26 | Brad King | Note Added: 0035392 | |
2014-03-13 11:23 | Matthew McCormick | Note Added: 0035393 | |
2014-03-14 09:15 | Brad King | Note Added: 0035403 | |
2014-03-26 11:06 | Brad King | Relationship added | related to 0014271 |
2014-04-03 20:35 | Nikolaus Demmel | Note Added: 0035634 | |
2014-04-03 20:48 | Matthew McCormick | Note Added: 0035635 | |
2014-04-04 10:21 | Nikolaus Demmel | Note Added: 0035639 | |
2014-04-04 11:26 | Brad King | Note Added: 0035641 | |
2014-10-03 09:34 | Brad King | Note Added: 0036898 | |
2014-10-03 09:34 | Brad King | Target Version | CMake 3.1 => |
2014-10-03 12:45 | Matthew McCormick | Note Added: 0036899 | |
2014-10-03 13:19 | Brad King | Status | assigned => resolved |
2014-10-03 13:19 | Brad King | Resolution | open => fixed |
2014-10-03 13:19 | Brad King | Fixed in Version | => CMake 3.1 |
2015-04-06 09:07 | Robert Maynard | Note Added: 0038415 | |
2015-04-06 09:07 | Robert Maynard | Status | resolved => closed |
Notes |
|
(0031885)
|
Marcel Loose
|
2012-12-14 03:04
|
|
I ran into this problem as well. It suffices to specify a version number, i.e.
FIND_PACKAGE(PythonLibs 2.7 REQUIRED)
This will find any Python 2 libraries with version number 2.7 or higher. |
|
|
(0032751)
|
Orion Poplawski
|
2013-04-03 13:28
|
|
|
|
(0032961)
|
Adam Wolf
|
2013-04-29 14:34
|
|
I made a very small patch to CMake to fix this problem. I tested it on Ubuntu, which has also been having this problem for a while. |
|
|
(0033755)
|
Orion Poplawski
|
2013-08-28 12:11
|
|
Ping - can we get this addressed please? |
|
|
(0033756)
|
Orion Poplawski
|
2013-08-28 13:12
|
|
FYI - The patch appears to work for us too. I'll be adding it to the Fedora package. |
|
|
(0035201)
|
Gert Wollny
|
2014-02-26 07:09
|
|
The major problem with the propose patch is that it only helps when the Python interpreter is searched for first.
However, e.g. ITK is doing
find_package(PythonLibs)
find_package(PythonInterp)
so that the patch will not help. My suggestion would be to let FindPythonLibs call FindPythonInterp and use this result (if availble) with the above patch.
If someone really wants to find versions of interpreter and libraries that are different from each other then she can still use the explicit specification of versions. |
|
|
(0035211)
|
Matthew McCormick
|
2014-02-26 21:59
|
|
|
|
(0035233)
|
Brad King
|
2014-03-03 10:04
|
|
|
|
(0035306)
|
Brad King
|
2014-03-05 11:48
|
|
|
|
(0035307)
|
Brad King
|
2014-03-05 12:02
|
|
|
|
(0035314)
|
Matthew McCormick
|
2014-03-05 13:59
|
|
|
|
(0035316)
|
Brad King
|
2014-03-05 14:38
|
|
Re 0013794:0035314: So add a similar change to FindPythonInterp. At least now there is *a* way to get consistent versions. |
|
|
(0035322)
|
Matthew McCormick
|
2014-03-05 17:39
|
|
|
|
(0035323)
|
Matthew McCormick
|
2014-03-05 17:52
|
|
|
|
(0035328)
|
Orion Poplawski
|
2014-03-06 10:57
|
|
Current version of FindPythonLibs fixed the reported Fedora issue. Thanks. |
|
|
(0035392)
|
Brad King
|
2014-03-13 09:26
|
|
Re 0013794:0035323: That commit prints a warning if FindPythonLibs has been loaded first. That will warn even when a project does
find_package(PythonInterp)
find_package(PythonLibs)
and later does
find_package(PythonInterp)
again. I think information like that should go in the documentation but not a warning. |
|
|
(0035393)
|
Matthew McCormick
|
2014-03-13 11:23
|
|
|
|
(0035403)
|
Brad King
|
2014-03-14 09:15
|
|
|
|
(0035634)
|
Nikolaus Demmel
|
2014-04-03 20:35
|
|
One question about this patch. What does the line
list(APPEND _Python_VERSIONS ";")
do? I would have expected to find something like
list(APPEND _Python_VERSIONS "python")
there instead. Am I mistaken, or does the module with this patch not look for the "python" command (no version number) any more? Even if no version is specified? |
|
|
(0035635)
|
Matthew McCormick
|
2014-04-03 20:48
|
|
The ";" entry corresponds to an empty entry in the list, which causes it to look for "python". |
|
|
(0035639)
|
Nikolaus Demmel
|
2014-04-04 10:21
|
|
Thanks for the clarification. I got confused about this list containing only version numbers, not the full executable string. Also ";" resulting in an empty entry is not very intuitive for the CMake noob like myself. (I'm looking at this while investigating 0014809). |
|
|
(0035641)
|
Brad King
|
2014-04-04 11:26
|
|
Re 0013794:0035635, 0013794:0035639: Actually appending ";" results in two empty entries because it is a ;-separated list of two empty elements. Just
list(APPEND _Python_VERSIONS "")
should be enough to append an empty list entry. |
|
|
(0036898)
|
Brad King
|
2014-10-03 09:34
|
|
The patches in 0013794:0035403 are now in 'master'. Are there remaining issues here?
|
|
|
(0036899)
|
Matthew McCormick
|
2014-10-03 12:45
|
|
To the best of my knowledge, this issue is addressed, at least in how was described in the original bug report. |
|
|
(0038415)
|
Robert Maynard
|
2015-04-06 09:07
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|