ethz-asl / segmap

A map representation based on 3D segments
BSD 3-Clause "New" or "Revised" License
1.06k stars 394 forks source link

Build failed on segmatch:make #39

Closed Graerth closed 7 years ago

Graerth commented 7 years ago

Working on a fresh workspace (Lunar Loggerhead, though I did have a Kinetic workspace too first).

I'm pretty new to ROS and catkin builds so might have made some mistake but can't figure this out right now.
There was quite a lot of warnings, but these are the parts with actual errors (and the summary from end and catkin config output)):

Errors     << segmatch:make /home/graerth/new_ws/logs/segmatch/build.make.000.log                                         
In file included from /home/graerth/new_ws/devel/include/pointmatcher/PointMatcher.h:62:0,
                 from /home/graerth/new_ws/src/laser_slam/laser_slam/include/laser_slam/common.hpp:10,
                 from /home/graerth/new_ws/src/segmatch/segmatch/include/segmatch/common.hpp:12,
                 from /home/graerth/new_ws/src/segmatch/segmatch/include/segmatch/segmented_cloud.hpp:15,
                 from /home/graerth/new_ws/src/segmatch/segmatch/include/segmatch/descriptors/descriptors.hpp:9,
                 from /home/graerth/new_ws/src/segmatch/segmatch/src/descriptors/descriptors.cpp:1:
/home/graerth/new_ws/devel/include/pointmatcher/Parametrizable.h:46:0: warning: "BOOST_ASSIGN_MAX_PARAMS" redefined
 #define BOOST_ASSIGN_MAX_PARAMS 6
 ^
