Created attachment 459074 [details] emerge --info media-libs/opencv-2.4.12-r1 emerge failure if cuda USE flag is enabled. This is the error: /opt/cuda/bin/nvcc /var/tmp/portage/media-libs/opencv-2.4.12-r1/work/opencv-2.4.12/modules/core/../dynamicuda/src/cuda/matrix_operations.cu -c -o /var/tmp/portage/media-libs/opencv-2.4.12-r1/work/opencv-2.4.12_build/modules/core/CMakeFiles/cuda_compile.dir/__/dynamicuda/src/cuda/./cuda_compile_generated_matrix_operations.cu.o -ccbin /usr/bin/x86_64-pc-linux-gnu-gcc -m64 -DUSE_CUDA -Xcompiler ,\"-O2\",\"-pipe\",\"-march=corei7\",\"-w\",\"-fsigned-char\",\"-W\",\"-Wall\",\"-Werror=return-type\",\"-Werror=address\",\"-Werror=sequence-point\",\"-Wformat\",\"-Werror=format-security\",\"-Wmissing-declarations\",\"-Winit-self\",\"-Wpointer-arith\",\"-Wno-narrowing\",\"-Wno-unnamed-type-template-args\",\"-Wno-array-bounds\",\"-Wno-aggressive-loop-optimizations\",\"-fdiagnostics-show-option\",\"-Wno-long-long\",\"-pthread\",\"-ffunction-sections\",\"-fopenmp\",\"-Wno-undef\",\"-Wno-shadow\",\"-Wno-unused-but-set-variable\" -gencode arch=compute_11,code=sm_11 -gencode arch=compute_12,code=sm_12 -gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_20,code=sm_21 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_30,code=compute_30 -Xcompiler -DCVAPI_EXPORTS -Xcompiler -fPIC -DNVCC -I/opt/cuda/include -I/var/tmp/portage/media-libs/opencv-2.4.12-r1/work/opencv-2.4.12/modules/gpu/include -I/var/tmp/portage/media-libs/opencv-2.4.12-r1/work/opencv-2.4.12/modules/dynamicuda/include -I/var/tmp/portage/media-libs/opencv-2.4.12-r1/work/opencv-2.4.12_build/modules/core -I/var/tmp/portage/media-libs/opencv-2.4.12-r1/work/opencv-2.4.12/modules/core/src -I/var/tmp/portage/media-libs/opencv-2.4.12-r1/work/opencv-2.4.12/modules/core/include -I/var/tmp/portage/media-libs/opencv-2.4.12-r1/work/opencv-2.4.12_build -I/usr/include -I/usr/include/eigen3 -I/opt/cuda/include nvcc warning : The 'compute_11', 'compute_12', 'compute_13', 'sm_11', 'sm_12', and 'sm_13' architectures are deprecated, and may be removed in a future release. ptxas /var/tmp/portage/media-libs/opencv-2.4.12-r1/temp/tmpxft_000008bc_00000000-20_matrix_operations.compute_11.ptx, line 614; warning : Double is not supported. Demoting to float ptxas /var/tmp/portage/media-libs/opencv-2.4.12-r1/temp/tmpxft_000008bc_00000000-17_matrix_operations.compute_12.ptx, line 614; warning : Double is not supported. Demoting to float /usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’: /usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope return (char *) memcpy (__dest, __src, __n) + __n; ^ I attach: the output of emerge --info build log a patch to solve the issue
Created attachment 459076 [details] build log
Created attachment 459078 [details, diff] opencv-2.4.12-cuda.patch
The issue was first reported on the forum: https://forums.gentoo.org/viewtopic-p-8013696.html but for an unstable version version of opencv. The issue happens also with the stable version (2.4.12-r1), if cuda is enabled
(In reply to Patrik Osgnach from comment #3) > The issue was first reported on the forum: > https://forums.gentoo.org/viewtopic-p-8013696.html > > but for an unstable version version of opencv. The issue happens also with > the stable version (2.4.12-r1), if cuda is enabled Can you please confirm this also happens with opencv 2.4.13 ?
(In reply to Amy Liffey from comment #4) > (In reply to Patrik Osgnach from comment #3) > > The issue was first reported on the forum: > > https://forums.gentoo.org/viewtopic-p-8013696.html > > > > but for an unstable version version of opencv. The issue happens also with > > the stable version (2.4.12-r1), if cuda is enabled > > Can you please confirm this also happens with opencv 2.4.13 ? Hello Amy, unfortunately I cannot reproduce the issue even with opencv 2.4.12-r1 anymore. After the bug report, I updated glibc to 2.23-r3, so the two things might be related
ADDENDUM: ok, I forgot one thing. It builds fine with glibc-2.22-r4 but it doesn't with glibc-2.23-r3 if the selected gcc version is < 4.9 (the ebuild will disable cuda if gcc is >= 4.9) So, to reproduce, you need: glibc-2.23-r3 gcc-4.8.5 (enabled via gcc-config) use flag enabled for opencv as a reference, I am trying to build opencv in this way [ebuild N ~] media-libs/opencv-2.4.13:0/2.4::gentoo USE="cuda eigen ffmpeg gtk jpeg opencl opengl openmp png python qt4 tiff -examples -gstreamer -ieee1394 (-ipp) -java -jpeg2k -libav -openexr -pch -qt5 -testprograms -threads -v4l -vtk -xine" PYTHON_TARGETS="python2_7" this applies to opencv 2.4.12-r1 2.4.13 and 3.1.0-r7 and it must be related to a change introduced in glibc-2.23-r3 in /usr/include/string.h as I see in this diff: --- string.h 2017-01-12 16:33:10.263571070 +0100 +++ string.h 2017-01-12 17:05:57.723723346 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -636,6 +636,25 @@ # endif #endif +#if defined __USE_GNU && defined __OPTIMIZE__ \ + && defined __extern_always_inline && __GNUC_PREREQ (3,2) +# if !defined _FORCE_INLINES && !defined _HAVE_STRING_ARCH_mempcpy + +#undef mempcpy +#undef __mempcpy +#define mempcpy(dest, src, n) __mempcpy_inline (dest, src, n) +#define __mempcpy(dest, src, n) __mempcpy_inline (dest, src, n) + +__extern_always_inline void * +__mempcpy_inline (void *__restrict __dest, + const void *__restrict __src, size_t __n) +{ + return (char *) memcpy (__dest, __src, __n) + __n; +} + +# endif +#endif + __END_DECLS #endif /* string.h */
Seems to not be valid since old gcc are masked.