Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 701712

Summary: media-libs/opencv-4.1.2-r1 - In file included from .../work/opencv_contrib-4.1.2/modules/cudaoptflow/src/nvidiaOpticalFlow.cpp:7: .../work/opencv-4.1.2/modules/core/include/opencv2/core/base.hpp:320:40: error: expected constructor, destructor, or type con
Product: Gentoo Linux Reporter: Samuel Bernardo <samuelbernardo.mail>
Component: Current packagesAssignee: Amy Liffey <amynka>
Status: RESOLVED FIXED    
Severity: normal CC: axl, christian, fordfrog, gentoo.bugzilla, mouacyk, pacho, phobosk, plevine457, rossbridger.cc, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=704518
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build log
emerge info
build log with download use flag enabled
cv_error.patch
CMakeDownloadLog

Description Samuel Bernardo 2019-12-02 02:09:56 UTC
Created attachment 598188 [details]
build log

[862/889] /usr/bin/g++-7.3.0 -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/tm
p/portage/media-libs/opencv-4.1.2-r1/work/opencv_contrib-4.1.2/modules/cudaoptflow/include -Imodules/cudaoptflow -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work
/opencv_contrib-4.1.2/modules/cudev/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv-4.1.2/modules/core/include -I/var/tmp/portage/media-libs/open
cv-4.1.2-r1/work/opencv_contrib-4.1.2/modules/cudaarithm/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv-4.1.2/modules/flann/include -I/var/tmp/$
ortage/media-libs/opencv-4.1.2-r1/work/opencv-4.1.2/modules/imgproc/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv_contrib-4.1.2/modules/cudafi$
ters/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv_contrib-4.1.2/modules/cudaimgproc/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/wor$
/opencv_contrib-4.1.2/modules/cudawarping/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv-4.1.2/modules/features2d/include -I/var/tmp/portage/me$
ia-libs/opencv-4.1.2-r1/work/opencv-4.1.2/modules/imgcodecs/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv-4.1.2/modules/calib3d/include -I/var$
tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv-4.1.2/modules/objdetect/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv-4.1.2/modules/video/i$
clude -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv_contrib-4.1.2/modules/ximgproc/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv_c$
ntrib-4.1.2/modules/cudalegacy/include -I/var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv_contrib-4.1.2/modules/optflow/include -isystem . -isystem /usr/in$
lude/eigen3 -isystem /opt/cuda/include  -DNDEBUG -O2 -pipe -march=native   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -We$
ror=sequence-point -Wformat -Werror=format-security -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtua$
-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata$
sections  -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -Wno-undef -Wno-missing-declarations -Wno-shadow -Wno-strict-aliasing -fPIC   -std=c++11 -MD -M$
 modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/src/farneback.cpp.o -MF modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/src/farneback.cpp.o.d -o modu$
es/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/src/farneback.cpp.o -c /var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv_contrib-4.1.2/modules/cudaoptflow/$
rc/farneback.cpp                                                                 
ninja: build stopped: subcommand failed.                                                                                                                           
 * ERROR: media-libs/opencv-4.1.2-r1::gentoo failed (compile phase):
 *   ninja -v -j14 -l13 failed                                                                                                                                     
 *                                                                               
 * Call stack: 
 *     ebuild.sh, line  125:  Called src_compile
 *   environment, line 5561:  Called cmake-multilib_src_compile
 *   environment, line 1129:  Called multilib-minimal_src_compile
 *   environment, line 4006:  Called multilib_foreach_abi 'multilib-minimal_abi_src_compile'
 *   environment, line 4250:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_compile'
 *   environment, line 3941:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_compile'
 *   environment, line 3939:  Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_compile'
 *   environment, line  775:  Called multilib-minimal_abi_src_compile
 *   environment, line 4000:  Called multilib_src_compile
 *   environment, line 4470:  Called cmake-utils_src_compile
 *   environment, line 1149:  Called cmake-utils_src_make
 *   environment, line 1330:  Called _cmake_ninja_src_make
 *   environment, line  625:  Called eninja
 *   environment, line 1785:  Called die 
 * The specific snippet of code:
 *       "$@" || die "${nonfatal_args[@]}" "${*} failed"
Comment 1 Samuel Bernardo 2019-12-02 02:10:32 UTC
Created attachment 598190 [details]
emerge info

emerge info
Comment 2 Peter Levine 2019-12-02 06:36:02 UTC
I just ran into this.  The actual problem appears to be this:

> /var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv_contrib-4.1.2/modules/cudaoptflow/src/nvidiaOpticalFlow.cpp:15:1: note: in expansion of macro 'CV_Error'
>  CV_Error(cv::Error::HeaderIsNull, "Nvidia Optical Flow headers not found. Make sure cmake downloads it properly");
>  ^~~~~~~~

I assume this means that the "cuda" USE flag should depend on the "download" USE flag.

Also, note that even before this error, with "-contrib" I ran into:

> CMake Error at modules/core/CMakeLists.txt:40 (message):
>   CUDA: OpenCV requires enabled 'cudev' module from 'opencv_contrib'
>   repository: https://github.com/opencv/opencv_contrib

