Rosanswers logo

Following these instructions to do a source build of melodic desktop full (I want to build it with thread sanitizer because of something I'm debugging): http://wiki.ros.org/melodic/Installation/Source

I'm getting this error, I know it has to do something with OpenCV versions but I can't figure out how to fix it.

==> Processing catkin package: 'compressed_depth_image_transport'
==> Building with env: '/home/tyler/workspace/ws_ros_melodic/install_isolated/env.sh'
Makefile exists, skipping explicit cmake invocation...
==> make cmake_check_build_system in '/home/tyler/workspace/ws_ros_melodic/build_isolated/compressed_depth_image_transport'
==> make -j8 -l8 in '/home/tyler/workspace/ws_ros_melodic/build_isolated/compressed_depth_image_transport'
[ 16%] Built target compressed_depth_image_transport_gencfg
[ 33%] Building CXX object CMakeFiles/compressed_depth_image_transport.dir/src/codec.cpp.o
/home/tyler/workspace/ws_ros_melodic/src/image_transport_plugins/compressed_depth_image_transport/src/codec.cpp: In function ‘sensor_msgs::Image_<std::allocator<void> >::Ptr compressed_depth_image_transport::decodeCompressedDepthImage(const CompressedImage&)’:
/home/tyler/workspace/ws_ros_melodic/src/image_transport_plugins/compressed_depth_image_transport/src/codec.cpp:138:49: error: ‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope
         cv_ptr->image = cv::imdecode(imageData, CV_LOAD_IMAGE_UNCHANGED);
CMakeFiles/compressed_depth_image_transport.dir/build.make:134: recipe for target 'CMakeFiles/compressed_depth_image_transport.dir/src/codec.cpp.o' failed
make[2]: *** [CMakeFiles/compressed_depth_image_transport.dir/src/codec.cpp.o] Error 1
CMakeFiles/Makefile2:1096: recipe for target 'CMakeFiles/compressed_depth_image_transport.dir/all' failed
make[1]: *** [CMakeFiles/compressed_depth_image_transport.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
<== Failed to process package 'compressed_depth_image_transport': 
  Command '['/home/tyler/workspace/ws_ros_melodic/install_isolated/env.sh', 'make', '-j8', '-l8']' returned non-zero exit status 2

Originally posted by tyler-picknik on ROS Answers with karma: 241 on 2020-06-13

Post score: 0


1 Answer 1


Rosanswers logo

Do you have OpenCV 3.4 or 4.x installed?

According to ros-perception/image_transport_plugins#54 and a bunch of other Google results, those flags were renamed quite a few times between 2018 and now.

Melodic targets OpenCV 3.2 on Ubuntu 18.04 (see Melodic Morenia (May 2018 - May 2023) in REP-3). And with that: not the upstream version, but:

" * " means that this is not the upstream version (available on the official Operating System repositories) but a package distributed by OSRF or the community (package built and distributed on custom repositories).

You'll have to make sure you have that version or if you have others, CMake finds the required version first.

Originally posted by gvdhoorn with karma: 86574 on 2020-06-14

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by tyler-picknik on 2020-06-14:
That was it, thank you. I have 4 installed because we are using it for a project that has another external dependency that depends on 4. I got by this by putting CATKIN_IGNORE filles in the two packages that wouldn't build in ros as searching my code I don't think we use them.

Comment by gvdhoorn on 2020-06-14:
Seeing some of your other questions (here and on the MoveIt issue tracker(s)), I would perhaps suggest to look into using containers more.

Comment by tyler-picknik on 2020-06-14:
I do use containers when I have to, but perhaps I should use them more.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.