0

I am attempting to install libopencv-dev via apt-get install. So I ran

sudo apt-get install libopencv-dev

and it seems to install the package. However, when I inspect the directory where the lib files should be, I do not see them.

According to dpkg, this directory is /usr/lib/x86_64-linux-gnu. But the lib files are neither here nor are they anywhere else on my computer.

How do I troubleshoot this? I have already tried uninstalling and reinstalling libopencv-dev to no avail.

Compiling an opencv c++ program results in the following errors:

g++: error: /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_contrib.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_core.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_features2d.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_flann.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_gpu.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_highgui.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_legacy.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_ml.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_objdetect.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_ocl.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_photo.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_stitching.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_superres.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_ts.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_video.so: No such file or directory
g++: error: /usr/lib/x86_64-linux-gnu/libopencv_videostab.so: No such file or directory

I use pkg-config --cflags --libs to link the c++ program to the opencv libs. The output of running pkg-config --cflags --libs opencv is:

-I/usr/include/opencv /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so -lopencv_calib3d /usr/lib/x86_64-linux-gnu/libopencv_contrib.so -lopencv_contrib /usr/lib/x86_64-linux-gnu/libopencv_core.so -lopencv_core /usr/lib/x86_64-linux-gnu/libopencv_features2d.so -lopencv_features2d /usr/lib/x86_64-linux-gnu/libopencv_flann.so -lopencv_flann /usr/lib/x86_64-linux-gnu/libopencv_gpu.so -lopencv_gpu /usr/lib/x86_64-linux-gnu/libopencv_highgui.so -lopencv_highgui /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so -lopencv_imgproc /usr/lib/x86_64-linux-gnu/libopencv_legacy.so -lopencv_legacy /usr/lib/x86_64-linux-gnu/libopencv_ml.so -lopencv_ml /usr/lib/x86_64-linux-gnu/libopencv_objdetect.so -lopencv_objdetect /usr/lib/x86_64-linux-gnu/libopencv_ocl.so -lopencv_ocl /usr/lib/x86_64-linux-gnu/libopencv_photo.so -lopencv_photo /usr/lib/x86_64-linux-gnu/libopencv_stitching.so -lopencv_stitching /usr/lib/x86_64-linux-gnu/libopencv_superres.so -lopencv_superres /usr/lib/x86_64-linux-gnu/libopencv_ts.so -lopencv_ts /usr/lib/x86_64-linux-gnu/libopencv_video.so -lopencv_video /usr/lib/x86_64-linux-gnu/libopencv_videostab.so -lopencv_videostab
  • 1
    AFAIK libopencv-dev itself doesn't provide any libraries (although its dependencies do). What is the actual problem you are trying to solve? What is your Ubuntu version? – steeldriver Apr 20 '19 at 2:08
  • My Ubuntu version is 16.04. I am trying to compile a c++ program that requires opencv, but it fails to compile because none of the opencv libraries are found. When I run dpkg -l, it indicates that all the opencv packages are installed, but I don't see the libraries anywhere. – Guilty Spark Apr 20 '19 at 14:37
  • Please edit your question to include the compiler command that is failing, along with the error message. Also the output of pkg-config --cflags --libs opencv – steeldriver Apr 20 '19 at 14:41
  • Well although it seems like pkg-config is broken in OpenCV-2.4.0 and later (it should be using -L/usr/lib/x86_64-linux-gnu/ rather than prepending the individual library paths) that doesn't seem to stop it working. All I can suggest is that you autoremove the dependent packages and try again i.e. sudo apt autoremove libopencv-dev followed by sudo apt install libopencv-dev – steeldriver Apr 20 '19 at 21:49
1

When you remove libopencv-dev some opencv lib are not removed, running:

sudo apt list --installed | grep opencv

You can check if some lib is still there and remove it. Then you can try to reinstall libopencv.
This could help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.