/usr/bin/ld: cannot find -l/usr/lib/libopencv_contrib.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_legacy.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_objdetect.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_calib3d.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_features2d.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_video.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_highgui.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_ml.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_imgproc.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_flann.so.2.3.1
/usr/bin/ld: cannot find -l/usr/lib/libopencv_core.so.2.3.1
collect2: ld returned 1 exit status
make: * [DisplayImage] Error 1
To solve the problem, the method that works on my computer is to create an additional .pc file at /usr/lib/pkgconfig/opencv.pc with the following contents.[1]
1: # Package Information for pkg-config
2: prefix=/usr
3: exec_prefix=${prefix}
4: libdir=${exec_prefix}/lib
5: includedir_old=${prefix}/include/opencv-2.3.1/opencv
6: includedir_new=${prefix}/include/opencv-2.3.1
7: Name: OpenCV
8: Description: Open Source Computer Vision Library
9: Version: 2.3.1
10: Libs: -L${libdir} -lopencv_contrib -lopencv_legacy -lopencv_objdetect -lopencv_calib3d -lopencv_features2d -lopencv_video -lopencv_highgui -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core
11: Cflags: -I${includedir_old} -I${includedir_new}
Reference
[1]about compiling opencv programs outside ROS, http://answers.ros.org/question/11916/about-compiling-opencv-programs-outside-ros
[2]Ticket #1475, https://code.ros.org/trac/opencv/ticket/1475
No comments:
Post a Comment