I am building a library that internally uses OpenCV. On my development machine I have OpenCV 3.2 installed, but on some my target machines the version of OpenCV is 3.3.1. (And I cannot control what version my clients will install on their machines) As far as I know there is a general rule that two versions of a library with the same major version number should be ABI compatible. So my first question is: does OpenCV conform to this rule? Is the answer different for C and C++ interfaces? (Then I would change my code so that it will use only C functions)
(The partial answer I have found here - it says OpenCV 3.3.0 is 99.88% backward compatible and 3.3.1 is 95.78% backward compatible so given I ma using very limited subset of the entire OpenCV, I think I have good chances that my library will work with both versions.)
If it does (at least for C interface) then I have second question:
- The output of "objdump -p /usr/lib/libopencv_core.so.3.2" shows "SONAME libopencv_core.so.3.2", which leads to:
- when my library is built the result of "ldd libMyLib.so" shows "libopencv_core.so.3.2" So why is OpenCV built with "soname" indicating version "3.2" and not just "3"?
I have downloaded OpenCV sources and built them on my PC. I see "CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG=-Wl,-soname, " in the generated CMakeVars.txt file. Is there a way to configure cmake so that library will be built with -soname indicating only major version "3"? Or maybe there is a way to tell my linker to set DT_NEEDED field of my library so that it's run-time requirement will be relaxed?