Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 671308 - >=media-libs/mesa-18.3.0_rc1: Incorrect detection of Python 3 ("ERROR: Problem encountered: Python (3.x) mako module >= 0.8.0 required to build mesa.")
Summary: >=media-libs/mesa-18.3.0_rc1: Incorrect detection of Python 3 ("ERROR: Probl...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-17 05:53 UTC by DaggyStyle
Modified: 2019-07-09 18:09 UTC (History)
3 users (show)

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


Attachments
build.log (media-libs:mesa-18.3.0_rc3:20181117-054819.log,5.20 KB, text/plain)
2018-11-17 05:53 UTC, DaggyStyle
Details
latest build.log (media-libs:mesa-18.3.0_rc3:20181117-152029.log,5.20 KB, text/plain)
2018-11-17 15:25 UTC, DaggyStyle
Details
Test ebuild (meson_test-0.ebuild,1.57 KB, text/plain)
2018-11-18 22:53 UTC, Arfrever Frehtes Taifersar Arahesis
Details
Patch for Mesa (mesa.patch,1.17 KB, patch)
2018-11-18 23:03 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff
Patch for Mesa (mesa.patch,1.19 KB, patch)
2019-06-17 18:50 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description DaggyStyle 2018-11-17 05:53:00 UTC
Created attachment 555396 [details]
build.log

in similar to bug #663334, this issue happens with the version mentioned above.

$ emerge --info mesa   
Portage 2.3.51 (python 2.7.15-final-0, default/linux/amd64/17.0/desktop/plasma, gcc-8.2.0, glibc-2.27-r6, 4.19.2-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.19.2-gentoo-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.6
KiB Mem:    16389672 total,   5916400 free
KiB Swap:   16393212 total,  16393212 free
Head commit of repository gentoo: cb84e11de7626097630d9bd0713f66158a8b6fca

sh bash 4.4_p12
ld GNU ld (Gentoo 2.31.1 p3) 2.31.1
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.24.3-r1::gentoo
dev-lang/python:          2.7.15::gentoo, 3.4.8-r1::gentoo, 3.5.5-r1::gentoo, 3.6.6::gentoo
dev-util/cmake:           3.12.3::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.39.2::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.13.4-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.31.1-r1::gentoo
sys-devel/gcc:            8.2.0-r4::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r6::gentoo
Repositories:

gentoo
    location: /mnt/portage/tree/official
    sync-type: git
    sync-uri: git://anongit.gentoo.org/repo/gentoo.git
    priority: -1000

Utopia_Platinia
    location: /mnt/portage/tree/overlay
    masters: gentoo
    priority: 0

crossdev
    location: /mnt/portage/tree/overlay/portage-crossdev
    masters: gentoo
    priority: 10

kde
    location: /var/lib/layman/kde
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA FraunhoferFDK dlj-1.1 skype-4.0.0.7-copyright Broadcom PUEL googleearth LOKI-EULA AdobeFlash-11.x RTCW-ETEULA ut2003 MakeMKV-EULA Q3AEULA TeamViewer RAR OPERA-2014 Nero-AAC-EULA Oracle-BCLA-JavaSE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -msse4.1"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe -msse4.1"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going --quiet-build=n"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs clean-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://mirror.isoc.org.il/gentoo/ ftp://ftp.halifax.rwth-aachen.de/gentoo/"
LANG="en_IL.US-ASCII"
LC_ALL="en_IL.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en he es"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--timeout=180"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi activities aio alsa amd64 amr audiofile avx bash-completion berkdb bidi branding bzip2 c++0x cairo cdda cdparanoia cdr cjk cleartype cli crypt css cups curl cxx dbus declarative device-mapper dga dri drm dts dv dvb dvd dvdr dvdread edb elogind emboss encode exif faad fam ffmpeg flac ftp gallium gdbm gif glamor gphoto2 gpm gtk iconv icq icu id3tag imagemagick java javascript joystick jpeg jpeg2k kde kipi kwallet lame lcms ldap libnotify libtirpc lua lzma mad matroska mng mp3 mp4 mpeg mtp multilib nas ncurses nls nptl nsplugin ogg openal openexr opengl openmp pam pango pcre pdf perl phonon php plasma png policykit ppds private-headers python qml qt5 quicktime readline real samba scanner sdl seccomp semantic-desktop smp sndfile spell srt sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 startup-notification svg tcpd theora threads tiff truetype udev udisks udisks2 unicode upower usb v4l v4l2 vaapi vdpau vorbis vpx wavpack widgets wifi wma wxwidgets x264 x265 xattr xcb xcomposite xml xosd xrandr xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon plan sheets stage words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc efi-64" INPUT_DEVICES="evdev" KERNEL="linux" L10N="he es" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AArch64 ARM AMDGPU" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="x86_64 arm aarch64" QEMU_USER_TARGETS="x86_64 arm aarch64" RUBY_TARGETS="ruby21 ruby22 ruby23" SANE_BACKENDS="hp" USERLAND="GNU" VIDEO_CARDS="v4l radeon r600 intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS

=================================================================
                        Package Settings
=================================================================

media-libs/mesa-18.2.4::gentoo was built with the following:
USE="classic dri3 egl gallium gbm gles1 gles2 llvm opencl osmesa vaapi vdpau wayland xa xvmc -d3d9 -debug -lm_sensors -pax_kernel -pic (-selinux) -test -unwind -valgrind -vulkan" ABI_X86="(64) -32 (-x32)" VIDEO_CARDS="i965 intel r600 radeon (-freedreno) -i915 (-imx) -nouveau -r100 -r200 -r300 -radeonsi (-vc4) -virgl (-vivante) -vmware"
LDFLAGS="-Wl,-O1"
Comment 1 Matt Turner gentoo-dev 2018-11-17 08:35:50 UTC
Should be fixed by

commit c36e26e11f466ec9ed250c834fbe98936b241c39
Author: Matt Turner <mattst88@gentoo.org>
Date:   Fri Nov 16 10:51:55 2018 -0800

    media-libs/mesa: Provide a python_check_deps()
    
    According to the documentation, this is required to pick the appropriate
    version of python if multiple are available.
    
    Closes: https://bugs.gentoo.org/663334
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

and 

commit 57b176c43bcebd73bd41786667d3f81894591ffe
Author: Matt Turner <mattst88@gentoo.org>
Date:   Fri Nov 16 13:11:53 2018 -0800

    media-libs/mesa: Make python_check_deps() unconditional
    
    mako is unconditionally required. Noticed by Arfrever.
    
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

If it's not, please reopen.
Comment 2 Matt Turner gentoo-dev 2018-11-17 08:40:54 UTC
In the other bug you said you tried _rc2. Try _rc3 -- it has the fixes I mention.
Comment 3 DaggyStyle 2018-11-17 15:25:30 UTC
Greetings,

this bug was reported for rc3 as it showed the same behavior of rc2.
the issue still persists.
Comment 4 DaggyStyle 2018-11-17 15:25:55 UTC
Created attachment 555464 [details]
latest build.log
Comment 5 Mart Raudsepp gentoo-dev 2018-11-17 15:58:47 UTC
Was this containing failure perhaps before the fix to remove test conditional from python_check_deps reached your rsync?
Comment 6 DaggyStyle 2018-11-17 16:29:16 UTC
(In reply to Mart Raudsepp from comment #5)
> Was this containing failure perhaps before the fix to remove test
> conditional from python_check_deps reached your rsync?

Greetings,

I use the git method, synced before the previous comment, the latest commit is cc95bfb7d0545502a35c5e644ad7061a615019d9.
latest commit to mesa folder is e2f5c8f5e51ca276a4216400fae9cf7cadd6690d
Comment 7 Arfrever Frehtes Taifersar Arahesis 2018-11-18 00:03:51 UTC
Please show:

emerge -pv dev-python/mako
python3 -c 'import mako; print(mako); print(mako.__version__); from distutils.version import StrictVersion; print(StrictVersion(mako.__version__)); print(StrictVersion(mako.__version__) > StrictVersion("0.8.0"))'
Comment 8 DaggyStyle 2018-11-18 18:02:27 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #7)
> Please show:
> 
> emerge -pv dev-python/mako
> python3 -c 'import mako; print(mako); print(mako.__version__); from
> distutils.version import StrictVersion;
> print(StrictVersion(mako.__version__));
> print(StrictVersion(mako.__version__) > StrictVersion("0.8.0"))'

dagg@NCC-5001-D ~ $ emerge -pv dev-python/mako

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ~] dev-python/mako-1.0.7::gentoo  USE="-doc -test" PYTHON_TARGETS="python2_7 python3_4 -pypy -pypy3 -python3_5 -python3_6 -python3_7" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB
dagg@NCC-5001-D ~ $ python3 -c 'import mako; print(mako); print(mako.__version__); from distutils.version import StrictVersion; print(StrictVersion(mako.__version__)); print(StrictVersion(mako.__version__) > StrictVersion("0.8.0"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'mako'
Comment 9 DaggyStyle 2018-11-18 18:13:27 UTC
looks like I need to add python3_6 as python target as my python is 3.6.x
that allows prints in the below output but it doesn't solves mesa
Comment 10 Arfrever Frehtes Taifersar Arahesis 2018-11-18 22:50:43 UTC
This problem is caused by misdesign of Meson's deprecated 'python3' module.
Its code refers to Python executable used for running Meson itself, instead of active Python version (which can be overridden by an eclass).


There are at least 3 ways of finding Python 3 in Meson:

find_program('python3', 'python')
  https://mesonbuild.com/Reference-manual.html#find_program
  Argument #2 and later positional arguments are used as fallback.
  This way does not guarantee that, if 'python' fallback is used, it would actually refer to Python 3.

import('python3').find_python()
  https://mesonbuild.com/Python-3-module.html
  https://mesonbuild.com/Python-3-module.html#find_python
  "Deprecated, replaced by find_installation function from python module."

import('python').find_installation('python3')
  https://mesonbuild.com/Python-module.html
  https://mesonbuild.com/Python-module.html#find_installation


Implementation of import('python3').find_python() is in mesonbuild/modules/python3.py:

    @noKwargs
    def find_python(self, state, args, kwargs):
        py3 = dependencies.ExternalProgram('python3', mesonlib.python_command, silent=True)
        return ModuleReturnValue(py3, [py3])


mesonlib.python_command is set in mesonbuild/mesonlib.py which contains:

if os.path.basename(sys.executable) == 'meson.exe':
    # In Windows and using the MSI installed executable.
    python_command = [sys.executable, 'runpython']
else:
    python_command = [sys.executable]


Usage of sys.executable explains problem.


Meson maintainers: You might be interested in knowing about this problem.
Although since 'python3' module is deprecated, maybe it is not worth fixing.
Comment 11 Arfrever Frehtes Taifersar Arahesis 2018-11-18 22:53:58 UTC
Created attachment 555682 [details]
Test ebuild

This test ebuild uses Python 3.5.
When Meson is run with Python 3.6, this test ebuild shows:

>>> Configuring source in /var/tmp/portage/app-misc/meson_test-0/work ...
meson --buildtype plain --libdir lib64 --localstatedir /var/lib --prefix /usr --sysconfdir /etc --wrap-mode nodownload /var/tmp/portage/app-misc/meson_test-0/work /var/tmp/portage/app-misc/meson_test-0/work/meson_test-0-build
The Meson build system
Version: 0.48.2
Source dir: /var/tmp/portage/app-misc/meson_test-0/work
Build dir: /var/tmp/portage/app-misc/meson_test-0/work/meson_test-0-build
Build type: native build
Project name: meson_test
Project version: undefined
Build machine cpu family: x86_64
Build machine cpu: x86_64
Message: 
Message: ====== find_program('python3', 'python') ======
Program python3 found: YES (/var/tmp/portage/app-misc/meson_test-0/temp/python3.5/bin/python3)
Message: path: /var/tmp/portage/app-misc/meson_test-0/temp/python3.5/bin/python3
Message: stdout: /usr/bin/python3.5
Message: stderr: WRAPPER SCRIPT: /var/tmp/portage/app-misc/meson_test-0/temp/python3.5/bin/python3
Message: 
Message: ====== import('python3').find_python() ======
Message: path: /usr/bin/python3.6
Message: stdout: /usr/bin/python3.6
Message: stderr: 
Message: 
Message: ====== import('python').find_installation('python3') ======
Message: stdout: /usr/bin/python3.5
Message: stderr: WRAPPER SCRIPT: /var/tmp/portage/app-misc/meson_test-0/temp/python3.5/bin/python3
Message: 
Build targets in project: 0
Found ninja-1.8.2.git.kitware.dyndep-1.jobserver-1 at /usr/bin/ninja
>>> Source configured.
Comment 12 Arfrever Frehtes Taifersar Arahesis 2018-11-18 23:03:15 UTC
Created attachment 555684 [details, diff]
Patch for Mesa

Suggested patch for Mesa
Comment 13 Matt Turner gentoo-dev 2018-11-21 17:26:09 UTC
Cc'ing the upstream maintainer.
Comment 14 Dylan 2018-11-21 17:58:04 UTC
Ah yes, the python3 module. That is one of the reasons we deprecated it (with my meson developer hat on)

(with my mesa hat on) I don't have a problem bumping the required meson version to 0.46, but I need to make sure that won't cause problems for other distributions first.
Comment 15 Simon 2018-12-08 12:22:01 UTC
I just emerged mesa-18.3 without a problem. Seems like we currently only have meson-0.46.1 and higher (0.47.1 is the current latest stable) in the tree.
Does this mean this issue has been fixed by those newer meson versions?
Comment 16 DaggyStyle 2018-12-08 13:44:45 UTC
not sure how I fixed it but I've decided to cleanup my python versioning, I've set the following in make.conf:
PYTHON_TARGETS="python2_7 python3_5"
PYTHON_SINGLE_TARGET="python3_5"

removed all the relevant entries in package,use and tried to fix the problems, at the end beside unkeywording of a pkg or two, all worked well including mesa.
Comment 17 Arfrever Frehtes Taifersar Arahesis 2018-12-09 00:27:00 UTC
The underlying problem is not fixed, regardless of what workaround was applied by reporter of this bug.


Dylan Baker and Matt Turner:
About https://lists.freedesktop.org/archives/mesa-dev/2018-November/210215.html :
Firstly https://github.com/mesonbuild/meson/issues/4070 will have to be fixed.
Next, Mesa could use something like that:

if meson.version().version_compare('>=0.50')
  prog_python = import('python').find_installation('python3')
else
  prog_python = import('python3').find_python()
Comment 18 Dylan 2018-12-10 17:12:28 UTC
tl;dr yes, this bug is still opened, I dropped the ball on getting the patch upstreamed.

I think that this bug manifests because you've used one version of python (say 3.5) to run meson, and a different version of python (say 3.4) has mako installed and is your primary version (aka, that's what the python3 symlink points to), and meson doesn't know how to figure this out. In the long run what we really want is a way to tell meson that I need a python3.x and that python needs to have the module mako of at least version 0.8.0. The reason that the python module (as opposed to the python3 module) doesn't have this problem is that the latter looks at sys.exectuable first (the python running meson), while the latter looks for python3 in your path first. I think that the bug could still manifest if you didn't have a python3 symlink or that symlink pointed to a version without mako.
Comment 19 Dylan 2018-12-10 22:42:06 UTC
As it turns out, the `python` module in meson doesn't have a `.path()` method like python3 does. I've submitted a series (https://github.com/mesonbuild/meson/pull/4616) to fix that, but it will not be available until the 0.50 release most likely.
Comment 20 Matt Turner gentoo-dev 2019-04-29 20:07:03 UTC
(In reply to Dylan from comment #19)
> As it turns out, the `python` module in meson doesn't have a `.path()`
> method like python3 does. I've submitted a series
> (https://github.com/mesonbuild/meson/pull/4616) to fix that, but it will not
> be available until the 0.50 release most likely.

Fixed in 0.50.0.
Comment 21 Matt Turner gentoo-dev 2019-06-17 14:40:39 UTC
I'm going to mark this as resolved. meson-0.50.1 is stable mostly everywhere.
Comment 22 Arfrever Frehtes Taifersar Arahesis 2019-06-17 18:36:55 UTC
Proper fixing of Mesa required fixing of a bug in Meson.
That bug in Meson is now fixed, but Mesa still needs to be fixed.
Comment 23 Arfrever Frehtes Taifersar Arahesis 2019-06-17 18:50:00 UTC
Created attachment 580052 [details, diff]
Patch for Mesa

Updated patch for Mesa master branch

This patch keeps support for older Meson and does not fix the problem for users of older Meson. If they are affected, then they should just update Meson. Most Gentoo users should now use Meson 0.50.1...


Dylan Baker: Could you apply this patch in upstream repository
Comment 24 Dylan 2019-06-28 19:53:25 UTC
I've applied the patch to mesa master (I did need to add an additional `endif` keyword).
Comment 26 Matt Turner gentoo-dev 2019-07-09 18:09:41 UTC
Now fixed with 19.1.2. Thanks Arfrever!