trouble compiling rospackage with g2o
Hi all!
I am trying to build a basic ros package to do (and optimize) a graph using g2o and data from a robot. The problem is that I can not get to compile even an easy module where I just put few vertices and edges manually (let's say a square) in order to test if I am using propperly the g2o library. I want the latest g2o so I downladed (https://github.com/RainerKuemmerle/g2o) and installed it by myself follwing its intructions.
The errors I get when I compile are the following:
/usr/local/include/g2o/core/block_solver.hpp:446: undefined reference to `g2o::get_monotonic_time()'
/usr/local/include/g2o/core/batch_stats.h:73: undefined reference to `g2o::G2OBatchStatistics::_globalStats'
/usr/local/include/g2o/solvers/csparse/linear_solver_csparse.h:126: undefined reference to `g2o::csparse_extension::cs_cholsolsymb(cs_sparse const, double, cs_symbolic const, double, int*)'
/usr/local/include/g2o/solvers/csparse/linear_solver_csparse.h:176: undefined reference to `g2o::MarginalCovarianceCholesky::~MarginalCovarianceCholesky()'
/usr/local/include/g2o/solvers/csparse/linear_solver_csparse.h:173: undefined reference to `g2o::MarginalCovarianceCholesky::MarginalCovarianceCholesky()'
/usr/local/include/g2o/solvers/csparse/linear_solver_csparse.h:174: undefined reference to `g2o::MarginalCovarianceCholesky::setCholeskyFactor(int, int, int, double, int)'
/usr/local/include/g2o/solvers/csparse/linear_solver_csparse.h:175: undefined reference to `g2o::MarginalCovarianceCholesky::computeCovariance(double**, std::vector<int, std::allocator<int=""> > const&)'
/usr/local/include/g2o/solvers/csparse/linear_solver_csparse.h:176: undefined reference to `cs_nfree'
I obviously skept the parts of the error message where it points to my code.
My CMakeList.txt is:
cmake_minimum_required(VERSION 2.4.6) include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) # Set the build type. Options are: # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage # Debug : w/ debug symbols, w/o optimization # Release : w/o debug symbols, w/ optimization # RelWithDebInfo : w/ debug symbols, w/ optimization # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries #set(ROS_BUILD_TYPE RelWithDebInfo) rosbuild_init() find_package(Eigen REQUIRED) include_directories(${EIGEN_INCLUDE_DIRS}) add_definitions(${EIGEN_DEFINITIONS}) set(g2o_DIR /usr/local/bin/g2o) include_directories(/usr/local/include/EXTERNAL/csparse) include_directories(${G2O_INCLUDE_DIRS}) #set the default path for built executables to the "bin" directory set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) #set the default path for built libraries to the "lib" directory set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) rosbuild_add_executable(g2o_mvm src/g2o_mvm.cpp)
Thank you very much!