ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi previous me. I am still not sure how it works, but somehow I could make it work.

1. delete build and devel folder and recompile

Even after changing cmakelist, catkin_make still use previous package (I don't know why). Delete these folders can refresh some information and solve this problem.

2. Exclude /opt/ros/kinetic/lib/libopencv_core3.so.3.2.0; from catkin_LIBRARIES

After you told your opencv location to catkin_make, there is still ros-opencv reference information in that file. So, just delete that files using following command.

string(REPLACE "/opt/ros/kinetic/lib/libopencv_core3.so.3.2.0;" "" Modified_CLIBS "${catkin_LIBRARIES}")

Then, use this newly modified Modified_CLIBS instead of catkin_LIBRARIES.

For more detail, please look at my sample CMakeList.txt in test project. https://github.com/YoshiRi/ros_opencv_conflict

Hi previous me. I am still not sure how it works, but somehow I could make it work.

1. delete build and devel folder and recompile

Even after changing cmakelist, catkin_make still use previous package (I don't know why). Delete these folders can refresh some information and solve this problem.

2. Exclude /opt/ros/kinetic/lib/libopencv_core3.so.3.2.0; from catkin_LIBRARIES

After you told your opencv location to catkin_make, there is still ros-opencv reference information in that file. So, just delete that files using following command.

string(REPLACE "/opt/ros/kinetic/lib/libopencv_core3.so.3.2.0;" "" Modified_CLIBS "${catkin_LIBRARIES}")

Then, use this newly modified Modified_CLIBS instead of catkin_LIBRARIES.

For more detail, please look at my sample CMakeList.txt in test project. https://github.com/YoshiRi/ros_opencv_conflict

Ex. sometimes you need to exclude whole ros-opencv packages

I found in my another project, the method <2> do not work. So, I tried next ugly code, and it worked.

string(REPLACE "/opt/ros/kinetic/lib/libopencv_calib3d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_core3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_features2d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_flann3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_highgui3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_imgcodecs3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_imgproc3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ml3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_objdetect3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_photo3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_shape3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_stitching3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_superres3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_video3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_videoio3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_videostab3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_viz3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_aruco3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_bgsegm3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_bioinspired3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ccalib3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_cvv3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_datasets3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_dpm3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_face3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_fuzzy3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_hdf3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_line_descriptor3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_optflow3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_phase_unwrapping3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_plot3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_reg3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_rgbd3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_saliency3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_stereo3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_structured_light3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_surface_matching3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_text3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xfeatures2d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ximgproc3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xobjdetect3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xphoto3.so.3.2.0;" "" catkin_LIBRARIES "${catkin_LIBRARIES}")

Currently I just get this list from MESSAGE("${catkin_LIBRARIES}") but I should look for the better way to do this automatically.

Hi previous me. I am still not sure how it works, but somehow I could make it work.

1. delete build and devel folder and recompile

Even after changing cmakelist, catkin_make still use previous package (I don't know why). Delete these folders can refresh some information and solve this problem.

2. Exclude /opt/ros/kinetic/lib/libopencv_core3.so.3.2.0; from catkin_LIBRARIES

After you told your opencv location to catkin_make, there is still ros-opencv reference information in that file. So, just delete that files using following command.

string(REPLACE "/opt/ros/kinetic/lib/libopencv_core3.so.3.2.0;" "" Modified_CLIBS "${catkin_LIBRARIES}")

Then, use this newly modified Modified_CLIBS instead of catkin_LIBRARIES.

For more detail, please look at my sample CMakeList.txt in test project. https://github.com/YoshiRi/ros_opencv_conflict

Ex. sometimes you need to exclude whole ros-opencv packages

I found in my another project, the method <2> do not work. So, I tried next ugly code, and it worked.

string(REPLACE "/opt/ros/kinetic/lib/libopencv_calib3d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_core3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_features2d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_flann3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_highgui3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_imgcodecs3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_imgproc3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ml3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_objdetect3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_photo3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_shape3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_stitching3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_superres3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_video3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_videoio3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_videostab3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_viz3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_aruco3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_bgsegm3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_bioinspired3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ccalib3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_cvv3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_datasets3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_dpm3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_face3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_fuzzy3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_hdf3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_line_descriptor3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_optflow3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_phase_unwrapping3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_plot3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_reg3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_rgbd3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_saliency3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_stereo3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_structured_light3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_surface_matching3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_text3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xfeatures2d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ximgproc3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xobjdetect3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xphoto3.so.3.2.0;" "" catkin_LIBRARIES "${catkin_LIBRARIES}")

Currently I just get this list from MESSAGE("${catkin_LIBRARIES}") but I should look for the better way to do this automatically.

automatically. And I noticed it still using ros-opencv as a default by checking output from

std::cerr << "OpenCV version : " << CV_VERSION << std::endl;

still shows it using ros-opencv but somehow excluding whole libraries from ros do not cause trivial problem.

Hi previous me. I am still not sure how it works, but somehow I could make it work.

1. delete build and devel folder and recompile

Even after changing cmakelist, catkin_make still use previous package (I don't know why). Delete these folders can refresh some information and solve this problem.

2. Exclude /opt/ros/kinetic/lib/libopencv_core3.so.3.2.0; from catkin_LIBRARIES

After you told your opencv location to catkin_make, there is still ros-opencv reference information in that file. So, just delete that files using following command.

string(REPLACE "/opt/ros/kinetic/lib/libopencv_core3.so.3.2.0;" "" Modified_CLIBS "${catkin_LIBRARIES}")

Then, use this newly modified Modified_CLIBS instead of catkin_LIBRARIES.

For more detail, please look at my sample CMakeList.txt in test project. https://github.com/YoshiRi/ros_opencv_conflict

Ex. sometimes you need to exclude whole ros-opencv packages

I found in my another project, the method <2> do not work. So, I tried next ugly code, and it worked.

string(REPLACE "/opt/ros/kinetic/lib/libopencv_calib3d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_core3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_features2d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_flann3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_highgui3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_imgcodecs3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_imgproc3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ml3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_objdetect3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_photo3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_shape3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_stitching3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_superres3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_video3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_videoio3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_videostab3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_viz3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_aruco3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_bgsegm3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_bioinspired3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ccalib3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_cvv3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_datasets3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_dpm3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_face3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_fuzzy3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_hdf3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_line_descriptor3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_optflow3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_phase_unwrapping3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_plot3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_reg3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_rgbd3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_saliency3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_stereo3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_structured_light3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_surface_matching3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_text3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xfeatures2d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ximgproc3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xobjdetect3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xphoto3.so.3.2.0;" "" catkin_LIBRARIES "${catkin_LIBRARIES}")

Currently I just get this list from MESSAGE("${catkin_LIBRARIES}") but I should look for the better way to do this automatically. You can check which Opencv version your generated code depends on via:

cv::getBuildInformation()

And I noticed it still using ros-opencv as a default by checking output fromthis result sometimes differ from following command:

std::cerr << "OpenCV version : " << CV_VERSION << std::endl;

still shows it using ros-opencv but somehow excluding whole libraries from ros do not cause trivial problem.