Gentoo Archives: gentoo-user

From: "Gerrit Kühn" <gerrit.kuehn@×××××××.de>
To: gentoo-user@l.g.o
Subject: [gentoo-user] ebuild with cmake, swig and python
Date: Tue, 03 Sep 2019 06:10:32
Message-Id: 20190903081020.896ba9b09cdebd362f83648c@aei.mpg.de
1 Hi,
2
3 After searching the web without much success, maybe somebody in here can
4 direct me into the right direction:
5 I have a software that is providing swig bindings to (among other
6 languages) python, and I'd like to have an ebuild for that and get
7 binding for python2 and python3 at the same time. Building the thing works
8 fine for python2 and python3 on the commandline, but I cannot get my
9 ebuild to build for both python2 and python3 versions. It will build for
10 whatever is set as default python interpreter, but will not find the
11 libraries for the other one.
12
13 This is what the ebuild reports (with python3 being default):
14
15 -- +++ DEBUG +++ PYTHON_EXECUTABLE: /usr/bin/python
16 -- Found PythonInterp: /usr/bin/python (found version "3.6.9")
17 -- Found PythonLibs: /usr/lib/libpython3.6m.so (found version "3.6.9")
18 -- +++ DEBUG +++ PYTHON_EXECUTABLE: /usr/bin/python
19 -- +++ DEBUG +++ PYTHON_LIBRARIES: /usr/lib/libpython3.6m.so
20 -- +++ DEBUG +++ PYTHONLIBS_VERSION_STRING: 3.6.9
21 -- Found SWIG: /usr/bin/swig (found suitable version "3.0.12", minimum
22 required is "2.0.4")
23 -- +++ DEBUG +++ ARG_INTERP: python2
24 -- +++ DEBUG +++ PYTHON_EXECUTABLE: /usr/bin/python2
25 -- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.15",
26 minimum required is "2")
27 -- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES
28 PYTHON_INCLUDE_DIRS) (Required is at least version "2")
29 -- +++ DEBUG +++ PYTHON_EXECUTABLE: /usr/bin/python2
30 -- +++ DEBUG +++ PYTHON_LIBRARIES: PYTHON_LIBRARY-NOTFOUND
31 -- +++ DEBUG +++ PYTHONLIBS_VERSION_STRING:
32 -- Checking for python 2.7.15 module: numpy ... yes
33 -- +++ DEBUG +++ ARG_PYTHON_EXECUTABLE: /usr/bin/python2
34
35
36 This is what I get on the commandline when building:
37
38 -- +++ DEBUG +++ PYTHON_EXECUTABLE: /usr/bin/python
39 -- Found PythonInterp: /usr/bin/python (found version "3.6.9")
40 -- Found PythonLibs: /usr/lib/libpython3.6m.so (found version "3.6.9")
41 -- +++ DEBUG +++ PYTHON_EXECUTABLE: /usr/bin/python
42 -- +++ DEBUG +++ PYTHON_LIBRARIES: /usr/lib/libpython3.6m.so
43 -- +++ DEBUG +++ PYTHONLIBS_VERSION_STRING: 3.6.9
44 -- Found SWIG: /usr/bin/swig (found suitable version "3.0.12", minimum
45 required is "2.0.4")
46 -- +++ DEBUG +++ ARG_INTERP: /usr/bin/python2
47 -- +++ DEBUG +++ PYTHON_EXECUTABLE: /usr/bin/python2
48 -- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.15",
49 minimum required is "2")
50 -- Found PythonLibs: /usr/lib/libpython2.7.so (found suitable version
51 "2.7.15", minimum required is "2")
52 -- +++ DEBUG +++ PYTHON_EXECUTABLE: /usr/bin/python2
53 -- +++ DEBUG +++ PYTHON_LIBRARIES: /usr/lib/libpython2.7.so
54 -- +++ DEBUG +++ PYTHONLIBS_VERSION_STRING: 2.7.15
55 -- Checking for python 2.7.15 module: numpy ... yes
56 -- +++ DEBUG +++ ARG_PYTHON_EXECUTABLE: /usr/bin/python2
57
58
59 The ebuild itself is quite straight-forward (I think), just using
60 cmake-utils to pass on USE flags to options (ENABLE_SWIG_PYTHON2 and
61 ENABLE_SWIG_PYTHON3 in this case). This part works as far as I can see. Is
62 there anything else to consider? Somehow the ebuild environment appears to
63 be different from what I have on the commandline so that the second python
64 version isn't properly found.
65
66
67 cu
68 Gerrit