Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

linker and different versions of shared libraries

After installing a missing openCV shared library, linker (ld) suddenly started complaining about conflicting versions of others shared libraries and about not being able to find a library though the library is sitting where it should be sitting together with other libraries.

Trying to understand this I understood that I do not understand basic things about OpenCV, which I cannot find neither in OpenCV documentation nor in numerous tutorials.

After installing OpenCV 3.4.10 C++ on my Ubuntu 18.04 in my "Home/a/Downloads" directory I have got:

  1. Directory "installation/OpenCV-3.4/lib" (as was set in CMAKE_INSTALL_PREFIX during installation). It contains shared libraries in three versions libopencv_xxx.so, libopencv_xxx.so.3.4 and libopencv_xxx.so.3.4.10

  2. Alongside "installation/OpenCV-3.4/lib" there is "opencv/build/lib populated with the same set of libopencv_xxx.so as installation/OpenCV-3.4/lib. It also contains a folder named python3 from which I guess these might be the same libraries but for Python and I may ignore them (or even delete) as long as I use C++.

  3. In root "/usr/lib/x86_64-linux-gnu/" there is the third set of the same libraries, but versions 3.2 I do not know where they came from and why got into this folder, but suspect it was a result of installation of the missing library, I mentioned in the beginning, which happened to be libopencv-video-dev_3.2.0

Questions:

  1. If a certain libopencv_xxx.so shows up in my installation/OpenCV-3.4/lib, does it mean that this library is installed?
  2. A library is installed using apt-get install libopencv-xxx-dev. I understand that during installation libopencv-xxx-dev and other libs, required by it, are downloaded and placed in my installation/OpenCV-3.4/lib. Is there anything else happening? Perhaps some entries are added to some system files or something like that?

  3. My g++ compile command includes path "installation/OpenCV-3.4/lib" and a list of libraries -lopencv_core -lopencv_highgui etc. I understand that the linker first searches installation/OpenCV-3.4/lib where it finds 3 versions of each library. Which version does it select? Is it possible to control the choice the linker is making? Or perhaps I should delete all the versions other than the version of OpenCV installed, i.e. 3.4.10 ?

linker and different versions of shared libraries

After installing a missing openCV shared library, linker (ld) suddenly started complaining about conflicting versions of others shared libraries and about not being able to find a library though the library is sitting where it should be sitting together with other libraries.

Trying to understand this I understood that I do not understand basic things about OpenCV, which I cannot find neither in OpenCV documentation nor in numerous tutorials.

After installing OpenCV 3.4.10 C++ on my Ubuntu 18.04 in my "Home/a/Downloads" "/home/a/Downloads" directory I have got:

  1. Directory "installation/OpenCV-3.4/lib" (as was set in CMAKE_INSTALL_PREFIX during installation). It contains shared libraries in three versions libopencv_xxx.so, libopencv_xxx.so.3.4 and libopencv_xxx.so.3.4.10

  2. Alongside "installation/OpenCV-3.4/lib" there is "opencv/build/lib populated with the same set of libopencv_xxx.so as installation/OpenCV-3.4/lib. It also contains a folder named python3 from which I guess these might be the same libraries but for Python and I may ignore them (or even delete) as long as I use C++.

  3. In root "/usr/lib/x86_64-linux-gnu/" there is the third set of the same libraries, but versions 3.2 I do not know where they came from and why got into this folder, but suspect it was a result of installation of the missing library, I mentioned in the beginning, which happened to be libopencv-video-dev_3.2.0

Questions:

  1. If a certain libopencv_xxx.so shows up in my installation/OpenCV-3.4/lib, does it mean that this library is installed?
  2. A library is installed using apt-get install libopencv-xxx-dev. I understand that during installation libopencv-xxx-dev and other libs, required by it, are downloaded and placed in my installation/OpenCV-3.4/lib. Is there anything else happening? Perhaps some entries are added to some system files or something like that?

  3. My g++ compile command includes path "installation/OpenCV-3.4/lib" and a list of libraries -lopencv_core -lopencv_highgui etc. I understand that the linker first searches installation/OpenCV-3.4/lib where it finds 3 versions of each library. Which version does it select? Is it possible to control the choice the linker is making? Or perhaps I should delete all the versions other than the version of OpenCV installed, i.e. 3.4.10 ?