So maybe "cuda? ( contrib download )" should be added to REQUIRED_USE.
Comment 3 Samuel Bernardo 2019-12-03 00:07:58 UTC
(In reply to Peter Levine from comment #2)
> So maybe "cuda? ( contrib download )" should be added to REQUIRED_USE.

I've already contrib flag added before for some dependency reason also.
I'm testing it with missing download use flag.
I'll leave new comment with the compilation results from my profile.
Comment 4 Samuel Bernardo 2019-12-03 00:43:01 UTC
Unfortunately compilation phase error remains...
I'm submitting the build log with download use flag activated in attachment.
Comment 5 Samuel Bernardo 2019-12-03 00:43:52 UTC
Created attachment 598300 [details]
build log with download use flag enabled

build log with download use flag enabled
Comment 6 Peter Levine 2019-12-03 01:50:50 UTC
(In reply to Samuel Bernardo from comment #4)
> Unfortunately compilation phase error remains...
> I'm submitting the build log with download use flag activated in attachment.

Strange.  After fixing another unrelated bug, I was able to eventually successfully merge from a resumed ebuild using mostly the same USE flags.

Maybe try repeating the emerge with FEATURES="-network-sandbox".
Comment 7 LE GARREC Vincent 2019-12-05 21:40:57 UTC
I made a pull request on opencv github: https://github.com/opencv/opencv_contrib/pull/2378/commits/9bc0d8d0b4d37aa6b3d0a66de7f91ebcff16cd02

You can find enclosed a small patch.
Comment 8 LE GARREC Vincent 2019-12-05 21:41:42 UTC
Created attachment 598614 [details, diff]
cv_error.patch
Comment 9 LE GARREC Vincent 2019-12-05 21:42:38 UTC
And you should definitely add:

cuda? ( contrib )

I didn't needed download use flag
Comment 10 Samuel Bernardo 2019-12-15 02:30:26 UTC
(In reply to LE GARREC Vincent from comment #9)
> And you should definitely add:
> 
> cuda? ( contrib )
> 
> I didn't needed download use flag

I have the download and contrib use flag and it didn't compile.

I will try with no network-sandbox. I also didn't tried the proposed patch.
Comment 11 Samuel Bernardo 2019-12-15 17:47:18 UTC
Created attachment 599672 [details]
CMakeDownloadLog

After upgrading nvidia toolkit and sdk to 10, a new rebuild of opencv was requested.

This time the problem was with downloading from codeload.github.com:
GET /NVIDIA/NVIDIAOpticalFlowSDK/zip/79c6cee80a2df9a196f20afd6b598a9810964c32 HTTP/1.1
# Host: codeload.github.com
# User-Agent: curl/7.66.0
# Accept: */
Comment 12 Samuel Bernardo 2019-12-15 17:52:51 UTC
(In reply to Samuel Bernardo from comment #11)
> Created attachment 599672 [details]
> CMakeDownloadLog
> 
> After upgrading nvidia toolkit and sdk to 10, a new rebuild of opencv was
> requested.
> 
> This time the problem was with downloading from codeload.github.com:
> GET
> /NVIDIA/NVIDIAOpticalFlowSDK/zip/79c6cee80a2df9a196f20afd6b598a9810964c32
> HTTP/1.1
> # Host: codeload.github.com
> # User-Agent: curl/7.66.0
> # Accept: */

From build.log I haver the following log:

-- data: Download: face_landmark_model.dat
-- Try 1 failed
CMake Warning at /var/tmp/portage/media-libs/opencv-4.1.2-r2/work/opencv-4.1.2/cmake/OpenCVDownload.cmake:203 (message):
  data: Download failed: 28;"Timeout was reached"

  For details please refer to the download log file:

  
  /var/tmp/portage/media-libs/opencv-4.1.2-r2/work/opencv-4.1.2-abi_x86_64.amd64/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /var/tmp/portage/media-libs/opencv-4.1.2-r2/work/opencv_contrib-4.1.2/modules/face/CMakeLists.txt:13 (ocv_download)


CMake Warning at /var/tmp/portage/media-libs/opencv-4.1.2-r2/work/opencv_contrib-4.1.2/modules/face/CMakeLists.txt:26 (message):
  Face: Can't get model file for face alignment.
Comment 13 Samuel Bernardo 2019-12-15 18:05:09 UTC
Additional build log output when running CMake

CMake Warning at cmake/OpenCVFindVA_INTEL.cmake:29 (message):
  Intel OpenCL installation is not found.
Call Stack (most recent call first):
  cmake/OpenCVFindLibsVideo.cmake:8 (include)
  CMakeLists.txt:670 (include)


-- Found TBB (env): /usr/lib64/libtbb.so
-- Could NOT find CUDNN (missing: CUDNN_LIBRARY CUDNN_INCLUDE_DIR) (Required is at least version "6")
-- CUDA detected: 10.1
-- CUDA NVCC target flags: -gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,co
de=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;
arch=compute_75,code=sm_75;-D_FORCE_INLINES
-- OpenCV Python: during development append to PYTHONPATH: /var/tmp/portage/media-libs/opencv-4.1.2-r2/work/opencv-4.1.2-abi_x86_64.amd64/python_loader
-- Caffe:   NO
-- Protobuf:   YES
-- Glog:   NO
-- freetype2:   YES (ver 22.1.16)
-- harfbuzz:    YES (ver 2.6.4)
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/
exported gflags CMake configuration if available.
-- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
-- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
-- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
-- Tesseract:   YES (ver 3.05.02)
-- Module opencv_dnn_objdetect disabled because opencv_dnn dependency can't be resolved!
-- Module opencv_dnn_superres disabled because opencv_dnn dependency can't be resolved!
-- Module opencv_text disabled because opencv_dnn dependency can't be resolved!
CMake Warning at cmake/OpenCVModule.cmake:680 (message):
  Unexpected include:
  /var/tmp/portage/media-libs/opencv-4.1.2-r2/work/opencv-4.1.2/3rdparty/include/opencl/1.2
  (module=opencv_core)
Call Stack (most recent call first):
  cmake/OpenCVModule.cmake:711 (ocv_target_include_modules)
  modules/core/CMakeLists.txt:66 (ocv_module_include_directories)


-- Excluding from source files list: modules/imgproc/src/sumpixels.avx512_skx.cpp
-- data: Download: face_landmark_model.dat
Comment 14 Samuel Bernardo 2019-12-16 22:42:04 UTC
I forget to mention that, besides all that warnings about missing files during compilation, opencv was installed successfully.
Comment 16 Pacho Ramos gentoo-dev 2020-12-02 20:34:42 UTC
Still valid with 4.5.0
Comment 17 Miroslav Ć ulc gentoo-dev 2021-08-12 17:08:02 UTC
media-libs/opencv-4.5.2-r1[cuda] compiled fine for me today on two machines
Comment 18 Pacho Ramos gentoo-dev 2021-08-18 10:14:45 UTC
I still get:
--   Found gstreamer-riff-1.0, version 1.18.4
-- Checking for module 'gstreamer-pbutils-1.0'
--   Found gstreamer-pbutils-1.0, version 1.18.4
-- Checking for module 'gstreamer-video-1.0'
--   Found gstreamer-video-1.0, version 1.18.4
-- Checking for module 'libgphoto2'
--   Found libgphoto2, version 2.5.27
CMake Error at modules/core/CMakeLists.txt:52 (message):
  CUDA: OpenCV requires enabled 'cudev' module from 'opencv_contrib'
  repository: https://github.com/opencv/opencv_contrib


-- Configuring incomplete, errors occurred!
See also "/var/tmp/portage/media-libs/opencv-4.5.2-r1/work/opencv-4.5.2_build-abi_x86_64.amd64/CMakeFiles/CMakeOutput.log".
See also "/var/tmp/portage/media-libs/opencv-4.5.2-r1/work/opencv-4.5.2_build-abi_x86_64.amd64/CMakeFiles/CMakeError.log".
 * ERROR: media-libs/opencv-4.5.2-r1::gentoo failed (configure phase):
 *   cmake failed
 * 
 * Call stack:
 *     ebuild.sh, line  127:  Called src_configure
 *   environment, line 5548:  Called cmake-multilib_src_configure
 *   environment, line 1330:  Called multilib-minimal_src_configure
 *   environment, line 4304:  Called multilib_foreach_abi 'multilib-minimal_abi_src_configure'
 *   environment, line 4557:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *   environment, line 4234:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *   environment, line 4232:  Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_configure'
 *   environment, line  714:  Called multilib-minimal_abi_src_configure
 *   environment, line 4298:  Called multilib_src_configure
 *   environment, line 4792:  Called cmake_src_configure
 *   environment, line 1585:  Called die
 * The specific snippet of code:
 *       "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed";
 * 
 * If you need support, post the output of `emerge --info '=media-libs/opencv-4.5.2-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-libs/opencv-4.5.2-r1::gentoo'`.
Comment 19 Pacho Ramos gentoo-dev 2021-08-18 10:41:20 UTC
(In reply to LE GARREC Vincent from comment #9)
> And you should definitely add:
> 
> cuda? ( contrib )
> 
> I didn't needed download use flag

And, indeed, contrib USE is needed (I don't need "download" one) to get it built
Comment 20 Larry the Git Cow gentoo-dev 2021-08-25 10:16:24 UTC
The bug has been closed via the following commit(s):

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

commit b10795b1b7a807863d8d5a750e751d263b008c0c
Author:     Pacho Ramos <pacho@gentoo.org>
AuthorDate: 2021-08-25 09:42:07 +0000
Commit:     Pacho Ramos <pacho@gentoo.org>
CommitDate: 2021-08-25 10:16:19 +0000

    media-libs/opencv: CUDA support needs 'contrib' USE enabled
    
    Closes: https://bugs.gentoo.org/701712
    Closes: https://bugs.gentoo.org/792282
    Package-Manager: Portage-3.0.22, Repoman-3.0.3
    Signed-off-by: Pacho Ramos <pacho@gentoo.org>

 media-libs/opencv/opencv-4.5.2-r1.ebuild | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)