Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 782544 - media-libs/opencv-4.5.1 USE=cuda: with gcc-10.3.0: /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/g++-v10/chrono:428:27: internal compiler error: Segmentation fault
Summary: media-libs/opencv-4.5.1 USE=cuda: with gcc-10.3.0: /usr/lib/gcc/x86_64-pc-lin...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-12 16:49 UTC by Bernd
Modified: 2021-04-13 18:56 UTC (History)
2 users (show)

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


Attachments
emerge-info-opencv-4.5.1.txt (emerge-info-opencv-4.5.1.txt,14.64 KB, text/plain)
2021-04-12 16:51 UTC, Bernd
Details
opencv-4.5.1:20210411-180924-gcc-10.3.0.log (opencv-4.5.1:20210411-180924-gcc-10.3.0.log,80.48 KB, text/plain)
2021-04-12 16:52 UTC, Bernd
Details
opencv-4.5.1:20210412-081952-gcc-10.2.0.log.xz (opencv-4.5.1:20210412-081952-gcc-10.2.0.log.xz,74.87 KB, application/octet-stream)
2021-04-12 16:52 UTC, Bernd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernd 2021-04-12 16:49:41 UTC
While updating, opencv fails with the latest gcc-10.3.0. Using gcc-10.2.0-r5 the package builds fine (see attached build logs).

The error is:
[29/1387] cd /var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda && /usr/bin/cmake -E make_directory /var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/. && /usr/bin/cmake -D verbose:BOOL=OFF -D build_configuration:STRING=Gentoo -D generated_file:STRING=/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o -D generated_cubin_file:STRING=/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o.cubin.txt -P /var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.Gentoo.cmake
FAILED: modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o 
cd /var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda && /usr/bin/cmake -E make_directory /var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/. && /usr/bin/cmake -D verbose:BOOL=OFF -D build_configuration:STRING=Gentoo -D generated_file:STRING=/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o -D generated_cubin_file:STRING=/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o.cubin.txt -P /var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.Gentoo.cmake
nvcc warning : The 'compute_35', 'compute_37', 'compute_50', 'sm_35', 'sm_37' and 'sm_50' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : The 'compute_35', 'compute_37', 'compute_50', 'sm_35', 'sm_37' and 'sm_50' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/g++-v10/chrono: In substitution of ‘template<class _Rep, class _Period> template<class _Period2> using __is_harmonic = std::__bool_constant<(std::ratio<((_Period2::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num)) * (_Period::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den))), ((_Period2::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den)) * (_Period::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num)))>::den == 1)> [with _Period2 = _Period2; _Rep = _Rep; _Period = _Period]’:
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/g++-v10/chrono:473:154:   required from here
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/g++-v10/chrono:428:27: internal compiler error: Segmentation fault
  428 |  _S_gcd(intmax_t __m, intmax_t __n) noexcept
      |                           ^~~~~~
0x7f819227909f ???
	/var/tmp/portage/sys-libs/glibc-2.33/work/glibc-2.33/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x7f8192263868 __libc_start_main
	../csu/libc-start.c:332
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.Gentoo.cmake:282 (message):
  Error generating file
  /var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1_build-abi_x86_64.amd64/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o

Haven't tried if it builds without cuda USE flag, but from the error, I suspect it's strictly related to the USE flag.


Reproducible: Always

Steps to Reproduce:
1. emerge =gcc-10.3.0
2. USE=cuda emerge =opencv-4.5.1
3.



Output of emerge --info attached due to size limit in comment.

Output of emerge -pqv =opencv-4.5.1:

[ebuild   R   ] media-libs/opencv-4.5.1  USE="contrib contribcvv contribdnn contribfreetype contribhdf contribsfm contribxfeatures2d cuda download eigen features2d ffmpeg gdal gflags glog gstreamer jpeg jpeg2k lapack opencl opencvapps openexr opengl openmp png python qt5 tesseract threads tiff v4l vaapi vtk webp (-contribovis) -debug -dnnsamples -examples -gphoto2 -gtk3 -ieee1394 -java -lto -testprograms -xine" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="avx f16c fma3 popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3 -avx2 -avx512f" PYTHON_TARGETS="python3_7 python3_8 python3_9"
Comment 1 Bernd 2021-04-12 16:51:10 UTC
Created attachment 699471 [details]
emerge-info-opencv-4.5.1.txt

Output of emerge --info opencv
Comment 2 Bernd 2021-04-12 16:52:01 UTC
Created attachment 699474 [details]
opencv-4.5.1:20210411-180924-gcc-10.3.0.log

Build log using gcc-10.3.0
Comment 3 Bernd 2021-04-12 16:52:43 UTC
Created attachment 699477 [details]
opencv-4.5.1:20210412-081952-gcc-10.2.0.log.xz

Build log with gcc-10.2.0-r5, compressed due to size
Comment 4 Bernd 2021-04-12 16:55:33 UTC
Not sure, if this issue belongs to opencv maintainers or toolchain, so I leave the assignee open for more experienced bug-wranglers.

