specify openCV version ROS melodic, Ubuntu 18.04
Hello everyone,
I am a bit confused here, the problem which happens to me is, I have made a ROS node some time ago, the node has been working just fine, until recently I decided to install the new openCV 4.3
(cloned and installed from source). I have done it because I wanted to use the third party library which I wanted to depend on the openCV 4.3
so I can have some additional options. In my node's CMakeList.txt
I have defined OpenCV_DIR
to point the OpenCVConfig.cmake
of the openCV4.3
. I think this went through just fine.
From what I know, the Ubuntu 18.04 comes with already installed OpenCV3.2
and this is the version which is used by the cv_bridge
package.
When I run the node the problem which happens is:
OpenCV Error: Assertion failed (tlsSlots.size() > slotIdx) in releaseSlot, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/system.cpp, line 1092 terminate called after throwing an instance of 'cv::Exception' what(): /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/system.cpp:1092: error: (-215) tlsSlots.size() > slotIdx in function releaseSlot
If I have to guess I would say this is because there are two conflict libraries loaded, after running:
ldd <binary> | grep libopencv_core
I got this back:
libopencv_core.so.3.2 => /usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2 (0x00007fe9de973000) libopencv_core.so.4.3 => /usr/local/lib/libopencv_core.so.4.3 (0x00007fe9db2e2000)
So this confirms the conflict between libraries, so since I have loaded the openCV 4.3 (with the third party library) I would say that the libopencv_core.so.3.2
is loaded because of the cv_bridge
package. cv_bridge
is used to get the image from the sensor_msgs::ImageConstPtr
and this image is given as an argument to the object of the third party library (which previously has been built with the opencv 4.3
)
I tried to debug and the cv_bridge works just fine, but when the third party object tries to execute certain functions, it raises a previously mentioned exception.
I think it is because of the conflict, do you guys have any idea how to fix this?
Or do you have any idea for a workaround? This is frustrating because I am using the cv_bridge only in one line, just to get the image for the third party library.
Thanks