ros-perception / image_transport_plugins

A set of plugins for publishing and subscribing to sensor_msgs/Image topics in representations other than raw pixel data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to export opencv dependencies when building theora_image_transport cmake

cardboardcode opened this issue · comments

Please see ros2/ros1_bridge#276.

Below is a re-iteration of the issue encountered. I have been instructed to file this issue here for relevancy.

Bug report

Required Info:

  • Operating System:
    Ubuntu 18.04, ROS2 Eloquent, ROS1 Melodic, OpenCV 3.2.0
  • Installation type:
    Prebuilt binary. Installed via sudo apt-get install ros-eloquent-theora-image-transport
  • Version or commit hash:
    Version: eloquent
  • DDS implementation:
    Default Fast-RTPS
  • Client library (if applicable):
    N/A

Steps to reproduce issue

mkdir -p ros1_bridge_ws/src && cd ros1_bridge_ws/src
git clone https://github.com/ros2/ros1_bridge.git --branch eloquent  --single-branch
cd ~/ros1_bridge_ws
colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure

Expected behavior

Colcon build passes.

Actual behavior

Colcon build fails with the following error:

Starting >>> ros1_bridge
--- stderr: ros1_bridge                         
CMake Error at /opt/ros/eloquent/share/theora_image_transport/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package):
  By not providing "Findopencv_calib3d.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "opencv_calib3d", but CMake did not find one.

  Could not find a package configuration file provided by "opencv_calib3d"
  with any of the following names:

    opencv_calib3dConfig.cmake
    opencv_calib3d-config.cmake

  Add the installation prefix of "opencv_calib3d" to CMAKE_PREFIX_PATH or set
  "opencv_calib3d_DIR" to a directory containing one of the above files.  If
  "opencv_calib3d" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  /opt/ros/eloquent/share/theora_image_transport/cmake/theora_image_transportConfig.cmake:38 (include)
  CMakeLists.txt:94 (find_package)


---
Failed   <<< ros1_bridge [5.18s, exited with code 1]

Summary: 0 packages finished [5.29s]
  1 package failed: ros1_bridge
  1 package had stderr output: ros1_bridge

Futher Information

  1. I have verified that OpenCV is installed properly by the following means.

Within the CMakeLists.txt available in the ros1_bridge package, I added the following the statement to verify that OpenCV is found as a package.

find_package(OpenCV REQUIRED)
if (OpenCV_FOUND)
 message(WARNING "OpenCV package is installed.")
endif()
  1. I have also installed the following relevant packages, but to no avail.
sudo apt-get install libopencv-calib3d3.2
sudo apt-get install libopencv-calib3d-dev

Further progress on debugging this issue.

Found relevant issues similar to what had been encountered in ROS1 Kinetic.

. [opencv3 with ros kinetic]
Author verified that opencv_calib3d is installed properly but ROS1 Kinetic builds are failing.

. [OpenCV3.3.1 is breaking builds in Kinetic]

A temporary workaround has been suggested in the link below:
ros-perception/vision_opencv#193

Going to try this shortly. Will update whether it works or not.

Encountering the same problem. Any news on this?

Hi @svengit, @cardboardcode and I resolved the problem a while ago through changing the following lines

ament_export_dependencies(rosidl_default_runtime
${OpenCV_LIBRARIES}
${PC_OGG_LIBRARIES}
${PC_THEORA_LIBRARIES}
${PC_THEORAENC_LIBRARIES}
${PC_THEORADEC_LIBRARIES}
${LIBRARY_NAME})

to

ament_export_dependencies(rosidl_default_runtime
  OpenCV
  PkgConfig)

Apparently ament_export_dependencies should only include packages that can be found through find_package(<package_name>) (reference)

I am not sure this is best solution, but it will avoid the ros1_bridge build error.