3

運が悪かったので、ROSの回答でこの質問をしようとしたので、ここで試してみます。

ROS Roboearthパッケージをコンパイルしようとしていますが、 vision_opencvとのリンクエラーが発生しているようです。

提供された手順で最初にコンパイルを試みたとき、古いコンパイラがあり、Fuerteがなかったため、ビルドを実行できませんでした。そこで、Ubuntuを12.04にアップグレードし、ROSFuerteにアップデートしました。

次に、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-Addedbysoftwarecenter」のチェックを外しました。

その後、sudo apt-get update再びしました。これで上記の問題は解決しました。

次に、次のファイルに移動/etc/apt/sources.list.d/ros-latest.listして、URLがコメント化されていることを確認しました。次の行のコメントを外して、もう一度deb http://packages.ros.org/ros/ubuntu precise main実行sudo apt-get updateしました。

この時点以降、roboearthとapt-getを介して必要なすべての依存関係をインストールすることができ、でroboearthを正常に作成することができました。rosmake roboearth

于 2013-02-15T22:26:07.727 に答える