Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 656638 - media-libs/opencv-3.4.1 build failed with message "Configuring incomplete, errors occurred!"
Summary: media-libs/opencv-3.4.1 build failed with message "Configuring incomplete, er...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Amy Liffey
URL:
Whiteboard:
Keywords:
: 659012 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-05-27 09:36 UTC by email200202
Modified: 2018-08-18 06:14 UTC (History)
10 users (show)

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


Attachments
emerge --info '=media-libs/opencv-3.4.1::gentoo' (file_656638.txt,6.60 KB, text/plain)
2018-05-27 09:36 UTC, email200202
Details
emerge -pqv '=media-libs/opencv-3.4.1::gentoo' (file_656638.txt,881 bytes, text/plain)
2018-05-27 09:39 UTC, email200202
Details
/var/tmp/portage/media-libs/opencv-3.4.1/temp/build.log (file_656638.txt,30.00 KB, text/plain)
2018-05-27 09:42 UTC, email200202
Details
/var/tmp/portage/media-libs/opencv-3.4.1/temp/environment (environment,263.83 KB, text/plain)
2018-05-27 09:46 UTC, email200202
Details
/var/tmp/portage/media-libs/opencv-3.4.1-r1/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeError.log (CMakeError.log.bz2,3.05 KB, application/x-bzip)
2018-05-31 18:41 UTC, Michael Baer
Details
/var/tmp/portage/media-libs/opencv-3.4.1-r1/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeOutput.log (CMakeOutput.log.bz2,8.22 KB, application/x-bzip)
2018-05-31 18:42 UTC, Michael Baer
Details
Build logs on FX-8350 (opencv_3.4.1-r2.tbz2,59.52 KB, application/x-bzip-compressed-tar)
2018-06-02 20:31 UTC, Luke A. Guest
Details
/var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeOutput.log (CMakeOutput.log,150.21 KB, text/x-log)
2018-06-11 12:16 UTC, Juergen Rose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description email200202 2018-05-27 09:36:12 UTC
Created attachment 533490 [details]
emerge --info '=media-libs/opencv-3.4.1::gentoo'

media-libs/opencv-3.4.1 build failed with the following messages:

-- <<< Gentoo configuration >>>
Build type      Gentoo
Install path    /usr
Compiler flags:
C               -O2 -pipe -march=nehalem -mno-popcnt   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mfpmath=sse -fvisibility=hidden -fopenmp
C++             -O2 -pipe -march=nehalem -mno-popcnt   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mfpmath=sse -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed  -Wl,--gc-sections
Module          -Wl,-O1 -Wl,--as-needed
Shared          -Wl,-O1 -Wl,--as-needed 

-- Configuring incomplete, errors occurred!
See also "/var/tmp/portage/media-libs/opencv-3.4.1/work/opencv-3.4.1-abi_x86_32.x86/CMakeFiles/CMakeOutput.log".
See also "/var/tmp/portage/media-libs/opencv-3.4.1/work/opencv-3.4.1-abi_x86_32.x86/CMakeFiles/CMakeError.log".
 * ERROR: media-libs/opencv-3.4.1::gentoo failed (configure phase):
 *   cmake failed
 * 
 * Call stack:
 *     ebuild.sh, line  124:  Called src_configure
 *   environment, line 6544:  Called cmake-multilib_src_configure
 *   environment, line 1215:  Called multilib-minimal_src_configure
 *   environment, line 4815:  Called multilib_foreach_abi 'multilib-minimal_abi_src_configure'
 *   environment, line 5029:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *   environment, line 4745:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *   environment, line 4743:  Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_configure'
 *   environment, line  766:  Called multilib-minimal_abi_src_configure
 *   environment, line 4809:  Called multilib_src_configure
 *   environment, line 5256:  Called cmake-utils_src_configure
 *   environment, line 1390:  Called die
 * The specific snippet of code:
 *       "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed";
Comment 1 email200202 2018-05-27 09:39:47 UTC
Created attachment 533492 [details]
emerge -pqv '=media-libs/opencv-3.4.1::gentoo'
Comment 2 email200202 2018-05-27 09:42:02 UTC
Created attachment 533494 [details]
/var/tmp/portage/media-libs/opencv-3.4.1/temp/build.log
Comment 3 email200202 2018-05-27 09:46:08 UTC
Created attachment 533496 [details]
/var/tmp/portage/media-libs/opencv-3.4.1/temp/environment
Comment 4 Johannes Hirte 2018-05-27 14:28:37 UTC
Error is above in the log:

-- Performing Test HAVE_CXX_MSSE4_1 - Success
CMake Error at cmake/OpenCVCompilerOptimizations.cmake:449 (message):
  Required baseline optimization is not supported: SSE4_2
  (CPU_BASELINE_REQUIRE=;SSE;SSE2;SSE3;SSE4_1;SSE4_2)
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:235 (include)
  CMakeLists.txt:559 (include)


-- Dispatch optimization OFF is not available, skipped



can confirm this here with similar error:

-- Performing Test HAVE_CXX_MSSE4_1 - Success
CMake Error at cmake/OpenCVCompilerOptimizations.cmake:449 (message):
  Required baseline optimization is not supported: SSE4_2
  (CPU_BASELINE_REQUIRE=;SSE;SSE2;SSE3;SSE4_1;SSE4_2;AVX;AVX2;FMA3)
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:235 (include)
  CMakeLists.txt:559 (include)