In file included from /home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:1:0:
/home/graerth/new_ws/src/segmatch/segmatch/include/segmatch/opencv_random_forest.hpp:47:3: error: ‘CvRTrees’ does not name a type
   CvRTrees rtrees_;
   ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp: In constructor ‘segmatch::OpenCvRandomForest::OpenCvRandomForest(const segmatch::ClassifierParams&)’:
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:24:3: error: ‘rtrees_’ was not declared in this scope
   rtrees_.load(params.classifier_filename.c_str());
   ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp: In member function ‘void segmatch::OpenCvRandomForest::resetParams(const segmatch::ClassifierParams&)’:
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:52:3: error: ‘rtrees_’ was not declared in this scope
   rtrees_.load(params.classifier_filename.c_str());
   ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp: In member function ‘segmatch::PairwiseMatches segmatch::OpenCvRandomForest::findCandidates(const segmatch::SegmentedCloud&, segmatch::PairwiseMatches*)’:
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:266:36: error: ‘rtrees_’ was not declared in this scope
           const float confidence = rtrees_.predict_prob(features);
                                    ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:315:34: error: ‘rtrees_’ was not declared in this scope
         const float confidence = rtrees_.predict_prob(features);
                                  ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp: In member function ‘void segmatch::OpenCvRandomForest::train(const MatrixXd&, const MatrixXd&)’:
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:350:65: warning: narrowing conversion of ‘((segmatch::OpenCvRandomForest*)this)->segmatch::OpenCvRandomForest::params_.segmatch::ClassifierParams::rf_priors.std::vector<_Tp, _Alloc>::operator[]<double, std::allocator<double> >(0ul)’ from ‘__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type {aka double}’ to ‘float’ inside { } [-Wnarrowing]
   float priors[] = { params_.rf_priors[0], params_.rf_priors[1] };
                                                                 ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:350:65: warning: narrowing conversion of ‘((segmatch::OpenCvRandomForest*)this)->segmatch::OpenCvRandomForest::params_.segmatch::ClassifierParams::rf_priors.std::vector<_Tp, _Alloc>::operator[]<double, std::allocator<double> >(1ul)’ from ‘__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type {aka double}’ to ‘float’ inside { } [-Wnarrowing]
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:353:3: error: ‘CvRTParams’ was not declared in this scope
   CvRTParams rtrees_params = CvRTParams(
   ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:361:3: error: ‘rtrees_’ was not declared in this scope
   rtrees_.train(opencv_features, CV_ROW_SAMPLE, opencv_labels, cv::Mat(),
   ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:361:34: error: ‘CV_ROW_SAMPLE’ was not declared in this scope
   rtrees_.train(opencv_features, CV_ROW_SAMPLE, opencv_labels, cv::Mat(),
                                  ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:362:50: error: ‘rtrees_params’ was not declared in this scope
                 cv::Mat(), cv::Mat(), cv::Mat(), rtrees_params);
                                                  ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp: In member function ‘void segmatch::OpenCvRandomForest::test(const MatrixXd&, const MatrixXd&, Eigen::MatrixXd*) const’:
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:403:28: error: ‘rtrees_’ was not declared in this scope
       double probability = rtrees_.predict_prob(opencv_sample);
                            ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp: In member function ‘void segmatch::OpenCvRandomForest::save(const string&) const’:
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:429:3: error: ‘rtrees_’ was not declared in this scope
   rtrees_.save(filename.c_str());
   ^
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp: In member function ‘void segmatch::OpenCvRandomForest::load(const string&)’:
/home/graerth/new_ws/src/segmatch/segmatch/src/opencv_random_forest.cpp:434:3: error: ‘rtrees_’ was not declared in this scope
   rtrees_.load(filename.c_str());
   ^
In file included from /home/graerth/new_ws/devel/include/pointmatcher/PointMatcher.h:62:0,
                 from /home/graerth/new_ws/src/laser_slam/laser_slam/include/laser_slam/common.hpp:10,
                 from /home/graerth/new_ws/src/segmatch/segmatch/include/segmatch/segmatch.hpp:8,
                 from /home/graerth/new_ws/src/segmatch/segmatch/src/segmatch.cpp:1:
/home/graerth/new_ws/devel/include/pointmatcher/Parametrizable.h:46:0: warning: "BOOST_ASSIGN_MAX_PARAMS" redefined
 #define BOOST_ASSIGN_MAX_PARAMS 6
 ^
In file included from /home/graerth/new_ws/devel/include/gtsam/nonlinear/NonlinearFactor.h:30:0,
                 from /home/graerth/new_ws/devel/include/gtsam/nonlinear/ExpressionFactor.h:23,
                 from /home/graerth/new_ws/src/laser_slam/laser_slam/include/laser_slam/common.hpp:7,
                 from /home/graerth/new_ws/src/segmatch/segmatch/include/segmatch/segmatch.hpp:8,
                 from /home/graerth/new_ws/src/segmatch/segmatch/src/segmatch.cpp:1:
/usr/include/boost/assign/list_of.hpp:378:0: note: this is the location of the previous definition
 #define BOOST_ASSIGN_MAX_PARAMS 5
 ^
In file included from /home/graerth/new_ws/src/segmatch/segmatch/include/segmatch/segmatch.hpp:16:0,
                 from /home/graerth/new_ws/src/segmatch/segmatch/src/segmatch.cpp:1:
/home/graerth/new_ws/src/segmatch/segmatch/include/segmatch/opencv_random_forest.hpp:47:3: error: ‘CvRTrees’ does not name a type
   CvRTrees rtrees_;
   ^
make[2]: *** [CMakeFiles/segmatch.dir/src/opencv_random_forest.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/segmatch.dir/src/segmatch.cpp.o] Error 1
make[1]: *** [CMakeFiles/segmatch.dir/all] Error 2
make: *** [all] Error 2
cd /home/graerth/new_ws/build/segmatch; catkin build --get-env segmatch | catkin env -si  /usr/bin/make --jobserver-fds=6,7 -j; cd -
..........................................................................................................................
Failed     << segmatch:make                        [ Exited with code 2 ]                                                 
Failed    <<< segmatch                             [ 2 minutes and 43.8 seconds ]                                         
Abandoned <<< segmatch_ros                         [ Unrelated job failed ]                                               
Abandoned <<< laser_mapper                         [ Unrelated job failed ]                                               
[build] Summary: 17 of 20 packages succeeded.                                                                             
[build]   Ignored:   10 packages were skipped or are blacklisted.                                                         
[build]   Warnings:  9 packages succeeded with warnings.                                                                  
[build]   Abandoned: 2 packages were abandoned.                                                                           
[build]   Failed:    1 packages failed.                                                                                   
[build] Runtime: 1 hour 21 minutes and 24.9 seconds total.                                                                
graerth@graerth-K30BF-M32BF-A-F-K31BF-6:~/new_ws$ catkin config
---------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/lunar
Workspace:                   /home/graerth/new_ws
---------------------------------------------------------
Source Space:       [exists] /home/graerth/new_ws/src
Log Space:          [exists] /home/graerth/new_ws/logs
Build Space:        [exists] /home/graerth/new_ws/build
Devel Space:        [exists] /home/graerth/new_ws/devel
Install Space:      [unused] /home/graerth/new_ws/install
DESTDIR:            [unused] None
---------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
---------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
---------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
---------------------------------------------------------
Workspace configuration appears valid.
---------------------------------------------------------

Anyone got ideas what's the problem?

dotPiano commented 7 years ago

Hi @Graerth,

The main maintainer (@rdube) is currently travelling, I'll try my best with a couple of hints :)

I hope this helps! :) Keep us updated!

bochen87 commented 7 years ago

Hi @dotPiano,

I followed this installation procedude for OpenCV2 and now it compiled. Thanks! https://gist.github.com/arthurbeggs/06df46af94af7f261513934e56103b30

dotPiano commented 7 years ago

Cool, thanks for the link!

@rdube maybe you want to add it to the instructions on the wiki?

YoshuaNava commented 6 years ago

Hey, If you have ROS Kinetic and you don't want to perform a system-wide install of OpenCV 2.4.x, you can set CMAKE_INSTALL_PREFIX to point to another folder in your system.

In my case I first declare the OpenCV 2.4.x install path as an environment variable in ~/.bashrc:

export OPENCV2_INSTALL_DIR=/path/to/OpenCV2/lib

I clone the latest version of OpenCV 2.4.x:

git clone https://github.com/opencv/opencv.git OpenCV2 --depth=1 -b 2.4

And then I build, by running:

cd OpenCV2
mkdir build
cd build

cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=$OPENCV2_INSTALL_DIR \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_nonfree=OFF \
    -DBUILD_opencv_python=ON \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=OFF \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=OFF \
    ../

make -j$(nproc)
sudo make install

Finally, in all CMakeLists.txt files that attempt to import OpenCV (and specifically need version 2.4.x), I replace find_package(OpenCV REQUIRED) with:

set(OpenCV_DIR  $ENV{OPENCV2_INSTALL_DIR})
find_package(OpenCV 2 REQUIRED)
rdube commented 6 years ago

Thanks @YoshuaNava for your input! :-)