Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 680824 - media-libs/opencv-3.4.1-r5 with dev-util/cmake-3.14.0 - Found PythonInterp: /tmp/portage/media-libs/opencv-3.4.1-r5/temp/python2.7/bin/python3 (Required is at least version "3.4") CMake Error at cmake/OpenCVDetectPython.cmake:59 (if):
Summary: media-libs/opencv-3.4.1-r5 with dev-util/cmake-3.14.0 - Found PythonInterp: /...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Amy Liffey
URL:
Whiteboard:
Keywords:
: 681594 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-03-18 04:16 UTC by Georgy Yakovlev
Modified: 2019-03-27 13:18 UTC (History)
28 users (show)

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


Attachments
opencv cmake python failure (opencv-build.log,743.30 KB, text/x-log)
2019-03-18 04:16 UTC, Georgy Yakovlev
Details
0001-media-libs-opencv-fix-python-build-with-cmake-3.14.patch (0001-media-libs-opencv-fix-python-build-with-cmake-3.14.patch,1.24 KB, patch)
2019-03-26 18:50 UTC, Georgy Yakovlev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Georgy Yakovlev archtester gentoo-dev 2019-03-18 04:16:05 UTC
Created attachment 569574 [details]
opencv cmake python failure

seems cmake fails to recognize python3 as a valid one.

I've built opencv before, and caught this one while building with USE=opencl



- Found PythonLibs: /usr/lib64/libpython2.7.so (found suitable exact version "2.7.16") 
-- Found PythonInterp: /tmp/portage/media-libs/opencv-3.4.1-r5/temp/python2.7/bin/python3 (Required is at least version "3.4") 
CMake Error at cmake/OpenCVDetectPython.cmake:59 (if):
  if given arguments:

    "3" "EQUAL"

  Unknown arguments specified
Call Stack (most recent call first):
  cmake/OpenCVDetectPython.cmake:233 (find_python)
  CMakeLists.txt:556 (include)


-- Configuring incomplete, errors occurred!



