rubengooj / pl-slam

This code contains an algorithm to compute stereo visual SLAM by using both point and line segment features.
GNU General Public License v3.0
751 stars 243 forks source link

Build error of g2o #1

Closed rikpires closed 6 years ago

rikpires commented 7 years ago

When running build.sh, error occurs as follows.

CMake Error at CMakeLists.txt:7 (find_package):
  By not providing "FindG2O.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "G2O", but
  CMake did not find one.

  Could not find a package configuration file provided by "G2O" with any of
  the following names:

    G2OConfig.cmake
    g2o-config.cmake
rubengooj commented 7 years ago

Hi, you need to install g2o library, I've already added it to the readme file, let me know if you find any other issue.

inspirelt commented 7 years ago

Hi , after installing g2o by " git clone https://github.com/RainerKuemmerle/g2o.git cd g2o mkdir build cd build cmake .. make sudo make install " the above error still exists . Then I tried to add the following line into CMakeLists.txt :

set(G2O_DIR "/home/ubuntu/slam/g2o/cmake_modules") # FindG2O.cmake is in this path

the above error still~ exists .Then I added "/home/ubuntu/slam/g2o/cmake_modules" in CMAKE_MODULE_PATH by : " list(APPEND CMAKE_MODULE_PATH "/home/ubuntu/slam/g2o/cmake_modules") " the above error seems to be solved . but new error as follows emerges :

Building CXX object CMakeFiles/plslam.dir/src/slamScene.cpp.o Building CXX object CMakeFiles/plslam.dir/src/mapFeatures.cpp.o In file included from /home/ubuntu/slam/pl-slam/include/mapHandler.h:27:0, from /home/ubuntu/slam/pl-slam/src/mapHandler.cpp:22: /usr/include/eigen3/Eigen/CholmodSupport:9:23: fatal error: cholmod.h: No such file or directory

include

                   ^

compilation terminated. In file included from /home/ubuntu/slam/pl-slam/src/voScene.cpp:22:0: /home/ubuntu/slam/pl-slam/include/voScene.h:29:34: fatal error: mrpt/maps/CPointsMap.h: No such file or directory

include <mrpt/maps/CPointsMap.h>

                              ^

compilation terminated. In file included from /home/ubuntu/slam/pl-slam/include/mapHandler.h:27:0, from /home/ubuntu/slam/pl-slam/include/slamScene.h:43, from /home/ubuntu/slam/pl-slam/src/slamScene.cpp:22: /usr/include/eigen3/Eigen/CholmodSupport:9:23: fatal error: cholmod.h: No such file or directory

include

so , what's wrong with my operation?

CORaisch commented 7 years ago

The problem is that at installation of g2o they do not copy the "FindG2O.cmake" into the "/usr/share/cmake-X.X/Modules/" directory. This is where the "find_package" function of cmake usually looks for it. So just copying the "FindG2O.cmake" file there manually solved the problem for me.

lizhihuit commented 7 years ago

@rikpires,have solved the problem,I met the same problem

Chrislzy1993 commented 6 years ago

LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules ) SET( G2O_ROOT /usr/local/include/g2o ) FIND_PACKAGE( G2O ) i did like it and solved the problem

cumtchenchang commented 6 years ago

@lizhihuit can you tell me how to solve this problem.

logindiamant commented 6 years ago
  1. Install g2o
  2. Change CMakeLists.txt, something like this:

find_package(G2O REQUIRED)

...

LIST(APPEND CMAKE_MODULE_PATH /home/ubuntu/pl-slam/3rdparty/g2o/cmake_modules) SET(G2O_ROOT /home/ubuntu/pl-slam/3rdparty/g2o) FIND_PACKAGE(G2O REQUIRED)

... ${G2O_INCLUDE_DIR}/3rdparty/g2o/include/

3.Same problems in mrpt, so install mrpt_navigation sudo apt-get install ros-kinetic-mrpt-navigation or sudo apt-get install libmrpt-dev

Enjoy)

Dasheverless commented 4 years ago

you can use set(CMAKE_MODULE_PATH dir) then,cmake will go to this dir to find FIND_XXX.camke or XXXConfig.cmake file.

Turing47 commented 3 years ago

Create a folder "cmake_modules" next to the "Cmakelist" and put the file "FindG2O.cmake" in the folder. Add this in your cmakelist: list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

FindG2O.cmake: FindG2O .txt Change the suffix to "cmake" (FindG2O.cmake)