OpenCV error 'CAIRO_STATUS_SUCCESS failed' under ROS. Bug? [closed]

asked 2013-08-22 03:31:22 -0600

Huibuh gravatar image

updated 2014-04-20 14:09:44 -0600

ngrennan gravatar image

Dear fellow ROS developers,

I have encountered an OpenCV related bug that causes a crash when run in the context of ROS bindings.

My setup:

  • Ubuntu 12.04
  • ROS Groovy Desktop, up-to-date, which contains the following binary apt packages:
    • ros-groovy-vision-opencv
    • opencv ros-groovy-opencv2

My self written catkin-based ROS node has the following dependencies specified in its CMakeLists.txt:

find_package(catkin REQUIRED COMPONENTS cv_bridge ...)
find_package(OpenCV REQUIRED)

Through debugging I figured out which call actually causes the crash. Somewhere in my code I call:


the resulting error message is:

opencv_ros_node: /build/buildd/cairo-1.10.2/src/cairo-surface.c:1287: cairo_surface_set_device_offset: Assertion `status == CAIRO_STATUS_SUCCESS' failed.

The same code works if it is compiled stand alone, without any ROS bindings/includes, using a self-compiled version of OpenCV. However, if I link the stand alone build against the OpenCV installation that come with ROS, I get the same error.

I have spent many hours trying to resolve this issue, but no luck so far. Here is a link where someone else encounters the same error:

I also tried what is described in here and here without luck.

Any help would be appreciated.



edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2017-11-30 13:23:35.251987


Hi I believe I have the same issue, although I haven't tested it stand alone with OpenCV and not ROS. I tried removing any calls to cv::waitKey and cv::imshow from my code and this at least superficially resolved the issue. I assume it is a concurrency issue of some sort.

NickT gravatar image NickT  ( 2013-09-02 23:55:11 -0600 )edit

Hello Nick, I will try the same on Monday and post back whether it also resolved my issue. Thanks for the tip!

Huibuh gravatar image Huibuh  ( 2013-09-15 00:14:19 -0600 )edit

Hm, when I do this (remove waitkey) no windows show up. (Since waitkey calls imshow, this may make sense). But I can't tell if FindContours is working, then.

KevinNickels gravatar image KevinNickels  ( 2013-09-30 09:12:10 -0600 )edit

Hello Kevin, Im my case, uncommenting cv::waitKey and cv::imshow did not do the trick - same crash, same error message. However, I am convinced now that this, at least in my case with ROS running at the same time, must be a concurrency issue. I tried to debug using gdb and other tools, but to no avail. This also explains while my code runs fine stand-alone, i,e, without being executed as part of a ROS node. If anyone can give me any hints on how I could get to the bottom of this and come up with a fix, that would be highly appreciated!

Huibuh gravatar image Huibuh  ( 2013-09-30 22:06:31 -0600 )edit