shared libraries conflict

asked 2020-04-25 07:21:57 -0600

andrei186 gravatar image

OpenCV.3.4.10 on Ubuntu 18.04

To use findTransformECC I had to install libopencv_video.so.3.4.10 As a result all my other cpp, which worked well with the libraries mentioned below, now compile with warning:

/usr/bin/ld: warning: libopencv_imgproc.so.3.4, needed by /OpenCV-3.4/lib/libopencv_highgui.so, may conflict with libopencv_imgproc.so.3.2

   /usr/bin/ld: warning: libopencv_core.so.3.4, needed by /OpenCV-3.4/lib/libopencv_highgui.so, may conflict with libopencv_core.so.3.2

Running the compiled file aborts saying:

error loading shared libraries: libopencv_highgui.so.3.4: cannot open shared object file: No such file or directory

In my /OpenCV-3.4/lib/ I have all these .so files in three versions so, so.3.4 and so.3.4.10 but no so.3.2

Can someone explain what is going on and how to fix it?

edit retag flag offensive close merge delete

Comments

You'll be better to upgrade to OpenCV 4

supra56 gravatar imagesupra56 ( 2020-04-25 07:32:27 -0600 )edit
1

More details. Though there is no libopencv_core.so.3.2 in my installation/OpenCV-3.4/lib, file search found it in /lib/x86_64-linux-gnu. By the time-stamp it was created exactly after (and probably as a result of) installation of libopencv-video-dev.

gcc -m64 -Xlinker --verbose  2>/dev/null | grep SEARCH | sed 's/SEARCH_DIR("=\?\([^"]\+\)"); */\1\n/g'  | grep -vE '^$'

returned 12 pathes, /lib/x86_64-linux-gnu being the second one.

My compile script in a makefile:

SOURCE=test_homography
all:
sudo g++ $(SOURCE).cpp -o $(SOURCE) -I /home/a/Downloads/installation/OpenCV-3.4/include -L /home/a/Downloads/installation/OpenCV-3.4/lib -lopencv_core  -lopencv_highgui -lopencv_photo -lopencv_videoio -lopencv_imgproc  -lopencv_calib3d  $(pkg-config opencv --cflags --libs)
andrei186 gravatar imageandrei186 ( 2020-04-25 08:26:47 -0600 )edit
1

It looks like ld takes all these shared libraries from my installation/OpenCV-3.4/lib. But ignores libopencv_core.so, libopencv_core.so.3.4 and libopencv_core.so.3.4.10 sitting here. It goes to /lib/x86_64-linux-gnu and picks up libopencv_core.so.3.2 which conflicts with libopencv_core.so.3.4 demanded by libopencv_highgui.so

Why this strated happening after installing libopencv-video-dev and how to fix it?

andrei186 gravatar imageandrei186 ( 2020-04-26 11:18:02 -0600 )edit