How to fix OpenCV x ROS/cv_bridge version issues?
Hi,
After reading the questions #q352756, #q382266 and #q293333. I believe the issue I am having:
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
Is sort of conflict between different OpenCV versions/installations, as suggested in the answers for the question #q385309 I made a few days ago. I have installed OpenCV (for C++) from this tutorial, but it looks like ROS melodic (or Ubuntu 18?) come with a built-in OpenCV lib, to be used together. Is my understanding OK?
When I ran locate OpenCVConfig.cmake
I got:
/home/user/.local/share/Trash/files/opencv/cmake/templates/OpenCVConfig.cmake.in
/home/user/.local/share/Trash/files/opencv.2/build/OpenCVConfig.cmake
/home/user/.local/share/Trash/files/opencv.2/build/unix-install/OpenCVConfig.cmake
/home/user/.local/share/Trash/files/opencv.2/opencv-master/cmake/templates/OpenCVConfig.cmake.in
/opt/opencv/cmake/templates/OpenCVConfig.cmake.in
/opt/opencv/release/OpenCVConfig.cmake
/opt/opencv/release/unix-install/OpenCVConfig.cmake
/usr/local/lib/cmake/opencv4/OpenCVConfig.cmake
/usr/share/OpenCV/OpenCVConfig.cmake
And specially for the last 4 lines, I think I have at least two different installations of OpenCV. How can I fix it, in order to have just one (the ros-suitable one)?
I can be also good to mention:
the output for pkg-config --modversion opencv
is:
3.2.0
and for sudo apt-get install libopencv-dev
is:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libopencv-dev is already the newest version (3.2.0+dfsg-4ubuntu0.1).
The following packages were automatically installed and are no longer required:
libc-ares2 libgraphviz-dev libgvc6-plugins-gtk libhttp-parser2.7.1 libllvm7 libnvidia-cfg1-455 libnvidia-common-455 libnvidia-compute-455 libnvidia-compute-455:i386 libnvidia-decode-455
libnvidia-decode-455:i386 libnvidia-encode-455 libnvidia-encode-455:i386 libnvidia-extra-455 libnvidia-fbc1-455 libnvidia-fbc1-455:i386 libnvidia-gl-455 libnvidia-gl-455:i386 libnvidia-ifr1-455
libnvidia-ifr1-455:i386 libopenal-dev libqtpropertybrowser4 libxdot4 linux-hwe-5.4-headers-5.4.0-54 linux-hwe-5.4-headers-5.4.0-56 linux-hwe-5.4-headers-5.4.0-58 linux-hwe-5.4-headers-5.4.0-59
linux-hwe-5.4-headers-5.4.0-60 linux-hwe-5.4-headers-5.4.0-62 linux-hwe-5.4-headers-5.4.0-65 linux-hwe-5.4-headers-5.4.0-66 linux-hwe-5.4-headers-5.4.0-67 linux-hwe-5.4-headers-5.4.0-70
linux-hwe-5.4-headers-5.4.0-72 linux-hwe-5.4-headers-5.4.0-73 linux-hwe-5.4-headers-5.4.0-74 linux-hwe-5.4-headers-5.4.0-77 nodejs-doc nvidia-compute-utils-455 nvidia-dkms-455 nvidia-utils-455
xserver-xorg-video-nvidia-455
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Did you see #q289264?
Hi, To be honest I checked it i the previous topic you suggested, but not understood well. I will try to follow those steps. Perhaps I'll point it out if something goes wrong.
Thanks.
Hi, @gvdhoom, I tried to: -Completely remove ROS from my System. -Remove all the OpenCV installations that I did. Then, no ROS, no Open CV. I just installed ROS again.
It seems to install a open CV with it:
And I can check there is an OpenCV installed after installing ROS. However, my catkin_make still not able to find its references...
I'm not sure I understand your last comment.
I tried to compile with the "natural" openCV installed with/by ROS, when reinstalling ROS. And it was giving the same compilation error.
I searched and set this "ROS-given" OpenCV manually, to be able to compile.
Since the error is now different:
Can I assume the main issue for this question is now gone? And then, close this question, for sure.
You've now most likely arrived at the situation we typically warn people about when they ask how to "upgrade to version X of dependency Y" (where Y is a library which gets set to a specific version by the ROS buildfarm).
The coredump is probably caused by an ABI incompatibility caused by linking two different versions of the same dependency to your node, or to one of its dependencies.
This would be the reason why you'd need to build all dependees from source.
But in that case, following the procedures you shared earlier in this thread. Should I clone OpenCV inside my WS and build it, instead of using the "ROS provided" OpenCV? If you see my original question and my last comment, looks like I could fix the mistake of having two different openCV installations. Now I have just the one installed with ROS.
Does this error I am having now (pure virtual stuff) seem to be a code error one? Because it is different from the version compatibility error I've had before purging ROS and OpenCV
I'm again unsure as to what you've done exactly. I interpreted:
to mean you have a from-source compiled OpenCV version (other than the one packaged by the ROS buildfarm) and have pointed CMake at it while building a ROS package which depends on OpenCV.
If that's not the case, then ignore my comment.