Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 930682 - media-libs/opencv-4.9.0 doesn't build with nvidia-cuda-toolkit-12.4.1
Summary: media-libs/opencv-4.9.0 doesn't build with nvidia-cuda-toolkit-12.4.1
Status: IN_PROGRESS
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Paul Zander
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-25 17:39 UTC by James
Modified: 2024-04-26 17:10 UTC (History)
3 users (show)

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


Attachments
build log (build.log.bz2,14.69 KB, application/x-bzip2)
2024-04-25 17:43 UTC, James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James 2024-04-25 17:39:35 UTC
opencv-4.9.0 doesn't build when I enable the cuda use flag with nvidia-cuda-toolkit-12.4.1
I did an emerge -ev opencv, thinking maybe I could get past it seeing as most people don't seem to be having this problem...  but it still fails.
I see some errors that seem to look like this commit from Arch:
https://gitlab.archlinux.org/archlinux/packaging/packages/opencv/-/commit/30f9165f2387ef9dd0b02e3e54de2bc98acb1341
especially this patch:  https://gitlab.archlinux.org/archlinux/packaging/packages/opencv/-/blob/main/fix-nppi-bufsize-type.patch?ref_type=heads

Reproducible: Always

Steps to Reproduce:
1.enable cuda use flag
2.update to nvidia-cuda-toolkit-12.4.1 (maybe 12.4.0)
3.rebuild opencv
4.fail
Actual Results:  
Here's a part of the failure:
In file included from /var/tmp/portage/media-libs/opencv-4.9.0/work/opencv_contrib-4.9.0/modules/cudaarithm/src/precomp.hpp:53,
                 from /var/tmp/portage/media-libs/opencv-4.9.0/work/opencv_contrib-4.9.0/modules/cudaarithm/src/reductions.cpp:43:
/var/tmp/portage/media-libs/opencv-4.9.0/work/opencv_contrib-4.9.0/modules/cudaarithm/src/reductions.cpp: In function ‘void cv::cuda::meanStdDev(cv::InputArray, cv::OutputArray, Stream&)’:
/var/tmp/portage/media-libs/opencv-4.9.0/work/opencv_contrib-4.9.0/modules/cudaarithm/src/reductions.cpp:159:65: error: cannot convert ‘int*’ to ‘size_t*’ {aka ‘long unsigned int*’}
  159 |         nppSafeCall( nppiMeanStdDevGetBufferHostSize_8u_C1R(sz, &bufSize) );
      |                                                                 ^~~~~~~~
      |                                                                 |
      |                                                                 int*
/var/tmp/portage/media-libs/opencv-4.9.0/work/opencv-4.9.0/modules/core/include/opencv2/core/private.cuda.hpp:162:52: note: in definition of macro ‘nppSafeCall’
  162 | #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
      |                                                    ^~~~
In file included from /opt/cuda/targets/x86_64-linux/include/nppi.h:92,
                 from /opt/cuda/targets/x86_64-linux/include/npp.h:100,
                 from /var/tmp/portage/media-libs/opencv-4.9.0/work/opencv-4.9.0/modules/core/include/opencv2/core/private.cuda.hpp:71:
/opt/cuda/targets/x86_64-linux/include/nppi_statistics_functions.h:5350:68: note:   initializing argument 2 of ‘NppStatus nppiMeanStdDevGetBufferHostSize_8u_C1R(NppiSize, size_t*)’
 5350 | nppiMeanStdDevGetBufferHostSize_8u_C1R(NppiSize oSizeROI, size_t * hpBufferSize/* host pointer */);
      |                                                           ~~~~~~~~~^~~~~~~~~~~~
/var/tmp/portage/media-libs/opencv-4.9.0/work/opencv_contrib-4.9.0/modules/cudaarithm/src/reductions.cpp:161:66: error: cannot convert ‘int*’ to ‘size_t*’ {aka ‘long unsigned int*’}
  161 |         nppSafeCall( nppiMeanStdDevGetBufferHostSize_32f_C1R(sz, &bufSize) );
      |                                                                  ^~~~~~~~
      |                                                                  |
      |                                                                  int*


Expected Results:  
build correctly

