Closed matlabbe closed 2 months ago
When building rtabmap_ros
against rtabmap
with this PR (on Ubuntu 20.04 ROS Noetic with local version of OpenCV 4.2+Cuda shadowing OpenCV system binaries), we can get this error:
/usr/bin/ld: /usr/local/lib/libopencv_cudafeatures2d.so.4.2.0: undefined reference to `cv::cuda::device::ThrustAllocator::getAllocator()'
/usr/bin/ld: /usr/local/lib/libopencv_cudafeatures2d.so.4.2.0: undefined reference to `cv::cuda::StreamAccessor::getStream(cv::cuda::Stream const&)'
It seems to be because during linking (see with make VERBOSE=1
), the binary /usr/lib/x86_64-linux-gnu/libopencv_core.so.4.2.0
is in the list (because of ros dependency cv_bridge) before /usr/local/lib/libopencv_core.so.4.2.0
, so cuda core functions are not found. Well, a workaround if we don't want to rebuild cv_bridge is to make a symlink from /usr/lib/x86_64-linux-gnu/libopencv_core.so.4.2.0
to /usr/local/lib/libopencv_core.so.4.2.0
(backup original binary file to revert afterwards) like this:
/usr/lib/x86_64-linux-gnu$ ls -l libopencv_core*
-rw-r--r-- 1 root root 9124066 Feb 17 2020 libopencv_core.a
lrwxrwxrwx 1 root root 21 Feb 17 2020 libopencv_core.so -> libopencv_core.so.4.2
lrwxrwxrwx 1 root root 38 Aug 29 16:50 libopencv_core.so.4.2 -> /usr/local/lib/libopencv_core.so.4.2.0
lrwxrwxrwx 1 root root 38 Aug 29 16:51 libopencv_core.so.4.2.0 -> /usr/local/lib/libopencv_core.so.4.2.0
-rw-r--r-- 1 root root 3840856 Feb 17 2020 libopencv_core.so.4.2.0.back
Note that this would only work if you rebuild exactly the same OpenCV version than the system one to avoid any conflicts.
Loop closure performance comparison with CudaSift (pretty similar to OpenCV's SURF and SIFT):
These new features are available if built with OpenCV CUDA.
New features:
GFTT/Gpu=true
Vis/CorFlowGpu=true
Stereo/Gpu=true
SIFT/Gpu=true
--Odom/Strategy 1 --Vis/CorFlowGpu true --Vis/CoreType 1 --Stereo/Gpu true --GFTT/Gpu true --Vis/BundleAdjustment 0
Use this fork to build CudaSift: https://github.com/matlabbe/CudaSift