2013-02-12 117 views
2

我试过在ROS答案上询问this question没有运气,所以我要在这里尝试。ROS Roboearth Ubuntu 12.04 vision_opencv链接错误

我想编译ROS Roboearth package并且似乎有一些与vision_opencv的链接错误。

当我第一次尝试通过提供的指令进行编译时,我无法编译,因为我有旧的编译器,而且我没有Fuerte。所以,我将Ubuntu升级到12.04,并更新为ROS Fuerte。

然后我意识到12.04不具备所需的ros-fuerte-vision-opencv2依赖性。所以,我从源代码编译并构建了OpenCV 2.4.3,这很好。然后我意识到,我也无法取得我从here得到的ros-fuerte-vision-opencv,检出了“fuerte”分支并编译到/ opt/ros/fuerte/stacks/vision_opencv中。

现在,当我尝试通过

rosmake roboearth

我得到以下链接错误,使roboearth。

谢谢你的帮助。这可能只是我对C++缺乏了解,但是我尝试了一切,从检查依赖关系到重新设置编译器标志和依赖关系的顺序,我似乎无法得到它的工作。

[rosmake-1] Starting >>> ar_pose [ make ]                        
[ rosmake ] Last 40 lines_vision: 30.7 sec ] [ ar_pose: 4.2 sec ]          [ 2 Active 47/103 Complete ] 
{------------------------------------------------------------------------------- 
    make[3]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build' 
    [ 70%] Built target rosbuild_precompile 
    make[3]: Entering directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build' 
    make[3]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build' 
    make[3]: Entering directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build' 
    Linking CXX executable ../bin/ar_multi 
    CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `ar_pose::ARSinglePublisher::arInit()': 
    /home/sasha/ros/stacks/ccny_vision/ar_pose/src/ar_multi.cpp:140: undefined reference to `cvCreateImage' 
    CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `CvBridge': 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:67: undefined reference to `cvCreateImageHeader' 
    CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `~CvBridge': 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:73: undefined reference to `cvReleaseImageHeader' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:78: undefined reference to `cvReleaseImage' 
    CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::reallocIfNeeded_(_IplImage**, CvSize, int, int)': 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:91: undefined reference to `cvReleaseImage' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:97: undefined reference to `cvCreateImage' 
    CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::reallocIfNeeded(_IplImage**, int, int)': 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:109: undefined reference to `cvGetSize' 
    CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::fromImage(sensor_msgs::Image_<std::allocator<void> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)': 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:199: undefined reference to `cvInitMatHeader' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:200: undefined reference to `cvGetImage' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:229: undefined reference to `cvCreateMat' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:230: undefined reference to `cvConvertScale' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:236: undefined reference to `cvConvertScale' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:243: undefined reference to `cvCvtColor' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:245: undefined reference to `cvCvtColor' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:247: undefined reference to `cvCvtColor' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:249: undefined reference to `cvCvtColor' 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:253: undefined reference to `cvCvtColor' 
    CMakeFiles/ar_multi.dir/src/ar_multi.o:/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:255: more undefined references to `cvCvtColor' follow 
    CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::fromImage(sensor_msgs::Image_<std::allocator<void> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)': 
    /opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:293: undefined reference to `cvReleaseMat' 
    collect2: ld returned 1 exit status 
    make[3]: *** [../bin/ar_multi] Error 1 
    make[3]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build' 
    make[2]: *** [CMakeFiles/ar_multi.dir/all] Error 2 
    make[2]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build' 
    make[1]: *** [all] Error 2 
    make[1]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build' 
-------------------------------------------------------------------------------} 
[ rosmake ] Output from build of package ar_pose written to: 
[ rosmake ] /home/sasha/.ros/rosmake/rosmake_output-20130212-145046/ar_pose/build_output.log 
[rosmake-1] Finished <<< ar_pose [FAIL] [ 4.31 seconds ]                    
[ rosmake ] Halting due to failure in package ar_pose. 
[ rosmake ] Waiting for other threads to complete.       
[ rosmake ] Last 40 lines_vision: 182.3 sec ]               [ 1 Active 47/103 Complete ] 
{------------------------------------------------------------------------------- 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cvReleaseMat' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::reshape(int, int, int const*) const' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cvSetZero' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::warpPerspective(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&)' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::getTextSize(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, double, int, int*)' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::zeros(int, int, int)' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::_InputArray::_InputArray(cv::MatExpr const&)' 
    ../lib/libDVision.so: undefined reference to `cv::read(cv::FileNode const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&)' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::DescriptorMatcher::DescriptorCollection::~DescriptorCollection()' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::FlannBasedMatcher::train()' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cvCvtColor' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::MatConstIterator::seek(int const*, bool)' 
    ../lib/libDVision.so: undefined reference to `cv::FeatureDetector::~FeatureDetector()' 
    ../lib/libDUtilsCV.so: undefined reference to `cv::line(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' 
    ../lib/libDVision.so: undefined reference to `cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::initUndistortRectifyMap(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, int, cv::_OutputArray const&, cv::_OutputArray const&)' 
    ../lib/libDVision.so: undefined reference to `cv::WriteStructContext::~WriteStructContext()' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::copySize(cv::Mat const&)' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cvCreateImageHeader' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::inv(int) const' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&)' 
    ../lib/libDVision.so: undefined reference to `cv::operator<<(cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::flann::IndexParams::~IndexParams()' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cvGetSize' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::deallocate()' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::_InputArray::_InputArray(double const&)' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cvCreateImage' 
    ../lib/libDUtilsCV.so: undefined reference to `cv::namedWindow(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Algorithm::~Algorithm()' 
    ../lib/libObjectDetectorFunctions.so: undefined reference to `cv::FlannBasedMatcher::FlannBasedMatcher(cv::Ptr<cv::flann::IndexParams> const&, cv::Ptr<cv::flann::SearchParams> const&)' 
    ../lib/libDVision.so: undefined reference to `cv::Algorithm::set(char const*, bool)' 
    collect2: ld returned 1 exit status 
    make[3]: *** [../bin/ObjectDetector] Error 1 
    make[3]: Leaving directory `/home/sasha/ros/stacks/roboearth/re_vision/build' 
    make[2]: *** [CMakeFiles/ObjectDetector.dir/all] Error 2 
    make[2]: Leaving directory `/home/sasha/ros/stacks/roboearth/re_vision/build' 
    make[1]: *** [all] Error 2 
    make[1]: Leaving directory `/home/sasha/ros/stacks/roboearth/re_vision/build' 
-------------------------------------------------------------------------------} 
[ rosmake ] Output from build of package re_vision written to: 
[ rosmake ] /home/sasha/.ros/rosmake/rosmake_output-20130212-145046/re_vision/build_output.log 
[rosmake-0] Finished <<< re_vision [FAIL] [ 182.31 seconds ]                   
[ rosmake ] Halting due to failure in package re_vision. 
+0

我相信这个问题是在'roboearth/re_vision'某处它试图在'vision_opencv'中使用绝对或破碎的库。 [这里](https://ipvs.informatik.uni-stuttgart.de/roboearth/repos/public/tags/latest/re_vision/CMakeLists.txt)是重新链接CMakeLists.txt和[this](https:/ /github.com/ros-perception/vision_opencv/blob/groovy-devel/cv_bridge/CMakeLists.txt)是'vision_opencv/cv_bridge' CMakeLists.txt。并且[here](https://github.com/ros-perception/vision_opencv/blob/fuerte-devel/opencv2/manifest.xml)是'vision_opencv/opencv2' manifext.xml。我希望这有帮助。 – AlexIIP 2013-02-14 21:46:04

回答

0

好吧,所以我能够解决这个问题。

首先我做sudo apt-get update,我看到的是我得到了以下信息:

W: Duplicate sources.list entry http://archive.canonical.com/ubuntu/ precise/partner i386 Packages (/var/lib/apt/lists/archive.canonical.com_ubuntu_dists_precise_partner_binary-i386_Packages)

要解决这一点,我去了`新立得软件包管理器 - >设置 - >库 - >其他软件”和未经检查的“典型合作伙伴 - 由软件中心添加”。

然后再次做了sudo apt-get update。这解决了上述问题。

然后,我去了以下文件/etc/apt/sources.list.d/ros-latest.list,并看到网址被注释掉了。我取消注释以下行deb http://packages.ros.org/ros/ubuntu precise main并再次运行sudo apt-get update

这一点后,我能够安装所有这些都需要roboearth并通过依赖apt-get和能够成功使roboearth与rosmake roboearth