Portage 2.3.62 (python 3.6.8-final-0, default/linux/amd64/17.1/no-multilib/hardened, gcc-8.3.0, glibc-2.28-r5, 5.0.1-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.0.1-gentoo-x86_64-AMD_Ryzen_Threadripper_2990WX_32-Core_Processor-with-gentoo-2.6
KiB Mem:   128446600 total, 110804276 free
KiB Swap:    8388600 total,   8388600 free
Timestamp of repository gentoo: Mon, 18 Mar 2019 03:26:35 +0000
Head commit of repository gentoo: 8b939f1e590712f5b9f8c84e0d873c9e6ec23a8d

Timestamp of repository rust: Sun, 17 Mar 2019 19:26:24 +0000
Head commit of repository rust: bc80e831bf3e82e948d2cd65979ac0aa0b204e88

sh bash 5.0_p2-r2
ld GNU ld (Gentoo 2.32 p1) 2.32.0
distcc[109544] (dcc_mkdir) ERROR: mkdir '/tmp/portage/.distcc/state' failed: No such file or directory [disabled]
app-shells/bash:          5.0_p2-r2::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.28.0::gentoo
dev-lang/python:          2.7.16::gentoo, 3.6.8::gentoo, 3.7.2::gentoo
dev-util/cmake:           3.14.0::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.17::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.32::gentoo
sys-devel/gcc:            8.3.0::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.0-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.28-r5::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/sync/gentoo.git
    priority: -1000
    sync-git-verify-commit-signature: true
    sync-git-clone-extra-opts: -b master

gyakovlev
    location: /var/db/repos/gyakovlev
    masters: gentoo

rust
    location: /var/db/repos/rust
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/rust.git
    masters: gentoo

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    priority: 10

Installed sets: @mycompress, @myfonts
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -frecord-gcc-switches"
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 -frecord-gcc-switches"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--ask-enter-invalid --jobs=32 --load-average 63 --quiet-build"
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="-march=native -O2 -pipe -frecord-gcc-switches"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg candy cgroup collision-protect compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox mount-sandbox multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned sandbox sfperms sign splitdebug strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe -frecord-gcc-switches"
GENTOO_MIRRORS="https://gentoo.osuosl.org/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0"
LINGUAS="en"
MAKEOPTS="--jobs=64 --load-average=63"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
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="/tmp"
USE="X a52 aac acl acpi activities alsa amd64 ayatana bash-completion bluetooth bluray branding bzip2 cairo crypt css cups cxx dbus dri dvd elogind exif flac fontconfig gif gpm gtk hardened iconv icu introspection ios ipv6 jpeg kde kipi kwallet libass libnotify libtirpc lm_sensors lz4 lzma lzo mp3 mp4 mtp ncurses nptl numa ogg opencl opengl openmp pam pcre pdf phonon pie plasma png policykit qml qt5 readline seccomp semantic-desktop ssl ssp startup-notification svg tiff truetype udev udisks unicode usb vaapi vdpau vim-syntax vorbis vulkan wayland webp widgets x264 x265 xattr xcb xcomposite xinerama xml xscreensaver xtpax zlib zsh-completion" 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 sheets words" CAMERAS="ptp2 fuji" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a 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="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6 python3_7" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu radeon radeonsi" 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, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

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

media-libs/opencv-3.4.1-r5::gentoo was built with the following:
USE="eigen gtk jpeg opengl openmp png python qt5 tiff vaapi webp -contrib -contrib_cvv -contrib_dnn -contrib_hdf -contrib_sfm -contrib_xfeatures2d -cuda -debug -dnn_samples -examples -ffmpeg -gdal -gflags -glog -gphoto2 -gstreamer -ieee1394 -java -jpeg2k -lapack -libav -opencl -openexr (-pch) -tesseract -testprograms -threads -v4l -vtk -xine" CPU_FLAGS_X86="avx avx2 fma3 popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" PYTHON_TARGETS="python2_7 python3_6 -python3_4 -python3_5"
Comment 1 Georgy Yakovlev archtester gentoo-dev 2019-03-18 04:30:22 UTC
quickly glancing at logs it looks like it comes from cmake/OpenCVDetectPython.cmake:225 (find_python)
Comment 2 Pistos 2019-03-21 21:18:39 UTC
Same problem for me.  Build log and emerge info at https://bpaste.net/show/dbb9426ff951 .  However, I do have another Gentoo system where the exact same version build successfully.  Not sure what's wrong.
Comment 3 Georgy Yakovlev archtester gentoo-dev 2019-03-21 23:09:46 UTC
(In reply to Pistos from comment #2)
> Same problem for me.  Build log and emerge info at
> https://bpaste.net/show/dbb9426ff951 .  However, I do have another Gentoo
> system where the exact same version build successfully.  Not sure what's
> wrong.

can you check if you have opencl-related packages installed and useflag enabled on that other system?
I've started seeing this problem after I globally enabled opencl useflag and got related packages installed.
I haven't had any time to find the source of the problem yet.
Comment 4 josef.95 2019-03-22 00:17:09 UTC
Same issue here with installed =dev-util/cmake-3.14.0
With =cmake-3.13.4 builds opencv-3.4.1-r5 here successfully.
Comment 5 Georgy Yakovlev archtester gentoo-dev 2019-03-22 01:33:50 UTC
so it blows up on 

if(${_preferred_version_major} EQUAL ${PYTHON_VERSION_MAJOR})


basically PYTHON_VERSION_MAJOR is passed as empty.

it's derived from CMake's FindPythonInterp() which was modified in 3.14


https://github.com/Kitware/CMake/commit/08dee696b5831a8cba0a70df5e6b072f91d0c6f8#diff-9646870e455c818224d924fdec5d174a


FindPythonInterp: Do not assume any version if test script fails

The Python version is retrieved by executing a small python script. If,
for any reason, script fails to execute, leave the `PYTHON_VERSION_*`
variables undefined instead of assuming version 1.4.



it tries to run 

python -c "try: import sys; sys.stdout.write(sys.version)\nexcept: sys.stdout.write(\"1.4.0\")"



so something happens here and PYTHON_VERSION_MAJOR ends up empty and passed to if which blows up.
Comment 6 Georgy Yakovlev archtester gentoo-dev 2019-03-22 01:41:33 UTC
minimal cmake file is

CMakeLists.txt 
cmake_minimum_required(VERSION 3.14)
execute_process(COMMAND "python" -c "try: import sys; sys.stdout.write(sys.version)\nexcept: sys.stdout.write(\"1.4.0\")")


but it works fine.

cmake .
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
3.6.8 (default, Mar  4 2019, 13:11:46) 
[GCC 8.3.0]-- Configuring done
-- Generating done
-- Build files have been written to: /home/ya/ctest



I'll trace actual build process later to see what is actually outputs.
Comment 7 Georgy Yakovlev archtester gentoo-dev 2019-03-22 02:42:23 UTC
continuing

so for python3 it tries to run

/usr/share/cmake/Modules/FindPythonInterp.cmake(141):  execute_process(COMMAND /tmp/portage/media-libs/opencv-3.4.1-r5/temp/python2.7/bin/python3 -c try: import sys; sys.stdout.write(sys.version)
except: sys.stdout.write("1.4.0") OUTPUT_VARIABLE _VERSION RESULT_VARIABLE _PYTHON_VERSION_RESULT ERROR_QUIET )
/usr/share/cmake/Modules/FindPythonInterp.cmake(145):  if(NOT _PYTHON_VERSION_RESULT )
/usr/share/cmake/Modules/FindPythonInterp.cmake(154):  else()
/usr/share/cmake/Modules/FindPythonInterp.cmake(155):  unset(PYTHON_VERSION_STRING )
/usr/share/cmake/Modules/FindPythonInterp.cmake(156):  unset(PYTHON_VERSION_MAJOR )
/usr/share/cmake/Modules/FindPythonInterp.cmake(157):  unset(PYTHON_VERSION_MINOR )
/usr/share/cmake/Modules/FindPythonInterp.cmake(158):  unset(PYTHON_VERSION_PATCH )
/usr/share/cmake/Modules/FindPythonInterp.cmake(161):  unset(_PYTHON_VERSION_RESULT )
/usr/share/cmake/Modules/FindPythonInterp.cmake(162):  unset(_VERSION )


and the reason it fails is because of hack in the ebuild:

# cheap trick: python_setup sets one of them as a symlink
                # to the correct interpreter, and the other to fail-wrapper
                -DPYTHON2_EXECUTABLE=$(type -P python2)
                -DPYTHON3_EXECUTABLE=$(type -P python3)

-DPYTHON2_EXECUTABLE=/tmp/portage/media-libs/opencv-3.4.1-r5/temp/python2.7/bin/python2 
-DPYTHON3_EXECUTABLE=/tmp/portage/media-libs/opencv-3.4.1-r5/temp/python2.7/bin/python3

/tmp/portage/media-libs/opencv-3.4.1-r5/temp/python2.7/bin/python3
: python_wrapper_setup: python3 is not supported by python2.7 (PYTHON_COMPAT)

with following contents

#!/bin/sh
echo ": python_wrapper_setup: python3 is not supported by python2.7 (PYTHON_COMPAT)" >&2
exit 127



OpenCVDetectPython.cmake tries to run python3 wrapper while building for python2 in, but above wrapper created by eclass func python_wrapper_setup() exits and cmake no longer sets PYTHON_VERSION_MAJOR



now need to figure out how to fix this mess without breaking python =)
Comment 8 Georgy Yakovlev archtester gentoo-dev 2019-03-22 03:19:21 UTC
instead of passing

-DPYTHON2_EXECUTABLE=$(type -P python2)
-DPYTHON3_EXECUTABLE=$(type -P python3)

it's possible to pass

-DPYTHON_DEFAULT_EXECUTABLE="$(type -P ${EPYTHON%.*})"

or even simple

-DPYTHON_DEFAULT_EXECUTABLE="${EPYTHON%.*}"


or even

-DPYTHON_DEFAULT_EXECUTABLE=python

because

type -P python
/tmp/portage/media-libs/opencv-3.4.1-r5/temp/python3.6/bin/python

PATH /tmp/portage/media-libs/opencv-3.4.1-r5/temp/python3.6/bin:/usr/lib/portage/python3.6/ebuild-helpers/xattr:/usr/lib/portage/python3.6/ebuild-helpers:/usr/lib/llvm/8/bin:/usr/lib/llvm/7/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin

cat /tmp/portage/media-libs/opencv-3.4.1-r5/temp/python3.6/bin/python
#!/bin/sh
exec "/usr/bin/python3.6" "${@}"



this will stop cmake module from guessing python and just accept given implementation at current ebuild phase.

if(PYTHON_DEFAULT_EXECUTABLE)
    set(PYTHON_DEFAULT_AVAILABLE "TRUE") < - this branch is selected

elseif(PYTHON2INTERP_FOUND) # Use Python 2 as default Python interpreter
    set(PYTHON_DEFAULT_AVAILABLE "TRUE")
    set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON2_EXECUTABLE}")
