Hello, opencv[cuda] installs opencv.pc file with cuda libraries in Libs, but lacks path to cuda libs: Libs: ${exec_prefix}/lib64/libopencv_calib3d.so ${exec_prefix}/lib64/libopencv_contrib.so ${exec_prefix}/lib64/libopencv_core.so ${exec_prefix}/lib64/libopencv_features2d.so ${exec_prefix}/lib64/libopencv_flann.so ${exec_prefix}/lib64/libopencv_gpu.so ${exec_prefix}/lib64/libopencv_highgui.so ${exec_prefix}/lib64/libopencv_imgproc.so ${exec_prefix}/lib64/libopencv_legacy.so ${exec_prefix}/lib64/libopencv_ml.so ${exec_prefix}/lib64/libopencv_nonfree.so ${exec_prefix}/lib64/libopencv_objdetect.so ${exec_prefix}/lib64/libopencv_photo.so ${exec_prefix}/lib64/libopencv_stitching.so ${exec_prefix}/lib64/libopencv_superres.so ${exec_prefix}/lib64/libopencv_ts.a ${exec_prefix}/lib64/libopencv_video.so ${exec_prefix}/lib64/libopencv_videostab.so -lcufft -lcublas -lnpps -lnppi -lnppc -lcudart -ltbb /usr/lib64/libXext.so /usr/lib64/libX11.so /usr/lib64/libICE.so /usr/lib64/libSM.so /usr/lib64/libGL.so /usr/lib64/libGLU.so -lrt -lpthread -lm -ldl This results to link failure for packages using this pkg file, e.g. media-plugins/frei0r-plugins-1.4[facedetect]: cd /var/tmp/portage/media-plugins/frei0r-plugins-1.4/work/frei0r-plugins-1.4_build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /var/tmp/portage/media-plugins/frei0r-plugins-1.4/work/frei0r-plugins-1.4 /var/tmp/portage/media-plugins/frei0r-plugins-1.4/work/frei0r-plugins-1.4/src/filter/alpha0ps /var/tmp/portage/media-plugins/frei0r-plugins-1.4/work/frei0r-plugins-1.4_build /var/tmp/portage/media-plugins/frei0r-plugins-1.4/work/frei0r-plugins-1.4_build/src/filter/alpha0ps /var/tmp/portage/media-plugins/frei0r-plugins-1.4/work/frei0r-plugins-1.4_build/src/filter/alpha0ps/CMakeFiles/alphaspot.dir/DependInfo.cmake --color= /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lcufft /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lcublas /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lnpps /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lnppi /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lnppc /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lcudart collect2: error: ld returned 1 exit status
Created attachment 390620 [details] build.log A build.log for media-plugins/frei0r-plugins-1.4[facedetect] using opencv.pc pkg-config file.
Created attachment 390622 [details] emerge --info
Created attachment 390624 [details] opencv.pc Pkg-config file from opencv-2.4.9 which was configured as follows: Installed versions: 2.4.9{tbz2}(07:38:16 AM 11/05/2014)(cuda doc eigen examples ffmpeg gstreamer gtk jpeg jpeg2k opencl openexr opengl openmp png qt4 threads tiff v4l -ieee1394 -ipp -java -pch -python -testprograms -vtk -xine ELIBC="-FreeBSD" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7") dev-util/nvidia-cuda-toolkit-6.5.14 is installed. Can't use 6.5.19, since it requires >=x11-drivers/nvidia-drivers-343.22[uvm] which doesn't support my GPU.
The argument -L/opt/cuda/lib64 Should maybe done in src_install() or pkg_preinst()?
I am sorry for the incomplete comment... The argument -L/opt/cuda/lib64 is missing in the opencv.pc file. Should maybe done in src_install() or pkg_preinst()?
Probably the best way is to fix cmake files, but I get lost there... As for a workaround, src_install() looks good for me.
Created attachment 398100 [details, diff] opencv-2.4.9-cuda-pkg-config.patch The attached patch fixes the build system to add "-L" entries to the pkg-config lib flags. On my system this resolves to "-L/opt/cuda/lib64". Afterwards, media-video/vlc[opencv] builds fine (where it would fail earlier).
(In reply to Quentin Minster from comment #7) > Created attachment 398100 [details, diff] [details, diff] > opencv-2.4.9-cuda-pkg-config.patch > > The attached patch fixes the build system to add "-L" entries to the > pkg-config lib flags. On my system this resolves to "-L/opt/cuda/lib64". > Afterwards, media-video/vlc[opencv] builds fine (where it would fail > earlier). It worked for me. I just commited it. Looks like it will be fine for now. Thanks Amy