Description
I have the following problem:
I am developing the library libmy_code.so
I need to link against a closed source library libclosed_source.so over which I have no control
libclosed_source.so is statically linked against opencv 3.2.0
libclosed_source.so has exported all symbols (also those from opencv 3.2.0 which I do not want)
My library libmy_code.so also needs the newer version opencv 3.4.11
I use CMake as the build system
See the following diagram
+-------------+
+--->|libmy_code.so+<-------+
| +-------------+ |
| |
Statically linked | |dynamically linked
| |
| |
| |
| |
| +-------+-----------+
| |libclosed_source.so|
| +-------------------+
| ^
| | Statically linked
| |
+---+---------+ +-----+------+
|OpenCV 3.4.11| |Opencv 3.2.0|
+-------------+ +------------+
Problem
My library libmy_code.so uses cv::resize. The CMake build system correctly locates cv::resize in the headers of OpenCV 3.4.11 (I use find_package(OpenCV) and point it to the opencv 3.4.11 install).
However the linker links cv::resize to libclosed_source.so (which contains the Opencv3.2.0 version of cv::resize statically).
My build system runs in a docker container which definitely does not have opencv 3.2.0.
The closest question I have found is this
How can I tell the linker not to linker opencv functions libmy_code.so to libclosed_source.so but directly to Opencv 3.4.11 ??