Before downgrading gcc, I tried rebuilding glibc and binutils with gcc-10.3.0, but the issue stayed the same.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-04-12 17:01:38 UTC
Could you follow https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide?
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-04-12 17:03:19 UTC
Can you rebuild nvcc with the new GCC first?
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-12 17:22:10 UTC
(In reply to Sam James from comment #5)
> Could you follow https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide?

Yeah, please at least extract preprocessed file and make sure it still crashes gcc.

If I understand your log correctly the command is

[30/1387] /usr/bin/x86_64-pc-linux-gnu-g++ -DCERES_FOUND=0 -DGLOG_NO_ABBREVIATED_SEVERITIES -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/include/opencv -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/sfm/src/libmv_light -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/sfm/include -Imodules/sfm -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/cudev/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/core/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/cudaarithm/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/flann/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/imgproc/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/ml/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/features2d/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/imgcodecs/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/calib3d/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/shape/include -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/xfeatures2d/include -isystem . -isystem /usr/include/gdal -isystem /usr/include/openblas -isystem /usr/include/eigen3  -O2 -pipe -march=bdver2 -frecord-gcc-switches -fstack-protector-strong -fstack-check   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mf16c -mfma -mavx -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -Wno-undef -Wno-shadow -Wno-sign-compare -Wno-missing-declarations -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-function -Wno-suggest-override -Wno-suggest-override -Wno-class-memaccess -Wno-deprecated-copy -fPIC -std=c++11 -MD -MT modules/sfm/src/libmv/libmv/multiview/CMakeFiles/multiview.dir/fundamental.cc.o -MF modules/sfm/src/libmv/libmv/multiview/CMakeFiles/multiview.dir/fundamental.cc.o.d -o modules/sfm/src/libmv/libmv/multiview/CMakeFiles/multiview.dir/fundamental.cc.o -c /var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/sfm/src/libmv_light/libmv/multiview/fundamental.cc
Comment 8 Bernd 2021-04-12 21:35:38 UTC
(In reply to Sam James from comment #6)
> Can you rebuild nvcc with the new GCC first?

Isn't nvcc provided as binary in nvidia-cuda-toolkit? I can of course try and re-emerge the package first.
Comment 9 Bernd 2021-04-12 21:38:47 UTC
(In reply to Sergei Trofimovich from comment #7)
> (In reply to Sam James from comment #5)
> > Could you follow https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide?
> 
> Yeah, please at least extract preprocessed file and make sure it still
> crashes gcc.
> 
> If I understand your log correctly the command is
> 
> [30/1387] /usr/bin/x86_64-pc-linux-gnu-g++ -DCERES_FOUND=0
> -DGLOG_NO_ABBREVIATED_SEVERITIES -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/include/opencv
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/
> sfm/src/libmv_light
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/
> sfm/include -Imodules/sfm
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/
> cudev/include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/core/
> include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/
> cudaarithm/include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/flann/
> include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/imgproc/
> include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/ml/
> include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/
> features2d/include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/
> imgcodecs/include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv-4.5.1/modules/calib3d/
> include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/
> shape/include
> -I/var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/
> xfeatures2d/include -isystem . -isystem /usr/include/gdal -isystem
> /usr/include/openblas -isystem /usr/include/eigen3  -O2 -pipe -march=bdver2
> -frecord-gcc-switches -fstack-protector-strong -fstack-check   -fsigned-char
> -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address
> -Werror=sequence-point -Wformat -Werror=format-security -Winit-self
> -Wpointer-arith -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor
> -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow
> -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer
> -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1
> -mpopcnt -msse4.2 -mf16c -mfma -mavx -fvisibility=hidden
> -fvisibility-inlines-hidden -fopenmp -Wno-undef -Wno-shadow
> -Wno-sign-compare -Wno-missing-declarations -Wno-unused-but-set-variable
> -Wno-unused-parameter -Wno-unused-function -Wno-suggest-override
> -Wno-suggest-override -Wno-class-memaccess -Wno-deprecated-copy -fPIC
> -std=c++11 -MD -MT
> modules/sfm/src/libmv/libmv/multiview/CMakeFiles/multiview.dir/fundamental.
> cc.o -MF
> modules/sfm/src/libmv/libmv/multiview/CMakeFiles/multiview.dir/fundamental.
> cc.o.d -o
> modules/sfm/src/libmv/libmv/multiview/CMakeFiles/multiview.dir/fundamental.
> cc.o -c
> /var/tmp/portage/media-libs/opencv-4.5.1/work/opencv_contrib-4.5.1/modules/
> sfm/src/libmv_light/libmv/multiview/fundamental.cc

AFAICS it's file 29 which causes the ICE, as stated in my initial comment. The log shows no error after file 30. IMO it's stopping there, because of -j2 MAKEOPTS. I can try to verify this by using -j1, of course.


Will follow the Gcc-ICE wiki page and try to get more meaningful results.
Comment 10 Bernd 2021-04-13 04:29:42 UTC
Hmm... weird. Using -j1, the package builds just fine, although the error happened several times when using multiple cores to build, before I filed the bug. Closing the bug then.
Didn't even have to rebuild nvcc.
Comment 11 Bernd 2021-04-13 17:27:52 UTC
Just noticed I still used 10.2.0 for the test in comment #10.

I verified, the package indeed fails at the file noted in the description comment #0 when build with -j1.

Rebuilding nvcc is not possible, as it's a binary package, as noted by me in comment #8. However, I noticed from the pkg_postinst_check message, current cuda-11 versions in the tree only support up to gcc-10.2. This is probably the reason for the crash. Because I need cuda support for several apps, I'm masking 10.3.0 for now.
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-13 18:45:28 UTC
Do you pan to extract preprocessed file or we should keep the bug closed?
Comment 13 Bernd 2021-04-13 18:56:31 UTC
I think we should keep it closed for now, as nvidia-cuda-toolkit-11 is incompatible with gcc-10.3.0. Once it get's updated to support this version and the issue still remains, we can reopen it.