if dev-util/nvidia-cuda-toolkit version 1.8.* installed, it should use gcc 11, if version 12.* it should use gcc 12. i remember that i saw some packages that already do that. i have version 11.8.4 installed so i switched to gcc 11 in order to compile opencv with cuda support. Reproducible: Always
Meanwhile I use the following "workaround": * Use the "ebuild" command to "prepare" opencv * Edit temp/environment in the portage build directory and append -DCUDA_HOST_COMPILER=/usr/x86_64-pc-linux-gnu/gcc-bin/12/gcc to GLOBALCMAKEARGS * Use the "ebuild" command to "merge" opencv
I couldn't find any package doing it by itself :/ The best I could find is Arch workaround: they RDEPEND on gcc-12 and add some symlinks in the cuda bindir. With it, cuda will use the right gcc without getting the failure and admin manually downgrading the gcc (and remembering to get it back after) https://gitlab.archlinux.org/archlinux/packaging/packages/cuda/-/blob/main/PKGBUILD?ref_type=heads#L103
The fix will be in the next batch of -4.8.1 changes which should come in the next few days.
(In reply to Paul Zander from comment #3) > The fix will be in the next batch of -4.8.1 changes which should come in the > next few days. I had to use my "workaround" from comment 1 for the latest opencv-4.8.1, I synced portage today, because I still got the "Unsupported Compiler" error.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e9205edb9922309ecd568b7085fd59726c7d2ca commit 0e9205edb9922309ecd568b7085fd59726c7d2ca Author: Paul Zander <negril.nx+gentoo@gmail.com> AuthorDate: 2023-12-08 14:58:23 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-01-10 12:32:37 +0000 media-libs/opencv: add 4.8.1-r1 Closes: https://bugs.gentoo.org/702258 Closes: https://bugs.gentoo.org/830294 Closes: https://bugs.gentoo.org/883375 Closes: https://bugs.gentoo.org/913740 Closes: https://bugs.gentoo.org/914922 Closes: https://bugs.gentoo.org/917121 Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com> Signed-off-by: Sam James <sam@gentoo.org> media-libs/opencv/Manifest | 7 + .../files/opencv-4.8.1-ade-0.1.2a.tar.gz.patch | 18 + .../opencv-4.8.1-drop-python2-detection.patch | 23 + ...ncv-4.8.1-eliminate-lto-compiler-warnings.patch | 36 ++ .../opencv/files/opencv-4.8.1-libpng16.patch | 58 ++ .../opencv/files/opencv-4.8.1-opencv_test.patch | 18 + .../files/opencv-4.8.1-python3_12-support.patch | 25 + .../opencv-4.8.1-use-system-flatbuffers.patch | 36 ++ .../files/opencv-4.8.1-use-system-opencl.patch | 25 + ...rib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch | 20 + .../opencv/files/opencv_contrib-4.8.1-rgbd.patch | 15 + media-libs/opencv/metadata.xml | 34 +- media-libs/opencv/opencv-4.8.1-r1.ebuild | 644 +++++++++++++++++++++ 13 files changed, 945 insertions(+), 14 deletions(-)