emerge --info opencv
Portage 3.0.63 (python 3.11.9-final-0, default/linux/amd64/23.0/split-usr/desktop/plasma, gcc-12, glibc-2.39-r3, 6.8.7-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.8.7-gentoo-x86_64-AMD_Ryzen_7_5800X_8-Core_Processor-with-glibc2.39
KiB Mem:    32798368 total,  19391804 free
KiB Swap:   50331640 total,  50331640 free
Timestamp of repository gentoo: Thu, 25 Apr 2024 15:30:00 +0000
Head commit of repository gentoo: 3d272ae43a6bdec96e5416d04b04eb2fcbfb193c
Head commit of repository brave-overlay: 29f0392a9fea7fe8281d556f918a5702524958c4

sh bash 5.2_p26-r1
ld GNU ld (Gentoo 2.42 p3) 2.42.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p26-r1::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.29.2::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.4.0-r1::gentoo
dev-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.38.2-r2::gentoo
dev-lang/python:           3.11.9::gentoo, 3.12.3::gentoo
dev-lang/rust:             1.77.1::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.42-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           17.0.6::gentoo, 18.1.4::gentoo
sys-devel/gcc:             12.3.1_p20240209::gentoo, 13.2.1_p20240210::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             17.0.6::gentoo
sys-devel/llvm:            17.0.6::gentoo, 18.1.4::gentoo
sys-kernel/linux-headers:  6.8-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.39-r3::gentoo
Repositories:

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

Home
    location: /usr/local/portage
    masters: gentoo
    priority: 0
    volatile: True

brave-overlay
    location: /var/db/repos/brave-overlay
    sync-type: git
    sync-uri: https://gitlab.com/jason.oliveira/brave-overlay.git
    masters: gentoo
    volatile: False

local
    location: /var/db/repos/local
    masters: gentoo
    volatile: False

crossdev
    location: /var/db/repos/portage-crossdev
    masters: gentoo
    priority: 10
    volatile: True

Binary Repositories:

binhost
    priority: 9999
    sync-uri: https://mirrors.gethosted.online/gentoo/releases/amd64/binpackages/23.0/x86-64

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* PUEL"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -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/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/mnt/nfs_portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps y --buildpkg-exclude "virtual/* sys-kernel/*-sources""
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.osuosl.org/     http://gentoo-mirror.flux.utah.edu/     http://www.gtlib.gatech.edu/pub/gentoo"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
LEX="flex"
LINGUAS="en en_US"
MAKEOPTS="-j16 -l6"
PKGDIR="/mnt/nfs_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"
SHELL="/bin/bash"
USE="X a52 aac aacs acl acpi activities alsa amd64 audiofile bluetooth bluray branding bzip2 cairo cdda cddb cdio cdr cet crypt css cuda cups dbus declarative dri dts dv dvb dvd dvdnav dvdr dvdread elogind enca encode exif extras ffmpeg flac fontconfig gdbm gif gimp gpm gtk gui iconv icu imagemagick ipv6 java jpeg json kde kwallet ladspa lame lcms libnotify libtirpc live lm-sensors lv2 mad midi mjpeg mng mp2 mp3 mp4 mpeg mtp musepack ncurses networkmanager nls nptl nvenc nvidia ogg openal opengl openmp pam pango pcre pda pdf pipewire pipewire-alsa plasma png policykit ppds pulseaudio qemu qml qt5 readline redistributable scanner screencast script sdl seccomp semantic-desktop snmp sound speech spell split-usr srt ssl startup-notification svg test-rust theora threads tiff tools truetype udev udisks unicode upower ups_drivers_usbhid-ups usb usbredir v4l vcd vim-syntax vorbis vulkan wayland webkit widgets wxwidgets x264 x265 xattr xcb xft xinerama xml xmp xv xvfb xvid zlib" ABI_X86="64" ADA_TARGET="gcc_12" ALSA_CARDS="hda_intel usb_audio" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en_US la" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LIBREOFFICE_EXTENSIONS="pdfimport presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" QEMU_SOFTMMU_TARGETS="x86_64" QEMU_USER_TARGETS="x86_64" RUBY_TARGETS="ruby31" SANE_BACKENDS="hp" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

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

media-libs/opencv-4.9.0::gentoo was built with the following:
USE="contrib contribdnn eigen features2d ffmpeg java jpeg opengl openmp png python qt5 tiff v4l -atlas -contribcvv -contribfreetype -contribhdf (-contribovis) -contribsfm -contribxfeatures2d -cuda -cudnn -debug -dnnsamples -doc -examples -gdal -gflags -glog -gphoto2 -gstreamer -gtk3 -ieee1394 -jasper -jpeg2k -lapack -mkl -non-free -opencl -opencvapps -openexr -qt6 -quirc -tbb -tesseract -test -testprograms -vaapi -vtk -webp -xine" CPU_FLAGS_X86="avx avx2 f16c fma3 popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3 -avx512f" PYTHON_TARGETS="python3_11 -python3_10 -python3_12" VIDEO_CARDS="-intel"
FEATURES="network-sandbox ipc-sandbox assume-digests xattr usersandbox config-protect-if-modified binpkg-docompress merge-sync distlocks unmerge-orphans unmerge-logs fixlafiles binpkg-multi-instance news parallel-fetch strict usersync buildpkg-live multilib-strict ebuild-locks preserve-libs binpkg-logs sandbox userfetch sfperms pkgdir-index-trusted merge-wait unknown-features-warn binpkg-dostrip pid-sandbox qa-unresolved-soname-deps userpriv protect-owned buildpkg"
Comment 1 James 2024-04-25 17:43:38 UTC
Created attachment 891744 [details]
build log
Comment 2 Paul Zander 2024-04-26 17:10:02 UTC
I accidentally removed the blocker. I have a PR to re-add that.
 
It's unlikely to get fixed in 4.9 looking at upstream. I'll try to add 4.9.9999 and 5.9999 ebuilds so we can test that.

Getting opencv to work with 12.4 would require to fix the cccl bug from https://github.com/NVIDIA/cccl/pull/1522. Not sure how likely that will be.