Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 691092 - kde-plasma/breeze-gtk-5.16.4 - picks up wrong python interpreter version
Summary: kde-plasma/breeze-gtk-5.16.4 - picks up wrong python interpreter version
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-31 01:20 UTC by Michael Egger
Modified: 2019-10-27 12:44 UTC (History)
10 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,4.62 KB, text/plain)
2019-10-18 23:14 UTC, Dennis Schridde
Details
CMakeOutput.log (CMakeOutput.log,42.03 KB, text/plain)
2019-10-18 23:15 UTC, Dennis Schridde
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Egger 2019-07-31 01:20:49 UTC
breeze-gtk-5.16.4 fails to build because it refers to /usr/bin/python3.7 instead of python3.6 as configured with eselect:

----------------------------------------------------------------------------
-- The C compiler identification is GNU 9.1.0
-- The CXX compiler identification is GNU 9.1.0
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Sass: /usr/bin/sassc  
-- Found Python3: /usr/bin/python3.7 (found version "3.7.4") found components:  Interpreter 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cairo'
-- The following RUNTIME packages have been found:

 * GTKEngine, Pixmap/Pixbuf theme engine for GTK 2, <http://www.gtk.org/>
   Required for GTK 2 theme

-- The following REQUIRED packages have been found:

 * ECM (required version >= 0.0.9)
 * Sass, SASS compiler, <https://sass-lang.com/>
   Required for building GTK themes
 * Python3
 * Breeze (required version >= 5.14.90)
   Required to build the Breeze GTK+ styles
 * Qt5
 * Qt5Core

-- The following REQUIRED packages have not been found:

 * PythonCairo
   Required to render assets

CMake Error at /usr/share/cmake/Modules/FeatureSummary.cmake:457 (message):
  feature_summary() Error: REQUIRED package(s) are missing, aborting CMake
  run.
Call Stack (most recent call first):
  CMakeLists.txt:24 (feature_summary)


-- Configuring incomplete, errors occurred!

----------------------------------------------------------------------------


$ eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.6
  [2]   python3.7 (fallback)
  [3]   python3.5 (fallback)
  [4]   python2.7 (fallback)

$ emerge --info dev-python/pycairo
dev-python/pycairo-1.18.1::gentoo was built with the following:
USE="-doc -examples -test" ABI_X86="(64)" PYTHON_TARGETS="python2_7 python3_6 -pypy -pypy3 -python3_5 -python3_7"

$ emerge --info dev-util/cmake
dev-util/cmake-3.15.1::gentoo was built with the following:
USE="ncurses -doc -emacs -qt5 -system-jsoncpp -test" ABI_X86="(64)"
Comment 1 Victor Mataré 2019-08-01 00:07:31 UTC
Btw, this only happens because I have python:3.7 installed, but PYTHON_TARGETS="python2_7 python3_6", which is ignored by the breeze-gtk ebuild. So why doesn't it use PYTHON_TARGETS or PYTHON_SINGLE_TARGET like all the other packages?
Comment 2 Arfrever Frehtes Taifersar Arahesis 2019-08-01 00:12:19 UTC
Please check if adding the following code to ebuild would help:

src_configure() {
  local mycmakeargs=(
    -DPython3_EXECUTABLE="${PYTHON}"
  )
  kde5_src_configure
}
Comment 3 Victor Mataré 2019-08-01 01:08:17 UTC
Nope, same thing, i.e. still picks up 3.7, which then fails because of missing pycairo.
Comment 4 Victor Mataré 2019-08-01 01:18:57 UTC
Looks to me like the python-any-r1 eclass is not the right choice since it depends not just on "some" python interpreter as the docu states, but it has a build-time depencency on a specific python library. So what it does there simply needs to be in sync with PYTHON_TARGETS and/or PYTHON_SINGLE_TARGET.
Comment 5 Arfrever Frehtes Taifersar Arahesis 2019-08-01 02:06:24 UTC
When using CMake >=3.12, wrong version of Python was detected since:
https://cgit.kde.org/breeze-gtk.git/commit/CMakeLists.txt?id=3f82a073a3fee302e04d6e16edeaa95a9e5fd14a
https://cgit.kde.org/breeze-gtk.git/commit/CMakeLists.txt?id=df36153445cc908a8a0a23d43a5b4723b2195696

Problem became more visible in Gentoo when check for cairo module was added:
https://cgit.kde.org/breeze-gtk.git/commit/?id=fda7d4375883cb18a5f21b6a6b767fe13e9bbc08


The older FindPythonInterp.cmake and FindPythonLibs.cmake are more reliable in Gentoo, because they respect user-requested Python version (user == ebuild in Gentoo context).

FindPython.cmake, FindPython2.cmake and FindPython3.cmake introduced in CMake 3.12 are missing support for respecting user-requested Python version.
CMake upstream bug:
https://gitlab.kitware.com/cmake/cmake/issues/19492