CMake Error at cmake/OpenCVCompilerOptimizations.cmake:449 (message):
  Required baseline optimization is not supported: AVX
  (CPU_BASELINE_REQUIRE=;SSE;SSE2;SSE3;SSE4_1;SSE4_2;AVX;AVX2;FMA3)
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:235 (include)
  CMakeLists.txt:559 (include)


CMake Error at cmake/OpenCVCompilerOptimizations.cmake:449 (message):
  Required baseline optimization is not supported: AVX2
  (CPU_BASELINE_REQUIRE=;SSE;SSE2;SSE3;SSE4_1;SSE4_2;AVX;AVX2;FMA3)
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:235 (include)
  CMakeLists.txt:559 (include)


CMake Error at cmake/OpenCVCompilerOptimizations.cmake:449 (message):
  Required baseline optimization is not supported: FMA3
  (CPU_BASELINE_REQUIRE=;SSE;SSE2;SSE3;SSE4_1;SSE4_2;AVX;AVX2;FMA3)
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:235 (include)
  CMakeLists.txt:559 (include)


-- Dispatch optimization OFF is not available, skipped
Comment 5 Hector Martin 2018-05-30 17:31:53 UTC
Same issue with media-libs/opencv-3.4.1-r1.

CMake Error at cmake/OpenCVCompilerOptimizations.cmake:449 (message):
  Required baseline optimization is not supported: SSE4_2
  (CPU_BASELINE_REQUIRE=;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;AVX)
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:235 (include)
  CMakeLists.txt:559 (include)


CMake Error at cmake/OpenCVCompilerOptimizations.cmake:449 (message):
  Required baseline optimization is not supported: AVX
  (CPU_BASELINE_REQUIRE=;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;AVX)
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:235 (include)
  CMakeLists.txt:559 (include)

This is building on a Threadripper with:
CFLAGS="-march=ivybridge -O2 -pipe"
CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 avx sse4_1 sse4_2"
Comment 6 email200202 2018-05-31 01:55:26 UTC
media-libs/opencv-3.4.1-r1 build failed.
Comment 7 Amy Liffey gentoo-dev 2018-05-31 13:31:22 UTC
Hello all,

can you please attach these following logs? [1][2]


Thank you 

[1] /var/tmp/portage/media-libs/opencv-3.4.1/work/opencv-3.4.1-abi_x86_32.x86/CMakeFiles/CMakeOutput.log

[2] /var/tmp/portage/media-libs/opencv-3.4.1/work/opencv-3.4.1-abi_x86_32.x86/CMakeFiles/CMakeError.log
Comment 8 Michael Baer 2018-05-31 16:16:02 UTC
Same problem here with AMD FX-8350 CPU.

Checking the cpu flags showed:
CPU_FLAGS_X86="avx popcnt sse sse2 sse4_1 sse4_2 ssse3"
Looks good.

Comparing the ebuild form 3.3 and 3.4 showed a lot of changes, especially for the CPU flags.

Some of the cpu flags in IUSE are not supported by my CPU.

Next step, I removed the unsupported flags from IUSE in ebuild: 
cpu_flags_x86_sse3
cpu_flags_x86_avx2 
cpu_flags_x86_fma3

and removed also:
-DENABLE_SSE3=$(usex cpu_flags_x86_sse3)
-DENABLE_AVX2=$(usex cpu_flags_x86_avx2)
-DENABLE_FMA3=$(usex cpu_flags_x86_fma3)


Copied the "adjusted" ebuild to my overlay directory and installed opencv successfully with this ebuild.

