I'm working on a project that generates a library C++ that will be shared to other teams.
- This library depends on OpenCV
To develop this I'm using a Docker image based on Ubuntu and installing libopencv-dev
:
FROM ubuntu:22.04 as baseENV DEBIAN_FRONTEND noninteractiveRUN apt -q update -y && apt -q install -y \ build-essential \ cmake \ gdb \ wget \ libopencv-dev \ ffmpeg \ libavformat-dev \ libavcodec-dev \ libswscale-dev
Then I use a CMakelists.txt
file to deal with the compilation, the lines I use for OpenCV are:
SET(MY_OPENCV_COMPONENTS photo objdetect imgproc features2d core)find_package(OpenCV COMPONENTS ${MY_OPENCV_COMPONENTS} )message(STATUS "OpenCV libraries: ${OpenCV_LIBS}")
This works great and generates a file my_lib.so
with our functionalities.
The ProblemAfter sending my_lib.so
to other teams they complained about it depending on the debug version of OpenCV and them needing the release version. Which makes sense.
I tested this using:
ldd my_lib.so | grep open libopencv_calib3d.so.4.5d => /lib/x86_64-linux-gnu/libopencv_calib3d.so.4.5d (0x000072082f29a000) libopencv_features2d.so.4.5d => /lib/x86_64-linux-gnu/libopencv_features2d.so.4.5d (0x000072082f1e4000) libopencv_imgcodecs.so.4.5d => /lib/x86_64-linux-gnu/libopencv_imgcodecs.so.4.5d (0x000072082f18b000) libopencv_imgproc.so.4.5d => /lib/x86_64-linux-gnu/libopencv_imgproc.so.4.5d (0x000072082ec5e000) libopencv_core.so.4.5d => /lib/x86_64-linux-gnu/libopencv_core.so.4.5d (0x000072082e8ee000) libopencv_flann.so.4.5d => /lib/x86_64-linux-gnu/libopencv_flann.so.4.5d (0x000072082e325000) libopenjp2.so.7 => /lib/x86_64-linux-gnu/libopenjp2.so.7 (0x000072082df32000)
Which actually shows the OpenCV libraries in Debug mode.
- So, how do I use the Release version?
- I tried installing
python3-opencv
instead, but still got the libs withd
denoting debug. - I want to avoid compiling the source code myself to be generic.
- I tried to look for compiled binaries for Ubuntu online with no luck.