[ros-users] [Discourse.ros.org] [General] OpenCV 3.3.1 is breaking builds in Kinetic

P. J. Reed ros.discourse at gmail.com
Mon Dec 11 20:41:04 UTC 2017



Apologies in advance for not asking this on ROS Answers, but it's been unusable all day and this is a somewhat pressing question.

After upgrading my Ubuntu Xenial / ROS Kinetic over the weekend, I noticed that the latest release included OpenCV 3.3.1, and now none of my packages that use OpenCV will build.  I'm having this issue on my workstation, but I've also reproduced the exact issue in a Docker container based on ros:kinetic.

Whenever I build a component that adds `${OpenCV_LIBRARIES}` to its `target_link_libraries` macro, the build fails saying there is "no rule to make target 'opencv_core-NOTFOUND'".  For example, if I clone and build [swri_geometry_util](https://github.com/swri-robotics/marti_common/tree/master/swri_geometry_util), also modifying it to print out the contents of catkin_LIBRARIES and OpenCV_LIBRARIES just before the error happens, I get this:

```
Starting  >>> swri_geometry_util                                                                                                                                                                                                            
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Warnings   << swri_geometry_util:cmake /workspace/logs/swri_geometry_util/build.cmake.000.log                                                                                                                                               
catkin_LIBRARIES: /opt/ros/kinetic/lib/libcv_bridge.so;/opt/ros/kinetic/lib/libopencv_core3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_imgproc3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_imgcodecs3.so.3.3.1;/opt/ros/kinetic/lib/libtf.so;/opt/ros/kinetic/lib/libtf2_ros.so;/opt/ros/kinetic/lib/libactionlib.so;/opt/ros/kinetic/lib/libmessage_filters.so;/opt/ros/kinetic/lib/libroscpp.so;/usr/lib/x86_64-linux-gnu/libboost_signals.so;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;/opt/ros/kinetic/lib/libxmlrpcpp.so;/opt/ros/kinetic/lib/libtf2.so;/opt/ros/kinetic/lib/libroscpp_serialization.so;/opt/ros/kinetic/lib/librosconsole.so;/opt/ros/kinetic/lib/librosconsole_log4cxx.so;/opt/ros/kinetic/lib/librosconsole_backend_interface.so;/usr/lib/x86_64-linux-gnu/liblog4cxx.so;/usr/lib/x86_64-linux-gnu/libboost_regex.so;/opt/ros/kinetic/lib/librostime.so;/opt/ros/kinetic/lib/libcpp_common.so;/usr/lib/x86_64-linux-gnu/libboost_system.so;/usr/lib/x86_64-linux-gnu/libboost_thread.so;/usr/lib/x86_
 64-linux-gnu/libboost_chrono.so;/usr/lib/x86_64-linux-gnu/libboost_date_time.so;/usr/lib/x86_64-linux-gnu/libboost_atomic.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libconsole_bridge.so
OpenCV_LIBRARIRES: opencv_core
cd /workspace/build/swri_geometry_util; catkin build --get-env swri_geometry_util | catkin env -si  /usr/bin/cmake /workspace/src/marti_common/swri_geometry_util --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/workspace/devel/.private/swri_geometry_util -DCMAKE_INSTALL_PREFIX=/opt/rtk/kinetic -DCMAKE_BUILD_TYPE=RelWithDebInfo; cd -
............................................................................................................................................................................................................................................
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Errors     << swri_geometry_util:make /workspace/logs/swri_geometry_util/build.make.000.log                                                                                                                                                 
make[2]: *** No rule to make target 'opencv_core-NOTFOUND', needed by '/workspace/devel/.private/swri_geometry_util/lib/libswri_geometry_util.so'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/swri_geometry_util.dir/all] Error 2
make: *** [all] Error 2
cd /workspace/build/swri_geometry_util; catkin build --get-env swri_geometry_util | catkin env -si  /usr/bin/make --jobserver-fds=6,7 -j; cd -
............................................................................................................................................................................................................................................
Failed     << swri_geometry_util:make              [ Exited with code 2 ]                                                                                                                                                                   
Failed    <<< swri_geometry_util                   [ 9.4 seconds ]
```

My CMAKE_PREFIX_PATH and LD_LIBRARY_PATH are set appropriately, and the opencv libs exist in /opt/ros/kinetic/lib/ .  If I manually downgrade to the 3.2.0 version of OpenCV, it works fine without any other changes.  I've tested this with a handful of different packages on both my workstation and in a Docker container, and it's the same behavior everywhere.

If I hand-edit `/opt/ros/kinetic/share/OpenCV-3.3.1/OpenCVConfig.cmake` to make it return absolute paths to libraries instead of just library names, it works fine.  I wouldn't think I should need to do that, and it worked fine with 3.2.0.

Am I missing something?  Did the way OpenCV should be included change in 3.3.1? 

On a related note, OpenCV 3.3 seems to have broken some other things, too.  See https://github.com/opencv/opencv_contrib/issues/1376 for an example.  I'm surprised that a major package that breaks backward compatibility was allowed to be released into Kinetic at this point.





---
[Visit Topic](https://discourse.ros.org/t/opencv-3-3-1-is-breaking-builds-in-kinetic/3384/1) or reply to this email to respond.




More information about the ros-users mailing list