I don't know how to verify if opencv is working correctly and I'm not sure, if removing the flags causes some problems.
Comment 9 Amy Liffey gentoo-dev 2018-05-31 17:44:39 UTC
(In reply to Michael Baer from comment #8)
> Same problem here with AMD FX-8350 CPU.
> 
> Checking the cpu flags showed:
> CPU_FLAGS_X86="avx popcnt sse sse2 sse4_1 sse4_2 ssse3"
> Looks good.
> 
> Comparing the ebuild form 3.3 and 3.4 showed a lot of changes, especially
> for the CPU flags.
> 
> Some of the cpu flags in IUSE are not supported by my CPU.
> 
> Next step, I removed the unsupported flags from IUSE in ebuild: 
> cpu_flags_x86_sse3
> cpu_flags_x86_avx2 
> cpu_flags_x86_fma3
> 
> and removed also:
> -DENABLE_SSE3=$(usex cpu_flags_x86_sse3)
> -DENABLE_AVX2=$(usex cpu_flags_x86_avx2)
> -DENABLE_FMA3=$(usex cpu_flags_x86_fma3)
> 
> 
> Copied the "adjusted" ebuild to my overlay directory and installed opencv
> successfully with this ebuild.
> 
> I don't know how to verify if opencv is working correctly and I'm not sure,
> if removing the flags causes some problems.

Could you submit those logs I asked in previous comments?
Comment 10 Hector Martin 2018-05-31 18:03:15 UTC
I think I figured out the problem. Adding "popcnt" to CPU_FLAGS_X86 fixed it.

Looks like the problem is caused by having the sse4_2 feature without popcnt. According to OpenCV, sse4_2 implies popcnt:

ocv_update(CPU_SSE4_2_IMPLIES "SSE4_1;POPCNT")

And indeed my CPU supports popcnt. So it looks like OpenCV just really doesn't like it when you give it a CPU flags combination that is "impossible" in the sense that some features are not listed that should be implied by others. I guess it goes "you don't have popcnt, you must not have sse4_2" and then bails when you actually asked it to use sse4_2.

Maybe this should be fixed at a higher level? Looks like this would be a useful feature higher up in an eclass or similar, e.g. automatically imply dependencies, or complain when you're missing flags.
Comment 11 Hector Martin 2018-05-31 18:06:47 UTC
@Michael Baer try adding all the older features your CPU supports but which aren't listed in your current CPU_FLAGS_X86, e.g.

CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 sse4_1 popcnt sse4_2 avx"
Comment 12 Hector Martin 2018-05-31 18:14:53 UTC
I think this warrants REQUIRED_USE constraints encoding the same dependencies that OpenCV expects, to force users to enable any missing flags.

Something like this:

REQUIRED_USE="
cpu_flags_x86_avx2 ? ( cpu_flags_x86_avx cpu_flags_x86_fma3 )
cpu_flags_x86_fma3 ? ( cpu_flags_x86_avx2 )
cpu_flags_x86_avx ? ( cpu_flags_x86_sse4_2 )
cpu_flags_x86_sse4_2 ? ( cpu_flags_x86_sse4_1 cpu_flags_x86_popcnt )
cpu_flags_x86_popcnt ? ( cpu_flags_x86_sse4_1 )
cpu_flags_x86_sse4_1 ? ( cpu_flags_x86_sse3 cpu_flags_x86_ssse3 )
cpu_flags_x86_ssse3 ? ( cpu_flags_x86_sse3 )
cpu_flags_x86_sse3 ? ( cpu_flags_x86_sse2 )
cpu_flags_x86_sse2 ? ( cpu_flags_x86_sse )
"
Comment 13 Amy Liffey gentoo-dev 2018-05-31 18:37:45 UTC
Could you please submit those logs so I can recheck?
Comment 14 Michael Baer 2018-05-31 18:41:39 UTC
Created attachment 534318 [details]
/var/tmp/portage/media-libs/opencv-3.4.1-r1/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeError.log
Comment 15 Michael Baer 2018-05-31 18:42:08 UTC
Created attachment 534320 [details]
/var/tmp/portage/media-libs/opencv-3.4.1-r1/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeOutput.log
Comment 16 Michael Baer 2018-05-31 18:44:51 UTC
@Hector Martin
Thanks for the hint! Was a bug in my /etc/portage directory (never set CPU_FLAGS_X86 twice without appending the old string).

@Amy Liffey
Log from 3.4.1-r1, but had the same problems with 3.4.1, and AMD64 instead of X86.
Comment 17 email200202 2018-06-01 06:18:18 UTC
@Hector Martin, I have gentoo installed on a virtualbox guest. The host supports popcnt and sse4_2 but virtualbox propagates sse4_2 only. I think it is a bug in virtualbox.

Here is the host cpu flags:
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm pti tpr_shadow vnmi flexpriority ept vpid dtherm ida

And the virtualbox guest:
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni ssse3 sse4_1 sse4_2 hypervisor lahf_lm pti

My point is you could have sse4_2 but not popcnt.
Comment 18 Emilian Huminiuc 2018-06-01 07:21:31 UTC
Maybe the ebuild should set:

-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON

instead? Since their checks are somewhat too strict in certrain cases (e.g. FMA3 implies AVX2, but there are AMD CPUs -Piledriver- out there with FMA3 support but without AVX2)
Comment 19 Luke A. Guest 2018-06-02 20:31:03 UTC
I have something similar, except it's saying I don't have FMA3 on Bulldozer (FX-8350) which I know does have it.

See my logs.
Comment 20 Luke A. Guest 2018-06-02 20:31:53 UTC
Created attachment 534590 [details]
Build logs on FX-8350
Comment 21 Ștefan Talpalaru 2018-06-05 10:17:13 UTC
Same FMA3 detection failure with opencv-3.4.1-r2 on a Piledriver (FX-8320E):

* USE:        abi_x86_64 amd64 cpu_flags_x86_avx cpu_flags_x86_fma3 cpu_flags_x86_popcnt cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_ssse3 eigen elibc_glibc ffmpeg gtk jpeg kernel_linux lapack opencl openexr openmp pch png python python_targets_python2_7 qt5 threads tiff userland_GNU v4l vaapi webp

[...]

-- WARNING: Option ENABLE_FMA3='yes' is deprecated and should not be used anymore
--          Behaviour of this option is not backward compatible
--          Refer to 'CPU_BASELINE'/'CPU_DISPATCH' CMake options documentation

[...]

CMake Error at cmake/OpenCVCompilerOptimizations.cmake:449 (message):
  Required baseline optimization is not supported: FMA3
  (CPU_BASELINE_REQUIRE=;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FMA3)
Comment 22 Juergen Rose 2018-06-11 12:13:46 UTC
I have a similar error on a Phenom(tm) II X6 1090T. My cpu flags are:
root@caiman:/root(32)# cpuid2cpuflags 
CPU_FLAGS_X86: 3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a

And I set the same in /etc/make.confroot@caiman:/root(35)# grep CPU  /etc/make.conf

CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a"                   

'MAKEOPTS=-j1 emerge -pv1 opencv' fails with:

root@caiman:/root(38)# MAKEOPTS=-j1 emerge -v1 opencv
...
C++             -march=amdfam10 -O2 -pipe   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed  -Wl,--gc-sections
Module          -Wl,-O1 -Wl,--as-needed
Shared          -Wl,-O1 -Wl,--as-needed 

-- Configuring incomplete, errors occurred!
See also "/var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeOutput.log".
See also "/var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeError.log".
 * ERROR: media-libs/opencv-3.4.1-r2::gentoo failed (configure phase):
...
GENTOO_VM=icedtea-bin-8  CLASSPATH="" JAVA_HOME="/opt/icedtea-bin-3.8.0"
JAVACFLAGS="-source 1.6 -target 1.6" COMPILER=""




Portage 2.3.40 (python 3.5.5-final-0, default/linux/amd64/17.0, gcc-7.3.0, glibc-2.27-r3, 4.17.0-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.17.0-gentoo-x86_64-AMD_Phenom-tm-_II_X6_1090T_Processor-with-gentoo-2.6
KiB Mem:    16168252 total,   2938556 free
KiB Swap:  100663280 total, 100657892 free
Timestamp of repository gentoo: Mon, 11 Jun 2018 09:30:01 +0000
Head commit of repository gentoo: 13a050713e202c0bc8fa7bbf5a80cca070ad4af8
sh bash 4.4_p23
ld GNU ld (Gentoo 2.30 p2) 2.30.0
app-shells/bash:          4.4_p23::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.14-r2::gentoo, 3.5.5-r1::gentoo, 3.6.5-r1::gentoo
dev-util/cmake:           3.11.3::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6::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.30-r2::gentoo
sys-devel/gcc:            7.3.0-r3::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.16-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r3::gentoo
Repositories:

gentoo
    location: /usr/portage_caiman
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 0

g-cpan
    location: /var/lib/cpan
    masters: gentoo
    priority: 1

g-octave
    location: /var/lib/g-octave
    masters: gentoo
    priority: 2

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

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

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA PUEL Intel-SDP dlj-1.1 skype-eula skype-4.0.0.7-copyright googleearth AdobeFlash-11.x cadsoft Oracle-BCLA-JavaSE MakeMKV-EULA NVIDIA-CUDA Nero-AAC-EULA GIMPS"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=amdfam10 -O2 -pipe"
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/php/apache2-php7.2/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cli-php7.2/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=amdfam10 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY 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 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 userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de en fr ru"
MAKEOPTS="-j7"
PKGDIR="/usr/portage/packages"
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="/var/tmp"
USE="3dnow 3dnowext 64bit R X Xaw3d a52 aac acl acpi admin afs alsa amd64 amr ao apache2 apng applet archive armadillo arpack asf aspell assistant atlas audiofile automap automount barcode bash-completion berkdb blas blast bluetooth bluray boost btrfs bzip2 cairo cdda cddb cdf cdio cdparanoia cdr cgi chm cilk clang cli cmake collada contrib crypt css cups curl cxx daap db dbi dbm dbus declarative designer devhelp device-mapper dga dia digitalradio djvu doc dot dri ds2490 ds9097 ds9097u dts dv dvb dvd dvdr dvi dynamicplugin eds egl elf emacs emboss emf encode epiphany evdev evo examples excel exif expat extensions extra extras faac faad fam ffmpeg fftw firefox fits flac fltk fontconfig foomaticdb fortran fortran95 fpm fpx ftp fuse gcj gd gdal gdbm gedit geoip geolocation geos gfortran gif gimp git glade glamor glib glpk gml gmp gnome gnome-keyring gnuplot gnutls gold gphoto2 gpm grammar graphics graphtft graphviz grass gsl gsm gstreamer gtk gtk3 gudev guile hddtemp hdf hdf5 hdri html http httpd hvm hwdb iconv icq icu id3tag ide imagemagick imap inotify introspection ipod ipv6 irda ithreads jadetex java jbig jit john jpeg jpeg2k kate kdepim kdrive kerberos keymap kpathsea kvm ladspa lame lapack latex lcms ldap lensfun libffi libgda libkms libnotify libsamplerate libtirpc live lm_sensors lua lzma lzo mad mail maildir mapnik math matroska media-library mercurial mikmod mng mod modules mono motif mozilla mp3 mp4 mpeg mpi mpi-threads mplayer mtp multilib multimedia musepack musicbrainz mysql mysqli nautilus ncurses netcdf netpbm network networking nfs nls nntp nptl nsplugin ntfs ntp numpy obex objc ocaml ocr octave odbc ofa ogdi ogg opencl opencv openexr opengl openmp openvg pam pango pcre pda pdf pdl2 perl plasma plotutils plugins png podcast policykit portaudio posix postgres postscript ppds ppp preview-latex proj projectm pstricks pulseaudio python q16 q32 qemu qhull qml qt5 quicktime raw readline reiserfs reports rle romio rpc rrdcgi rrdtool sage samba sasl schroedinger science sdk sdl seccomp secure-delete server session shout sip slang slp smart smbclient smp sms sndfile snmp soap sockets sound soup sox speex spell sql sqlite ssl stlport subtitles subversion sudo suexec svg svm swig systemd szip t1lib tbb tcl tcpd tex tex4ht theora thesaurus threads thunderbird tidy tiff tk tools truetype udev udisks unicode usb utempter v4l v4l2 vaapi vala valgrind vdpau video vim-syntax virt-network virtualbox visio vorbis vpx vtk wav wayland webdav webdav-serf webkit wmf wxwidgets x264 xa xattr xcb xen xetex xft xine xml xmlreader xmlrpc xpm xv xvid xvmc yaml youtube zlib zsh-completion zvbi" 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="actions alias auth_basic auth_digest authn_anon authn_dbd authn_core authn_dbm authn_default authn_file authz_core authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgid dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info lbmethod_byrequests log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif slotmem_shm so socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias" APACHE2_MPMS="worker" CALLIGRA_FEATURES="karbon plan sheets stage words" CAMERAS="canon fuji ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a" 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="emu efi-64 pc xen" INPUT_DEVICES="keyboard mouse evdev void" KERNEL="linux" L10N="de en fr ru" LCD_DEVICES="cfontz hd44780 mtxorb ncurses X lcd2usb lcdlinux png usblcd SureElec" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LIRC_DEVICES="devinput" LLVM_TARGETS="AMDGPU X86" NETBEANS_MODULES="apisupport cnd dlight enterprise ergonomics groovy gsf harness ide identity j2ee java mobility nb php profiler websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5 python3_6" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="radeon displaylink" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS




root@caiman:/root(40)# emerge -pqv '=media-libs/opencv-3.4.1-r2::gentoo'
[ebuild  r  U ] media-libs/opencv-3.4.1-r2 [3.3.0-r5] USE="contrib eigen examples ffmpeg gdal gphoto2 gstreamer gtk java jpeg jpeg2k lapack openexr opengl openmp png python qt5 tesseract threads tiff v4l vtk* xine -contrib_cvv -contrib_dnn -contrib_hdf -contrib_sfm -contrib_xfeatures2d -cuda -debug -dnn_samples% -gflags -glog -ieee1394 (-ipp) -libav -opencl -pch -testprograms -vaapi* -webp" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="popcnt%* sse%* sse2%* sse3%* -avx% -avx2% -fma3% -sse4_1% -sse4_2% -ssse3%" PYTHON_TARGETS="python2_7 python3_5 python3_6* -python3_4" 
...
Comment 23 Juergen Rose 2018-06-11 12:16:44 UTC
Created attachment 535642 [details]
/var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeOutput.log
Comment 24 Milos Popovic 2018-06-18 13:22:47 UTC
Exactly the same as above on AMD Phenom(tm) II X4 945 Processor.
Comment 25 Juergen Rose 2018-06-19 11:50:50 UTC
And it happens for opencv-3.4.1-r2 too.
Comment 26 Juergen Rose 2018-06-19 11:55:37 UTC
And it happens with a AMD Phenom(tm) II X4 965 Processor.
Comment 27 Amy Liffey gentoo-dev 2018-06-19 13:32:44 UTC
(In reply to Juergen Rose from comment #25)
> And it happens for opencv-3.4.1-r2 too.

Yes it does because I did not fix it yet. Give me few days pls
Comment 28 Amy Liffey gentoo-dev 2018-07-01 09:19:29 UTC
*** Bug 659012 has been marked as a duplicate of this bug. ***
Comment 29 Juergen Rose 2018-07-15 15:55:42 UTC
At the end of /var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeError.log I find:

/var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
/var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘CL_VERSION_2_0’ undeclared (first use in this function); did you mean ‘CL_VERSION_1_0’?
   return ((int*)(&CL_VERSION_2_0))[argc];
                   ^~~~~~~~~~~~~~
                   CL_VERSION_1_0
/var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
/var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeTmp/CheckSymbolExists.c:4:14: warning: parameter ‘argc’ set but not used [-Wunused-but-set-parameter]
 int main(int argc, char** argv)
              ^~~~
gmake[1]: *** [CMakeFiles/cmTC_8c99f.dir/build.make:66: CMakeFiles/cmTC_8c99f.dir/CheckSymbolExists.c.o] Error 1
gmake[1]: Leaving directory '/var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:126: cmTC_8c99f/fast] Error 2

File /var/tmp/portage/media-libs/opencv-3.4.1-r2/work/opencv-3.4.1-abi_x86_64.amd64/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include </usr/include/CL/cl.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef CL_VERSION_2_0
  return ((int*)(&CL_VERSION_2_0))[argc];
#else
  (void)argc;
  return 0;
#endif
}


/usr/include/CL/cl.h is a link to ../../lib64/OpenCL/vendors/mesa/include/CL/cl.h

CL_VERSION_2_0 is not defined in /usr/lib64/OpenCL/vendors/mesa/include/CL/cl.h: 

root@caiman:/usr/local/portage/app-emulation(59)# grep CL_VERSION  /usr/lib64/OpenCL/vendors/mesa/include/CL/cl.h
#define CL_VERSION_1_0                              1
#define CL_VERSION_1_1                              1
#define CL_VERSION_1_2                              1


But why does cmake intends to do something with OpenCL, if opencl USE flag is not an active for opencv:

root@caiman:/usr/local/portage/app-emulation(53)# emerge -pv1 opencv

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

Calculating dependencies... done!
[ebuild  N     ] media-libs/opencv-3.4.1-r2:0/3.4.1::gentoo  USE="contrib eigen examples ffmpeg gdal gphoto2 gstreamer gtk java jpeg jpeg2k lapack openexr opengl openmp png python qt5 tesseract threads tiff v4l vtk xine -contrib_cvv -contrib_dnn -contrib_hdf -contrib_sfm -contrib_xfeatures2d -cuda -debug -dnn_samples -gflags -glog -ieee1394 (-ipp) -libav -opencl -pch -testprograms -vaapi -webp" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="popcnt sse sse2 sse3 -avx -avx2 -fma3 -sse4_1 -sse4_2 -ssse3" PYTHON_TARGETS="python2_7 python3_5 python3_6 -python3_4" 0 KiB    ?
Comment 30 Juergen Rose 2018-07-21 14:13:46 UTC
'CPU_FLAGS_X86="3dnow 3dnowext" MAKEOPTS=-j1 emerge -v1 opencv' worked on the last system, where cpuid2cpuflags shows:

root@caiman:/usr/local/portage/sci-libs(93)# cpuid2cpuflags 
CPU_FLAGS_X86: 3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a


root@caiman:/usr/local/portage/sci-libs(95)# CPU_FLAGS_X86="3dnow 3dnowext" emerge --info opencv
Portage 2.3.43 (python 3.5.5-final-0, default/linux/amd64/17.0, gcc-7.3.0, glibc-2.27-r5, 4.17.3-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.17.3-gentoo-x86_64-AMD_Phenom-tm-_II_X6_1090T_Processor-with-gentoo-2.6
KiB Mem:    16168240 total,   1739980 free
KiB Swap:  100663280 total, 100464368 free
Timestamp of repository gentoo: Sat, 21 Jul 2018 02:00:01 +0000
Head commit of repository gentoo: 37f30b0a27452cf4fb2b9cf37a5ae8f7d95f9954
sh bash 4.4_p23
ld GNU ld (Gentoo 2.30 p3) 2.30.0
app-shells/bash:          4.4_p23::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.5.5-r1::gentoo, 3.6.6::gentoo, 3.7.0::gentoo
dev-util/cmake:           3.12.0::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6::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.30-r3::gentoo
sys-devel/gcc:            7.3.0-r3::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.17::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r5::gentoo
Repositories:

gentoo
    location: /usr/portage_caiman
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 0

g-cpan
    location: /var/lib/cpan
    masters: gentoo
    priority: 1

g-octave
    location: /var/lib/g-octave
    masters: gentoo
    priority: 2

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

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

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA PUEL Intel-SDP dlj-1.1 skype-eula skype-4.0.0.7-copyright googleearth AdobeFlash-11.x cadsoft Oracle-BCLA-JavaSE MakeMKV-EULA NVIDIA-CUDA Nero-AAC-EULA GIMPS"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=amdfam10 -O2 -pipe"
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/php/apache2-php7.2/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cli-php7.2/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=amdfam10 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY 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 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 userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de en fr ru"
MAKEOPTS="-j7"
PKGDIR="/usr/portage/packages"
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="/var/tmp"
USE="3dnow 3dnowext 64bit R X Xaw3d a52 aac acl acpi admin afs alsa amd64 amr ao apache2 apng applet archive armadillo arpack asf aspell assistant atlas audiofile automap automount barcode bash-completion berkdb blas blast bluetooth bluray boost btrfs bzip2 cairo cdda cddb cdf cdio cdparanoia cdr cgi chm cilk clang cli cmake collada contrib crypt css cups curl cxx daap db dbi dbm dbus declarative designer devhelp device-mapper dga dia digitalradio djvu doc dot dri ds2490 ds9097 ds9097u dts dv dvb dvd dvdr dvi dynamicplugin eds egl elf emacs emboss emf encode epiphany evdev evo examples excel exif expat extensions extra extras faac faad fam ffmpeg fftw firefox fits flac fltk fontconfig foomaticdb fortran fortran95 fpm fpx ftp fuse gcj gd gdal gdbm gedit geoip geolocation geos gfortran gif gimp git glade glamor glib glpk gml gmp gnome gnome-keyring gnuplot gnutls gold gphoto2 gpm grammar graphics graphtft graphviz grass gsl gsm gstreamer gtk gtk3 gudev guile hddtemp hdf hdf5 hdri html http httpd hvm hwdb iconv icq icu id3tag ide imagemagick imap inotify introspection ipod ipv6 irda ithreads jadetex java jbig jit john jpeg jpeg2k kate kdepim kdrive kerberos keymap kpathsea kvm ladspa lame lapack latex lcms ldap lensfun libffi libgda libkms libnotify libsamplerate libtirpc live lm_sensors lua lzma lzo mad mail maildir mapnik math matroska media-library mercurial mikmod mng mod modules mono motif mozilla mp3 mp4 mpeg mpi mpi-threads mplayer mtp multilib multimedia musepack musicbrainz mysql mysqli nautilus ncurses netcdf netpbm network networking nfs nls nntp nptl nsplugin ntfs ntp numpy obex objc ocaml ocr octave odbc ofa ogdi ogg opencl opencv openexr opengl openmp openvg pam pango pcre pda pdf pdl2 perl plasma plotutils plugins png podcast policykit portaudio posix postgres postscript ppds ppp preview-latex proj projectm pstricks pulseaudio python q16 q32 qemu qhull qml qt5 quicktime raw readline reiserfs reports rle romio rpc rrdcgi rrdtool sage samba sasl schroedinger science sdk sdl seccomp secure-delete server session shout sip slang slp smart smbclient smp sms sndfile snmp soap sockets sound soup sox speex spell sql sqlite ssl stlport subtitles subversion sudo suexec svg svm swig systemd szip t1lib tbb tcl tcpd tex tex4ht theora thesaurus threads thunderbird tidy tiff tk tools truetype udev udisks unicode usb utempter v4l v4l2 vaapi vala valgrind vdpau video vim-syntax virt-network virtualbox visio vorbis vpx vtk wav wayland webdav webdav-serf webkit wmf wxwidgets x264 xa xattr xcb xen xetex xft xine xml xmlreader xmlrpc xpm xv xvid xvmc yaml youtube zlib zsh-completion zvbi" 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="actions alias auth_basic auth_digest authn_anon authn_dbd authn_core authn_dbm authn_default authn_file authz_core authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgid dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info lbmethod_byrequests log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif slotmem_shm so socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias" APACHE2_MPMS="worker" CALLIGRA_FEATURES="karbon plan sheets stage words" CAMERAS="canon fuji ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow 3dnowext" 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="emu efi-64 pc xen" INPUT_DEVICES="keyboard mouse evdev void" KERNEL="linux" L10N="de en fr ru" LCD_DEVICES="cfontz hd44780 mtxorb ncurses X lcd2usb lcdlinux png usblcd SureElec" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LIRC_DEVICES="devinput" LLVM_TARGETS="AMDGPU X86" NETBEANS_MODULES="apisupport cnd dlight enterprise ergonomics groovy gsf harness ide identity j2ee java mobility nb php profiler websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5 python3_6" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="radeon displaylink" 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, EMERGE_DEFAULT_OPTS, 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-r2::gentoo was built with the following:
USE="contrib eigen examples ffmpeg gdal gphoto2 gstreamer gtk java jpeg jpeg2k lapack openexr opengl openmp png python qt5 tesseract threads tiff v4l vtk xine -contrib_cvv -contrib_dnn -contrib_hdf -contrib_sfm -contrib_xfeatures2d -cuda -debug -dnn_samples -gflags -glog -ieee1394 (-ipp) -libav -opencl -pch -testprograms -vaapi -webp" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="-avx -avx2 -fma3 -popcnt -sse -sse2 -sse3 -sse4_1 -sse4_2 -ssse3" PYTHON_TARGETS="python2_7 python3_5 python3_6 -python3_4"
Comment 31 Juergen Rose 2018-08-02 12:45:15 UTC
On the next systems works:
root@localhost:/(47)# CPU_FLAGS_X86="aes mmx mmxext sse sse2" MAKEOPTS=-j1 emerge -v1 opencv

where cpuid2cpuflags shows:

root@localhost:/(47)# cpuid2cpuflags 
CPU_FLAGS_X86: aes avx avx2 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3
Comment 32 Larry the Git Cow gentoo-dev 2018-08-16 15:09:52 UTC
The bug has been closed via the following commit(s):

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

commit 9135e0d86e3841b5153acaf11310a47817d5c7ab
Author:     Amy Liffey <amynka@gentoo.org>
AuthorDate: 2018-08-16 08:11:55 +0000
Commit:     Amy Liffey <amynka@gentoo.org>
CommitDate: 2018-08-16 15:09:35 +0000

    media-libs/opencv: add required use for cpu_flags
    
    - Add required_use for cpu_flag
    Submitted-by: Hector Martin <marcan@marcan.st>
    - Add ninja as default
    Closes: https://bugs.gentoo.org/656638
    
    Package-Manager: Portage-2.3.40, Repoman-2.3.9

 media-libs/opencv/opencv-3.4.1-r3.ebuild | 508 +++++++++++++++++++++++++++++++
 1 file changed, 508 insertions(+)
Comment 33 Ștefan Talpalaru 2018-08-16 15:15:42 UTC
> cpu_flags_x86_fma3? ( cpu_flags_x86_avx2 )

This is the wrong approach, because only the former is available on Piledriver.

Also, options like "-DENABLE_FMA3" are deprecated in favour of this: https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options
Comment 34 Amy Liffey gentoo-dev 2018-08-16 15:20:38 UTC
(In reply to Ștefan Talpalaru from comment #33)
> > cpu_flags_x86_fma3? ( cpu_flags_x86_avx2 )
> 
> This is the wrong approach, because only the former is available on
> Piledriver.
> 
> Also, options like "-DENABLE_FMA3" are deprecated in favour of this:
> https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options

Well it is in opencv cmakefile. We just copied it from it.
Comment 35 Amy Liffey gentoo-dev 2018-08-16 15:22:59 UTC
(In reply to Ștefan Talpalaru from comment #33)
> > cpu_flags_x86_fma3? ( cpu_flags_x86_avx2 )
> 
> This is the wrong approach, because only the former is available on
> Piledriver.
> 
> Also, options like "-DENABLE_FMA3" are deprecated in favour of this:
> https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options

Any other ideas for fixing this are welcome. Feel free to suggest. :)
Comment 36 Ștefan Talpalaru 2018-08-16 16:03:51 UTC
> Well it is in opencv cmakefile.

So are the deprecation warnings: https://github.com/opencv/opencv/blob/4eb296655958e9241f43a7bd144d5e63759f6cea/cmake/OpenCVCompilerOptimizations.cmake#L51

> Any other ideas for fixing this are welcome.

Add "-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON" to "GLOBALCMAKEARGS".

This single change allows me to compile opencv-3.4.1-r2 on Piledriver without giving up FMA3 or any other CPU flag, which goes to show that those "dependencies" are just a failed attempt at doing some automagic configuration.

Source for the fix: https://github.com/opencv/opencv/blob/4eb296655958e9241f43a7bd144d5e63759f6cea/cmake/OpenCVCompilerOptimizations.cmake#L166
Comment 37 Amy Liffey gentoo-dev 2018-08-17 14:35:28 UTC
(In reply to Ștefan Talpalaru from comment #36)
> > Well it is in opencv cmakefile.
> 
> So are the deprecation warnings:
> https://github.com/opencv/opencv/blob/
> 4eb296655958e9241f43a7bd144d5e63759f6cea/cmake/OpenCVCompilerOptimizations.
> cmake#L51
> 
> > Any other ideas for fixing this are welcome.
> 
> Add "-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON" to "GLOBALCMAKEARGS".
> 
> This single change allows me to compile opencv-3.4.1-r2 on Piledriver
> without giving up FMA3 or any other CPU flag, which goes to show that those
> "dependencies" are just a failed attempt at doing some automagic
> configuration.
> 
> Source for the fix:
> https://github.com/opencv/opencv/blob/
> 4eb296655958e9241f43a7bd144d5e63759f6cea/cmake/OpenCVCompilerOptimizations.
> cmake#L166

Can you be more specific about the patch? Is it just adding the  -DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON ?
Comment 38 Ștefan Talpalaru 2018-08-17 14:41:30 UTC
> Can you be more specific about the patch? Is it just adding the  -DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON ?

Yes, that's it. Don't forget to remove all those cpu_flags_* entries to REQUIRED_USE that were added in -r3.
Comment 39 Amy Liffey gentoo-dev 2018-08-17 14:43:13 UTC
(In reply to Ștefan Talpalaru from comment #38)
> > Can you be more specific about the patch? Is it just adding the  -DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON ?
> 
> Yes, that's it. Don't forget to remove all those cpu_flags_* entries to
> REQUIRED_USE that were added in -r3

The thing is I cannot reproduce this and test it at all so I am basically blind. Would you mind to provide tested patch for the ebuild?

Thank you
Comment 40 Ștefan Talpalaru 2018-08-17 15:45:22 UTC
You might also want to delete opencv-3.4.1-r2.ebuild from the main tree.
Comment 41 Larry the Git Cow gentoo-dev 2018-08-18 06:13:32 UTC
The bug has been referenced in the following commit(s):

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

commit b396186669ec607562148b9f5303565a5d01aa2b
Author:     Ștefan Talpalaru <stefantalpalaru@yahoo.com>
AuthorDate: 2018-08-17 15:29:18 +0000
Commit:     Amy Liffey <amynka@gentoo.org>
CommitDate: 2018-08-18 06:10:58 +0000

    media-libs/opencv: disable implied CPU flags
    
    The OpenCV build system tries to be helpful by enabling unrequested CPU
    flags based on requested ones. Unfortunately, this breaks the build on
    AMD Piledriver because FMA3 implies AVX2 which is not available on this
    architecture.
    
    Further more, these CPU flags should only be handled by the
    corresponding Portage flags, instead of CMake's hard-coded automagic.
    This commit fixes that by disabling the whole "implication" mechanism
    for CPU flags, while also undoing the previous attempt at solving the
    problem by translating those broken "implications" into REQUIRED_USE.
    
    Authored-by: Ștefan Talpalaru <stefantalpalaru@yahoo.com>
    Bug: https://bugs.gentoo.org/656638

 .../{opencv-3.4.1-r3.ebuild => opencv-3.4.1-r4.ebuild}       | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
Comment 42 Amy Liffey gentoo-dev 2018-08-18 06:14:34 UTC
(In reply to Ștefan Talpalaru from comment #40)
> You might also want to delete opencv-3.4.1-r2.ebuild from the main tree.

Thank you. I usually wait a bit. :)