Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 531198 - media-libs/opencv-2.4.9 USE=cuda installs broken pkg-config opencv.pc file
Summary: media-libs/opencv-2.4.9 USE=cuda installs broken pkg-config opencv.pc file
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Andreas K. Hüttel
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-30 03:08 UTC by Andrew Savchenko
Modified: 2015-03-05 12:13 UTC (History)
3 users (show)

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


Attachments
build.log (build.log,49.66 KB, text/x-log)
2014-11-30 03:09 UTC, Andrew Savchenko
Details
emerge --info (emerge.info,8.96 KB, text/plain)
2014-11-30 03:10 UTC, Andrew Savchenko
Details
opencv.pc (opencv.pc,1.20 KB, text/plain)
2014-11-30 03:13 UTC, Andrew Savchenko
Details
opencv-2.4.9-cuda-pkg-config.patch (file_531198.txt,373 bytes, patch)
2015-03-05 01:10 UTC, Quentin Minster
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Savchenko gentoo-dev 2014-11-30 03:08:30 UTC
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
Comment 1 Andrew Savchenko gentoo-dev 2014-11-30 03:09:56 UTC
Created attachment 390620 [details]
build.log

A build.log for media-plugins/frei0r-plugins-1.4[facedetect] using opencv.pc pkg-config file.
Comment 2 Andrew Savchenko gentoo-dev 2014-11-30 03:10:24 UTC
Created attachment 390622 [details]
emerge --info
Comment 3 Andrew Savchenko gentoo-dev 2014-11-30 03:13:30 UTC
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.
Comment 4 Marius Brehler 2014-12-01 23:09:03 UTC
The argument
  -L/opt/cuda/lib64

Should maybe done in src_install() or pkg_preinst()?
Comment 5 Marius Brehler 2014-12-01 23:09:36 UTC
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()?
Comment 6 Andrew Savchenko gentoo-dev 2014-12-02 03:54:45 UTC
Probably the best way is to fix cmake files, but I get lost there... As for a workaround, src_install() looks good for me.
Comment 7 Quentin Minster 2015-03-05 01:10:18 UTC
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).
Comment 8 Amy Liffey gentoo-dev 2015-03-05 12:13:26 UTC
(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