3

我试过在没有运气的情况下在 ROS 答案上问这个问题,所以我要在这里尝试。

我正在尝试编译ROS Roboearth 包,似乎存在一些与 vision_opencv 的链接错误。

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

然后我意识到 12.04 没有所需的 ros-fuerte-vision-opencv2 依赖项。所以,我从源代码编译并构建了 OpenCV 2.4.3,效果很好。然后我意识到我也无法提取我再次从这里得到的 ros-fuerte-vision-opencv ,检查了“fuerte”分支并在 /opt/ros/fuerte/stacks/vision_opencv 中编译。

现在,当我尝试通过

rosmake 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.
4

1 回答 1

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)

为了解决这个问题,我去了`Synaptic Package Manager-> Settings -> Repositories -> Other Software' 并取消选中“Canonical Partners - added by software center”。

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

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

在此之后,我能够通过 apt-get 安装 roboearth 所需的所有依赖项,并且能够成功地制作 roboearthrosmake roboearth

于 2013-02-15T22:26:07.727 回答