A quick workaround in kde-plasma/breeze-gtk ebuilds would be to force using FindPythonInterp.cmake until CMake is fixed:
[[[
--- /cmake/FindPythonCairo.cmake
+++ /cmake/FindPythonCairo.cmake
@@ -1,10 +1,4 @@
-if(CMAKE_VERSION VERSION_LESS 3.12.0)
-    find_package(PythonInterp 3 REQUIRED)
-    # PythonInterp sets PYTHON_EXECUTABLE
-else()
-    find_package(Python3 COMPONENTS Interpreter REQUIRED)
-    set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
-endif()
+find_package(PythonInterp 3 REQUIRED)
 
 # Check for python cairo
 execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import cairo"
]]]
With above patch applied, ebuild would need to set -DPYTHON_EXECUTABLE="${PYTHON}", not -DPython3_EXECUTABLE="${PYTHON}".
Comment 6 jeremy mills 2019-08-02 06:18:15 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #5)
> When using CMake >=3.12, wrong version of Python was detected since:
> https://cgit.kde.org/breeze-gtk.git/commit/CMakeLists.
> txt?id=3f82a073a3fee302e04d6e16edeaa95a9e5fd14a
> https://cgit.kde.org/breeze-gtk.git/commit/CMakeLists.
> txt?id=df36153445cc908a8a0a23d43a5b4723b2195696
> 
> Problem became more visible in Gentoo when check for cairo module was added:
> https://cgit.kde.org/breeze-gtk.git/commit/
> ?id=fda7d4375883cb18a5f21b6a6b767fe13e9bbc08
> 
> 
> The older FindPythonInterp.cmake and FindPythonLibs.cmake are more reliable
> in Gentoo, because they respect user-requested Python version (user ==
> ebuild in Gentoo context).
> 
> FindPython.cmake, FindPython2.cmake and FindPython3.cmake introduced in
> CMake 3.12 are missing support for respecting user-requested Python version.
> CMake upstream bug:
> https://gitlab.kitware.com/cmake/cmake/issues/19492
> 
> 
> A quick workaround in kde-plasma/breeze-gtk ebuilds would be to force using
> FindPythonInterp.cmake until CMake is fixed:
> [[[
> --- /cmake/FindPythonCairo.cmake
> +++ /cmake/FindPythonCairo.cmake
> @@ -1,10 +1,4 @@
> -if(CMAKE_VERSION VERSION_LESS 3.12.0)
> -    find_package(PythonInterp 3 REQUIRED)
> -    # PythonInterp sets PYTHON_EXECUTABLE
> -else()
> -    find_package(Python3 COMPONENTS Interpreter REQUIRED)
> -    set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
> -endif()
> +find_package(PythonInterp 3 REQUIRED)
>  
>  # Check for python cairo
>  execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import cairo"
> ]]]
> With above patch applied, ebuild would need to set
> -DPYTHON_EXECUTABLE="${PYTHON}", not -DPython3_EXECUTABLE="${PYTHON}".

