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

Cannot Use OpenCV With -std=c++0x/gnu++0x in Fuerte

asked 2012-10-24 14:34:24 -0600

ekaszubski gravatar image

Compiling against OpenCV/FLANN in Fuerte/Ubuntu 12.04 amd64/gcc4.6 fails when using -std=c++0x due to this issue which has yet to be integrated into ROS; are there plans to pull this fix into ROS any time soon?

For example, the following simple test program:

#include <opencv/cv.h>

int main(){ return 0; }

when compiled with:

g++ opencv_test.cpp `pkg-config --libs --cflags opencv` -std=c++0x

will fail with:

error: ‘use_speed_’ was not declared in this scope

So far, I've been able to fix this issue by grabbing the latest OpenCV source (I'm using 2.4.9; issue was fixed in 2.4.3) and compiling/installing with:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/opt/ros/fuerte

make

sudo make install

which appears to solve the issue, but is far from ideal. Are there any alternative workarounds for this issue? As far as I can tell, it is currently not possible to compile any code requiring both OpenCV and the c++0x/gnu++0x flag in fuerte out-of-the-box.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
4

answered 2012-11-06 13:08:05 -0600

ekaszubski gravatar image

OpenCV 2.4.3 just came out, so I went ahead and just packaged it myself and added provides/conflicts/replaces fields for ros-fuerte-opencv2 and ros-groovy-opencv2 (so no compiling from source, and it automatically uninstalls/replaces the existing ros-<version>-opencv2 package in a clean way).

I tested the packages on my precise+fuerte cleanroom and the basic program above compiles as expected; however, I have yet to test it with rosbuild. Presumably, since the opencv2 ros package (provided by vision-opencv) uses pkg-config to grab the cflags and libs, the flags from 2.4.3 should be pulled in and everything should just work.

So if anyone is interested, the debs (libopencv2.4 and libopencv2.4-dev, both version 2.4.3) for oneiric and precise are here, and setup instructions for the PPA are here.

edit flag offensive delete link more

Comments

Cool! Could you select your answer so it shows up as answered?

jbohren gravatar image jbohren  ( 2012-11-06 13:28:29 -0600 )edit

I marked this as answered since my solution technically works, but the best solution would be to update ros-fuerte/groovy-opencv2 to OpenCV 2.4.3.

ekaszubski gravatar image ekaszubski  ( 2012-11-06 15:36:56 -0600 )edit

Well, as of (now) it looks like ros-groovy-opencv2 is at 2.4.3, and ros-fuerte-opencv2 is at 2.4.2 (:

jbohren gravatar image jbohren  ( 2012-11-06 18:37:26 -0600 )edit

Good to know that groovy is up-to-date; hopefully fuerte will be updated soon as well. Thanks for the info!

ekaszubski gravatar image ekaszubski  ( 2012-11-07 11:16:46 -0600 )edit

2.4.3 for fuerte is not yet available, and I don't have access to http://robotics.usc.edu/~ekaszubski/packages/ubuntu/ :-(

Daniel Pinyol gravatar image Daniel Pinyol  ( 2013-04-03 11:09:54 -0600 )edit

Question Tools

Stats

Asked: 2012-10-24 14:34:24 -0600

Seen: 1,113 times

Last updated: Nov 06 '12