I have successfully built and installed the opencv lib. Now I am trying to use these libs in my application but I keep getting link errors. I am using:
pkg-config --libs opencv
When I run this on the command line I can see the output. It list a lot of libraries but not all of them are listed with the absolute path specified. For example, here is a partial output:
libippcc_l.a libippvm_l.a tbb rt pthread m dl /usr/lib/libXext.s stdc++
And when I build my app I get link errors. Here is a partial output:
g++: libipps_l.a: No such file or directory
g++: libippi_l.a: No such file or directory
g++: libippcv_l.a: No such file or directory
g++: libippcc_l.a: No such file or directory
g++: libippvm_l.a: No such file or directory
g++: tbb: No such file or directory
g++: rt: No such file or directory
g++: pthread: No such file or directory
g++: m: No such file or directory
g++: dl: No such file or directory
g++: stdc++: No such file or directory
It appears that the linker cannot resolve the libraries that do not include an absolute path which seems reasonable. But my confusion is why dosn’t the output from pkg-config include the absolute path for all of its libs? When I do NOT use “pkg-config –libs opencv” on the build line, the libraries for intel ipp, pthread, m, stdc++, etc gets resolved properly and the app builds fine because I also have them specified on the link line as: “-lpthread -lstdc++” … etc. These are positioned on the link line AFTER the I specify: “pkg –libs opencv”
But using “pkg-config –libs opencv” screws up the resolution.
I have run “ldconfig” from the command line to update all of the symbolic links in my libs directories but this did not resolve this problem.
Any help would be greatly appreciated.
If
pkg-config --libs opencvis outputting that, then you have a problem. Maybe a previous installation of OpenCV broke it, or maybe you are not using a version recent enough, or maybe it wasn’t compiled successfully, or maybe there’s a problem with the newest version from the repository.Anyway, I’m using OpenCV 2.3.1 on Mac OS X and
pkg-config --libs opencvoutputs the following info:You can try to compile your application by hand to see if anything else is broken:
Note that your install might have placed OpenCV headers and libraries in different directories.