I'll give this a try in the morning. If I understand all this correctly. Currently cmake pick the highest python version installed even if it's not the system selected python version (eselect python set --python3 "PYTHON_VERSION"?

And this patch will cause it instead to explicitly use the system selected python even if it's not the highest version installed?
Comment 7 Piotr 2019-08-02 22:08:27 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #5)
> A quick workaround in kde-plasma/breeze-gtk ebuilds would be to force using
> FindPythonInterp.cmake until CMake is fixed:
> [[[
> --- /cmake/FindPythonCairo.cmake
> +++ /cmake/FindPythonCairo.cmake
> @@ -1,10 +1,4 @@
> -if(CMAKE_VERSION VERSION_LESS 3.12.0)
> -    find_package(PythonInterp 3 REQUIRED)
> -    # PythonInterp sets PYTHON_EXECUTABLE
> -else()
> -    find_package(Python3 COMPONENTS Interpreter REQUIRED)
> -    set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
> -endif()
> +find_package(PythonInterp 3 REQUIRED)
>  
>  # Check for python cairo
>  execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import cairo"
> ]]]
> With above patch applied, ebuild would need to set
> -DPYTHON_EXECUTABLE="${PYTHON}", not -DPython3_EXECUTABLE="${PYTHON}".

With this patch it builds fine for me.
Comment 8 PhobosK 2019-08-21 12:58:16 UTC
Well a workaround is also to add the necessary Python 3.7 flag to pycairo:

dev-python/pycairo python_targets_python3_7

and rebuild dev-python/pycairo.

After that the emerge of kde-plasma/breeze-gtk would be OK
Comment 9 Dennis Schridde 2019-09-28 10:32:25 UTC
Please adjust the summary to include the error message, e.g. ... - The following REQUIRED packages have not been found: PythonCairo
Comment 10 Dennis Schridde 2019-10-06 17:51:07 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #5)
> The older FindPythonInterp.cmake and FindPythonLibs.cmake are more reliable
> in Gentoo, because they respect user-requested Python version (user ==
> ebuild in Gentoo context).
> 
> FindPython.cmake, FindPython2.cmake and FindPython3.cmake introduced in
> CMake 3.12 are missing support for respecting user-requested Python version.
> CMake upstream bug:
> https://gitlab.kitware.com/cmake/cmake/issues/19492

That issue has been closed in the meantime.  Is it possible to backport the fix to the versions available in Gentoo?
Comment 11 Andreas Sturmlechner gentoo-dev 2019-10-06 18:30:24 UTC
Much too big to backport, we'll have to hope for an upstream pick into 3.15 branch.
Comment 12 Andreas Sturmlechner gentoo-dev 2019-10-18 22:31:43 UTC
Brave souls may now test with cmake-3.16_rc2, thanks to Lars.
Comment 13 Dennis Schridde 2019-10-18 23:14:57 UTC
Created attachment 593262 [details]
build.log

(In reply to Andreas Sturmlechner from comment #12)
> Brave souls may now test with cmake-3.16_rc2, thanks to Lars.

The issue persists:

-- Found Python3: /usr/sbin/python3.7 (found version "3.7.5") found components: Interpreter                                                                                           
Traceback (most recent call last):                                                     
  File "<string>", line 1, in <module>                                 
ModuleNotFoundError: No module named 'cairo'
[...]
-- The following REQUIRED packages have not been found:

 * PythonCairo
   Required to render assets

CMake Error at /usr/share/cmake/Modules/FeatureSummary.cmake:457 (message):
  feature_summary() Error: REQUIRED package(s) are missing, aborting CMake
  run.
Call Stack (most recent call first):
  CMakeLists.txt:24 (feature_summary)
Comment 14 Dennis Schridde 2019-10-18 23:15:30 UTC
Created attachment 593264 [details]
CMakeOutput.log
Comment 15 Arfrever Frehtes Taifersar Arahesis 2019-10-24 02:58:01 UTC
(In reply to Andreas Sturmlechner from comment #12)
> Brave souls may now test with cmake-3.16_rc2

Features implemented in FindPython.cmake, FindPython2.cmake and FindPython3.cmake require passing explicit options.

kde-plasma/breeze-gtk ebuilds probably should have:

src_configure() {
  local mycmakeargs=(
    -DPython3_EXECUTABLE="${PYTHON}"
  )
  kde5_src_configure
}
Comment 16 Larry the Git Cow gentoo-dev 2019-10-27 10:32:41 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/kde.git/commit/?id=c4fac72ada1f8baeee835017f47d14ca5589cfa5

commit c4fac72ada1f8baeee835017f47d14ca5589cfa5
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-10-27 09:50:13 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-10-27 10:30:42 +0000

    kde-plasma/breeze-gtk: Fix python executable selection
    
    Thanks-to: Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com>
    Bug: https://bugs.gentoo.org/691092
    Package-Manager: Portage-2.3.78, Repoman-2.3.17
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 kde-plasma/breeze-gtk/breeze-gtk-5.17.49.9999.ebuild    | 17 +++++++++++++++++
 kde-plasma/breeze-gtk/breeze-gtk-9999.ebuild            | 17 +++++++++++++++++
 .../files/breeze-gtk-5.16.5-cmake-pre-3.16.patch        | 16 ++++++++++++++++
 3 files changed, 50 insertions(+)
Comment 17 Larry the Git Cow gentoo-dev 2019-10-27 10:36:09 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27754d34eb02ba1cf6aaffa04be7b490441fc8a7

commit 27754d34eb02ba1cf6aaffa04be7b490441fc8a7
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-10-27 09:50:13 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-10-27 10:35:31 +0000

    kde-plasma/breeze-gtk: Fix python executable selection
    
    Thanks-to: Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com>
    Closes: https://bugs.gentoo.org/691092
    Package-Manager: Portage-2.3.78, Repoman-2.3.17
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 kde-plasma/breeze-gtk/breeze-gtk-5.16.5.ebuild          | 17 +++++++++++++++++
 kde-plasma/breeze-gtk/breeze-gtk-5.17.1.ebuild          | 17 +++++++++++++++++
 .../files/breeze-gtk-5.16.5-cmake-pre-3.16.patch        | 16 ++++++++++++++++
 3 files changed, 50 insertions(+)
Comment 18 Dennis Schridde 2019-10-27 12:44:24 UTC
(In reply to Larry the Git Cow from comment #17)
> The bug has been closed via the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=27754d34eb02ba1cf6aaffa04be7b490441fc8a7
> 
> commit 27754d34eb02ba1cf6aaffa04be7b490441fc8a7
> Author:     Andreas Sturmlechner <asturm@gentoo.org>
> AuthorDate: 2019-10-27 09:50:13 +0000
> Commit:     Andreas Sturmlechner <asturm@gentoo.org>
> CommitDate: 2019-10-27 10:35:31 +0000
> 
>     kde-plasma/breeze-gtk: Fix python executable selection

I confirm: This makes it build for me.