This is on Ubuntu 18.04 running ROS2 Dashing. I built OpenCV from source, and did the ldconfig thing. But colcon keeps trying to use a different version.
The error is "missing: opencv_cudaarithm opencv_cudafilters":
Whole error message:
robotos@jetson-agx:~/ros2_ws$ colcon build
Starting >>> opencv_demos
--- stderr: opencv_demos
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenCV (missing: opencv_cudaarithm opencv_cudafilters)
(found suitable version "4.1.1", minimum required is "4")
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/lib/aarch64-linux-gnu/cmake/opencv4/OpenCVConfig.cmake:328 (find_package_handle_standard_args)
CMakeLists.txt:29 (find_package)
And yet, there they are:
robotos@jetson-agx:~/ros2_ws$ ls /usr/local/lib
a.out libopencv_highgui.so.4.2.0
cmake libopencv_imgcodecs.so
...
...
libopencv_core.so libopencv_optflow.so
libopencv_core.so.4.2 libopencv_optflow.so.4.2
libopencv_core.so.4.2.0 libopencv_optflow.so.4.2.0
libopencv_cudaarithm.so libopencv_phase_unwrapping.so
libopencv_cudaarithm.so.4.2 libopencv_phase_unwrapping.so.4.2
libopencv_cudaarithm.so.4.2.0 libopencv_phase_unwrapping.so.4.2.0
...
...
libopencv_cudafilters.so libopencv_quality.so
libopencv_cudafilters.so.4.2 libopencv_quality.so.4.2
libopencv_cudafilters.so.4.2.0 libopencv_quality.so.4.2.0
4.1.1 is the version I installed through apt. 4.2 is built from source.
Interestingly, if I just run cmake instead of colcon, that'll run to completion, so I guess CMake alone can find it. Although I'm unsure what to do with the resulting files, so I'd like to get colcon working.
A different machine (also 18.04 with Dashing) has no problem finding the cudaarithm and cudafilters modules.