elseif(PYTHON3INTERP_FOUND) # Use Python 3 as fallback Python interpreter (if there is no Python 2)
    set(PYTHON_DEFAULT_AVAILABLE "TRUE")
    set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON3_EXECUTABLE}")
endif()



since PATH is mangled by python eclasses ebuild will find a correct wrapper for current implementation and will use that for build, it prepends correct path for current python implementation.


I haven't tested it for multiple python3 implementations, but I guess it should work.
Comment 9 John Bowler 2019-03-23 21:28:03 UTC
(In reply to Georgy Yakovlev from comment #8)
> instead of passing
> 
> -DPYTHON2_EXECUTABLE=$(type -P python2)
> -DPYTHON3_EXECUTABLE=$(type -P python3)

Why do those lines even need to be in the ebuild?  Everything works just fine if they are removed (and nothing else added) and simply adding:

  -DPYTHON_DEFAULT_EXECUTABLE=python

is not sufficient; the magic is deleting the both the PYTHON2 and PYTHON3 lines.  Just deleting the PYTHON3 line ends up with this:

-- Found PythonInterp: /var/tmp/portage/media-libs/opencv-3.4.1-r5/temp/python3.6/bin/python2 (Required is at least version "2.7") 
CMake Error at cmake/OpenCVDetectPython.cmake:59 (if):
  if given arguments:

    "2" "EQUAL"

I don't understand why this ever worked; apparently both supported python versions have to be there, working, in order to get the major version numbers and that only happens if the -DPYTHON[23]_EXECUTABLE does not point to the "fail" wrapper, but at some point this wasn't required (with the current 3.4.1-r5 ebuild).
Comment 10 Greg Turner 2019-03-23 22:38:22 UTC
(In reply to John Bowler from comment #9)
> (In reply to Georgy Yakovlev from comment #8)
> > instead of passing
> > 
> > -DPYTHON2_EXECUTABLE=$(type -P python2)
> > -DPYTHON3_EXECUTABLE=$(type -P python3)
> 
> Why do those lines even need to be in the ebuild?

W4M:

spenciver /usr # diff -up {portage,overlay/gmt}/media-libs/opencv/opencv-3.4.1-r5.ebuild
--- portage/media-libs/opencv/opencv-3.4.1-r5.ebuild    2019-01-24 01:39:29.000000000 -0800
+++ overlay/gmt/media-libs/opencv/opencv-3.4.1-r5.ebuild        2019-03-23 15:23:00.792356668 -0700
@@ -474,8 +474,6 @@ python_module_compile() {
        mycmakeargs+=(
                # cheap trick: python_setup sets one of them as a symlink
                # to the correct interpreter, and the other to fail-wrapper
-               -DPYTHON2_EXECUTABLE=$(type -P python2)
-               -DPYTHON3_EXECUTABLE=$(type -P python3)
                -DINSTALL_PYTHON_EXAMPLES=$(usex examples)
                -DLIBPY_SUFFIX=64
        )
spenciver /usr # ebuild overlay/gmt/media-libs/opencv/opencv-3.4.1-r5.ebuild clean install >/dev/null || echo nope
spenciver /usr # egrep '^--[[:space:]]*Python|^[[:space:]]\*[[:space:]][a-zF].*:' /var/tmp/portage/media-libs/opencv-3.4.1-r5/temp/build.log
 * FEATURES:   compressdebug installsources network-sandbox preserve-libs sandbox splitdebug userpriv usersandbox
 * FEATURES:   compressdebug installsources network-sandbox preserve-libs sandbox splitdebug userpriv usersandbox
 * abi_x86_64.amd64: running multilib-minimal_abi_src_configure
--   Python (for build):            NO
 * abi_x86_64.amd64: running multilib-minimal_abi_src_compile
 * abi_x86_64.amd64: running multilib-minimal_abi_src_install
 * python2_7: running python_module_compile
--   Python 2:
--   Python (for build):            /var/tmp/portage/media-libs/opencv-3.4.1-r5/temp/python2.7/bin/python
 * python3_6: running python_module_compile
--   Python 3:
--   Python (for build):            /var/tmp/portage/media-libs/opencv-3.4.1-r5/temp/python3.6/bin/python
 * Final size of build directory: 886232 KiB (865.4 MiB)
 * Final size of installed tree:  265588 KiB (259.3 MiB)
spenciver /usr #
Comment 11 Dennis Schridde 2019-03-24 08:36:06 UTC
Could you please adjust the summary to contain the error message?  There is already a duplicate: bug #681594
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2019-03-24 12:45:02 UTC
*** Bug 681594 has been marked as a duplicate of this bug. ***
Comment 13 Amel Hodzic 2019-03-25 02:11:43 UTC
Yeah, not sure how that "python3" executable is created within the python2.7/bin subdir.  For what it's worth, it's not specific to the "opencl" USE flag, as I don't have that flag enabled; yet I, too, experience this issue.

I don't think this is due to changes in the media-libs/opencv package, by the way.  I have successfully built this package before without problems.  I do recall a large number of python packages being updated recently.  I wonder if this issue is related to that.

[21:04][2078]# lsl /var/tmp/portage/media-libs/opencv-3.4.1-r100/temp/python2.7/bin/
total 24K
lrwxrwxrwx. 1 root  17 Mar 24 20:49 2to3 -> /usr/bin/2to3-2.7
-rwxr-xr-x. 1 root  43 Mar 24 20:49 python
-rwxr-xr-x. 1 root  43 Mar 24 20:49 python2
-rwxr-xr-x. 1 root  50 Mar 24 20:49 python2-config
-rwxr-xr-x. 1 root 108 Mar 24 20:49 python3
-rwxr-xr-x. 1 root 115 Mar 24 20:49 python3-config
-rwxr-xr-x. 1 root  50 Mar 24 20:49 python-config

[21:04][2079]# /var/tmp/portage/media-libs/opencv-3.4.1-r100/temp/python2.7/bin/python3 --version                                                                                                                                             
: python_wrapper_setup: python3 is not supported by python2.7 (PYTHON_COMPAT)

[21:04][2080]# /var/tmp/portage/media-libs/opencv-3.4.1-r100/temp/python2.7/bin/python2 --version
Python 2.7.16

[21:04][2081]# python2 --version
Python 2.7.16
Comment 14 Amel Hodzic 2019-03-25 02:13:47 UTC
Note, the same issue holds for the media-libs/opencv-3.4.1-r5 version from the gentoo repos as for my media-libs/opencv-3.4.1-r100; in case someone decides to point out the difference in my previous output.
Comment 15 Ștefan Talpalaru 2019-03-26 01:03:07 UTC
(In reply to Greg Turner from comment #10)

> spenciver /usr # diff -up
> {portage,overlay/gmt}/media-libs/opencv/opencv-3.4.1-r5.ebuild
> --- portage/media-libs/opencv/opencv-3.4.1-r5.ebuild    2019-01-24
> 01:39:29.000000000 -0800
> +++ overlay/gmt/media-libs/opencv/opencv-3.4.1-r5.ebuild        2019-03-23
> 15:23:00.792356668 -0700
> @@ -474,8 +474,6 @@ python_module_compile() {
>         mycmakeargs+=(
>                 # cheap trick: python_setup sets one of them as a symlink
>                 # to the correct interpreter, and the other to fail-wrapper
> -               -DPYTHON2_EXECUTABLE=$(type -P python2)
> -               -DPYTHON3_EXECUTABLE=$(type -P python3)
>                 -DINSTALL_PYTHON_EXAMPLES=$(usex examples)
>                 -DLIBPY_SUFFIX=64
>         )

This also works for me. A patched opencv-3.4.1-r6 is available in my overlay: https://github.com/stefantalpalaru/gentoo-overlay
Comment 16 Amel Hodzic 2019-03-26 16:47:09 UTC
Works for me, too.
Comment 17 Georgy Yakovlev archtester gentoo-dev 2019-03-26 18:50:36 UTC
Created attachment 570892 [details, diff]
0001-media-libs-opencv-fix-python-build-with-cmake-3.14.patch
Comment 18 Larry the Git Cow gentoo-dev 2019-03-26 20:47:25 UTC
The bug has been closed via the following commit(s):

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

commit a232a9da5922f62dfb73eba78b360bc5eb2e8a19
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2019-03-26 18:49:25 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2019-03-26 20:46:53 +0000

    media-libs/opencv: fix python build with cmake 3.14
    
    Closes: https://bugs.gentoo.org/680824
    Package-Manager: Portage-2.3.62, Repoman-2.3.12
    Acked-by: Amy Liffey <amynka@gentoo.org>
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 media-libs/opencv/opencv-3.4.1-r5.ebuild | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)