Catkin_make error no rule to make target libg2o needed by rgbdslam
I am running ROS kinetic on Ubuntu 16.04 on an intel NUC. I used the install.sh to make a g2ofork and to put rgbdslam into my catkin workspace. I am currently trying to run catkin_make but I am receiving the error below.
Scanning dependencies of target rgbdslam
[ 85%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/moc_openni_listener.cpp.o
[ 86%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/moc_graph_manager.cpp.o
[ 86%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/main.cpp.o
[ 87%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/openni_listener.cpp.o
[ 87%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/node.cpp.o
[ 87%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/misc.cpp.o
[ 87%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/landmark.cpp.o
[ 88%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/loop_closing.cpp.o
[ 88%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/graph_manager.cpp.o
[ 89%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/graph_mgr_io.cpp.o
[ 89%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/graph_manager2.cpp.o
[ 89%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/graph_mgr_odom.cpp.o
[ 89%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/transformation_estimation.cpp.o
make[2]: *** No rule to make target '/home/astrobotics/ros_code/src/g2ofork/lib/libg2o_csparse_extension.so', needed by '/home/astrobotics/ros_code/devel/lib/rgbdslam/rgbdslam'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 90%] Building CXX object rgbdslam/CMakeFiles/rgbdslam.dir/src/covariance_estimation.cpp.o
CMakeFiles/Makefile2:8253: recipe for target 'rgbdslam/CMakeFiles/rgbdslam.dir/all' failed
make[1]: *** [rgbdslam/CMakeFiles/rgbdslam.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j2" failed
-------------edit--------------------- I have added both of these to my package.xml
<run_depend>libg2o</run_depend>
<build_depend>libg2o</build_depend>
and this is my CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0003 NEW)
#########################################################
### USER CONFIG #########################################
#########################################################
set(USE_SIFT_GPU 1 CACHE BOOL "build with support for siftgpu")
if (${USE_SIFT_GPU})
message(STATUS "SiftGPU library will be used")
else (${USE_SIFT_GPU})
message(STATUS "SiftGPU library will not be used")
endif (${USE_SIFT_GPU})
#SIFT_GPU_MODE is now set via parameter server option "siftgpu_with_cuda"
#set(ENV{SIFT_GPU_MODE} 2) #CUDA = 1, GLSL = 2
set(ENV{SIFT_GPU_CUDA_PATH} /usr/local/cuda CACHE PATH "where cuda is installed")
#These settings are unsupported legacy
set(USE_GICP_BIN 0)
set(USE_GICP_CODE 0)
set(USE_PCL_ICP 0)
set(USE_GL2PS 0) #For printing the 3D Window to PostScript - requires installation of additional library: libgl2ps-dev
IF ("${ROS_PARALLEL_JOBS}" EQUAL "")
set(ROS_PARALLEL_JOBS 1)
endif ("${ROS_PARALLEL_JOBS}" EQUAL "")
#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)
#SET(CMAKE_CXX_FLAGS "-O3 -fPIC -std=c++0x")
#For annotated profiling with perf:
#SET(CMAKE_CXX_FLAGS "-ggdb -O3 -fPIC -std=c++0x")
#SET(CMAKE_CXX_FLAGS "-ggdb -O3 -fPIC")
SET(CMAKE_BUILD_TYPE RELEASE)
#add_compile_options(-std=c++11)
IF (${USE_GL2PS})
add_definitions(-DGL2PS)
ENDIF (${USE_GL2PS})
#is used for compiling the libraries
set(USE_GICP 0)
IF (${USE_GICP_BIN} OR ${USE_GICP_CODE})
set(USE_GICP 1)
ENDIF (${USE_GICP_BIN} OR ${USE_GICP_CODE})
#########################################################
#########################################################
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
####################################################
# ROS
####################################################
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/")
#message(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
find_package(catkin REQUIRED COMPONENTS pcl_conversions pcl_ros roscpp image_transport cv_bridge sensor_msgs cmake_modules
geometry_msgs visualization_msgs std_msgs tf message_generation message_filters rosbag rosconsole)
project(rgbdslam)
#add_definitions(-DROSCONSOLE_SEVERITY_INFO)
add_service_files(DIRECTORY srv FILES rgbdslam_ros_ui.srv rgbdslam_ros_ui_b.srv rgbdslam_ros_ui_f.srv rgbdslam_ros_ui_s.srv)
generate_messages()
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES my_pcl_tutorial
CATKIN_DEPENDS pcl_conversions pcl_ros roscpp sensor_msgs
DEPENDS message_runtime std_msgs
)
include_directories(${catkin_INCLUDE_DIRS})
link_directories(${catkin_LIBRARY_DIRS})
link_libraries(rgbdslam ${catkin_LIBRARIES})
####################################################
# Required 3rd party
####################################################
# PCL #######################
find_package(PCL 1.7 REQUIRED COMPONENTS common io)
include_directories(SYSTEM ${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
# Octomap ###################
find_package(octomap 1.6 REQUIRED)
include_directories(SYSTEM BEFORE ${OCTOMAP_INCLUDE_DIRS})
link_directories(${OCTOMAP_LIBRARY_DIRS})
link_libraries(${OCTOMAP_LIBRARIES})
# g2o #######################
#set(libg2o_DIR "/home/astrobotics/g2ofork/lib/")
find_package(G2O REQUIRED)
include_directories(${G2O_INCLUDE_DIRS})
link_directories(${G2O_LIBRARY_DIRS})
link_libraries(${G2O_LIBRARIES})
message("G2o-libraries " ${G2O_LIBRARIES})
# Qt ########################
find_package(Qt5Widgets)
find_package(Qt5OpenGL)
find_package(Qt5Concurrent)
#set(CMAKE_AUTOMOC ON)
add_definitions(-DQT_NO_KEYWORDS)
# OpenMP ########################
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
# This is necessary as all ui files etc will get dumped in the bottom of then binary directory.
include_directories(SYSTEM ${CMAKE_CURRENT_BINARY_DIR} ${QT_QTOPENGL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/external/gicp/ann_1.1.2/include/ANN)
#get_directory_property(clean ADDITIONAL_MAKE_CLEAN_FILES)
#SET(clean external/siftgpu/linux/bin/libsiftgpu.so)
#set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${clean}")
LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH})
SET(${CMAKE_LIBRARY_PATH} ${LIBRARY_OUTPUT_PATH})
#SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE TRUE)
#Only possible when not subscribing to point cloud topic. Possibly dangerous anyway, but halves storage space per point cloud
#ADD_DEFINITIONS(-DRGB_IS_4TH_DIM)
#ADD_DEFINITIONS(-DDO_FEATURE_OPTIMIZATION)
#ADD_DEFINITIONS(-DHEMACLOUDS)
ADD_DEFINITIONS(-DROSCONSOLE_MIN_SEVERITY=ROSCONSOLE_SEVERITY_INFO)
#############################
# SiftGPU ###################
#############################
IF (${USE_SIFT_GPU})
add_subdirectory(external)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/SiftGPU/src)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/SiftGPU/bin)
add_definitions(-DUSE_SIFT_GPU)
ENDIF (${USE_SIFT_GPU})
#############################
# GICP ######################
#############################
IF (${USE_GICP})
SET(gicp_build_path ${CMAKE_SOURCE_DIR}/external/gicp/ann_1.1.2)
FILE(MAKE_DIRECTORY ${gicp_build_path}/lib/)
MESSAGE("\n------------------------------------------------------------------\n")
MESSAGE("Compiling GICP...")
EXECUTE_PROCESS(
COMMAND make ${ROS_PARALLEL_JOBS} linux-g++
WORKING_DIRECTORY ${gicp_build_path}
RESULT_VARIABLE gicp_return
)
MESSAGE("\n------------------------------------------------------------------\n")
#on error
IF (NOT ${gicp_return} EQUAL 0)
MESSAGE(FATAL_ERROR "GICP cannot be compiled. Returned: ${gicp_return}")
ENDIF (NOT ${gicp_return} EQUAL 0)
FILE(COPY ${gicp_build_path}/lib/libANN.a DESTINATION ${CMAKE_SOURCE_DIR}/lib/)
ENDIF (${USE_GICP})
IF (${USE_GICP_BIN})
add_definitions(-DUSE_ICP_BIN)
ENDIF (${USE_GICP_BIN})
IF (${USE_GICP_CODE})
add_definitions(-DUSE_ICP_CODE)
ENDIF (${USE_GICP_CODE})
IF (${USE_PCL_ICP})
add_definitions(-DUSE_PCL_ICP)
ENDIF (${USE_PCL_ICP})
#############################
# OpenCV ####################
#############################
#For using SIFT and SURF provide your own opencv installation
#via exporting a shell variable
set(OpenCV_DIR $ENV{OpenCV_DIR})
#or set it directly here, e.g.
#set(OpenCV_DIR /home/endres/ros_indigo/opencv2/build/)
#Then activate the following definition
#add_definitions(-DCV_NONFREE)
IF (NOT "${OpenCV_DIR}" EQUAL "")
MESSAGE("Using OpenCV from " ${OpenCV_DIR})
ENDIF (NOT "${OpenCV_DIR}" EQUAL "")
find_package(OpenCV REQUIRED)
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIBRARY_DIRS})
#############################
# Eigen ####################
#############################
find_package(Eigen3 REQUIRED)
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
add_definitions(${EIGEN_DEFINITIONS})
##############################################################################
# Some QT Magic (MOC Creation)
##############################################################################
file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui)
file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc)
file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/local/*.hpp src/qtros.h src/openni_listener.h src/qt_gui.h src/graph_manager.h src/glviewer.h src/ros_service_ui.h)
qt5_add_resources(QT_RESOURCES_CPP ${QT_RESOURCES})
qt5_wrap_ui(QT_FORMS_HPP ${QT_FORMS})
qt5_wrap_cpp(QT_MOC_HPP ${QT_MOC} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
#qt5_wrap_cpp(QT_MOC_HPP ${QT_MOC})
##############################################################################
# Sources to Compile
##############################################################################
SET(ADDITIONAL_SOURCES src/gicp-fallback.cpp src/main.cpp src/qtros.cpp src/openni_listener.cpp src/qt_gui.cpp src/node.cpp src/glviewer.cpp src/parameter_server.cpp src/ros_service_ui.cpp src/misc.cpp src/landmark.cpp src/loop_closing.cpp src/ColorOctomapServer.cpp src/scoped_timer.cpp src/icp.cpp src/matching_result.cpp)
#GraphManager Files
SET(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES} src/graph_manager.cpp src/graph_mgr_io.cpp src/graph_manager2.cpp src/graph_mgr_odom.cpp)
SET(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES} src/transformation_estimation_euclidean.cpp src/transformation_estimation.cpp src/graph_manager2.cpp src/header.cpp)
#Computation of meaningful covariances
SET(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES} src/covariance_estimation.cpp) # src/edge_labeler.cpp)
#Detector Threshold Adapter
SET(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES} src/feature_adjuster.cpp src/features.cpp)
IF (${USE_SIFT_GPU})
SET(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES} src/sift_gpu_wrapper.cpp)
ENDIF (${USE_SIFT_GPU})
file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS)
include_directories(SYSTEM external/ /usr/include/suitesparse/)
##############################################################################
# Binaries
##############################################################################
add_executable(rgbdslam ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP} ${ADDITIONAL_SOURCES})
add_dependencies(rgbdslam rgbdslam_gencpp)
#set libs
#SET(G2O_LIBS cholmod g2o_core g2o_stuff g2o_types_slam3d g2o_solver_cholmod g2o_solver_pcg g2o_solver_csparse cxsparse g2o_incremental)
#SET(G2O_LIBS ${G2O_LIBRARIES} cholmod cxsparse)
#SET(LIBS_LINK GL GLU -lgl2ps ${G2O_LIBS} ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${OpenCV_LIBS})
#Use specific version of cxsparse, to avoid linker warning about possible conflicts between versions 2.2.3 (linked from g2o) and 3.1.0
SET(LIBS_LINK GL GLU cholmod cxsparse Qt5::Widgets Qt5::OpenGL Qt5::Concurrent ${G2O_LIBRARIES} ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${OpenCV_LIBS})
#-lboost_signals -lrt -loctomap -loctomap_server -loctomath)
IF (${USE_SIFT_GPU})
SET(LIBS_LINK ${LIBS_LINK} siftgpu)
ENDIF (${USE_SIFT_GPU})
IF (${USE_GL2PS})
SET(LIBS_LINK ${LIBS_LINK} -lgl2ps)
ENDIF (${USE_GL2PS})
IF (${USE_GICP})
SET(LIBS_LINK ${LIBS_LINK} gicp ANN gsl gslcblas)
ENDIF (${USE_GICP})
#link libraries
target_link_libraries(rgbdslam ${LIBS_LINK} ${catkin_LIBRARIES})
IF (${USE_GICP})
set(ROS_COMPILE_FLAGS ${ROS_COMPILE_FLAGS} -fpermissive)
add_library(gicp external/gicp/bfgs_funcs.cpp external/gicp/gicp.cpp external/gicp/optimize.cpp external/gicp/scan.cpp external/gicp/transform.cpp)
ENDIF (${USE_GICP})
---------------------------------------------- edit ---------------------------------------------------------- this is the launch file I am using for rgbdslam
<launch>
<node pkg="rgbdslam" type="rgbdslam" name="rgbdslam" cwd="node" required="true" output="screen">
<!-- Input data settings-->
<param name="config/topic_image_mono" value="/kinect2/qhd/image_color_rect"/>
<param name="config/camera_info_topic" value="/kinect2/qhd/camera_info"/>
<param name="config/topic_image_depth" value="/kinect2/qhd/image_depth_rect"/>
<param name="config/topic_points" value=""/> <!--if empty, poincloud will be reconstructed from image and depth -->
<!-- These are the default values of some important parameters -->
<param name="config/feature_extractor_type" value="SIFTGPU"/><!-- also available: SIFT, SIFTGPU, SURF, SURF128 (extended SURF), ORB. -->
<param name="config/feature_detector_type" value="SIFTGPU"/><!-- also available: SIFT, SURF, GFTT (good features to track), ORB. -->
<param name="config/detector_grid_resolution" value="3"/><!-- detect on a 3x3 grid (to spread ORB keypoints and parallelize SIFT and SURF) -->
<param name="config/optimizer_skip_step" value="15"/><!-- optimize only every n-th frame -->
<param name="config/cloud_creation_skip_step" value="2"/><!-- subsample the images' pixels (in both, width and height), when creating the cloud (and therefore redu$
<param name="config/backend_solver" value="csparse"/><!-- pcg is faster and good for continuous online optimization, cholmod and csparse are better for o$
<param name="config/pose_relative_to" value="first"/><!-- optimize only a subset of the graph: "largest_loop" = Everything from the earliest matched frame $
<param name="config/maximum_depth" value="5"/>
<param name="config/subscriber_queue_size" value="20"/>
<param name="config/min_sampled_candidates" value="30"/><!-- Frame-to-frame comparisons to random frames (big loop closures) -->
<param name="config/predecessor_candidates" value="20"/><!-- Frame-to-frame comparisons to sequential frames-->
<param name="config/neighbor_candidates" value="20"/><!-- Frame-to-frame comparisons to graph neighbor frames-->
<param name="config/ransac_iterations" value="140"/>
<param name="config/g2o_transformation_refinement" value="1"/>
<param name="config/icp_method" value="gicp"/> <!-- icp, gicp ... -->
</node>
</launch>
any help would be very appreciated!
Asked by skynet on 2018-03-24 18:58:28 UTC
Answers
I moved the Code/Build file that new workspace "rgbdslam_catkin_ws" that the script generated (mind you that worked for me) and put it in my workspace I have been using for my project. I edited the build/CMakeCache.txt and replaced the
//Path to a library.
G2O_CORE_LIB:FILEPATH=G2O_CORE_LIB_GTEST_LIBRARY-NOTFOUND
with the actual directory to g2o
//Path to a library.
G2O_CORE_LIB:FILEPATH=/home/astrobotics/g2ofork/install/lib/libg2o_core.so
just make sure you have g2ofork outside of your workspace
Asked by skynet on 2018-03-30 15:09:20 UTC
Comments
same issue on the github
Asked by Hamid Didari on 2018-03-24 23:45:23 UTC
Also stuck at catkin_make part. The only difference for me is:
No rule to make target '/opt/ros/kinetic/lib/libg2o_solver_cholmod.so'
Asked by Dox on 2018-03-28 20:15:57 UTC
Did you use the install script?
Asked by skynet on 2018-03-29 10:57:21 UTC
I found that if I made a completely know catkin workspace with the script it works but as soon as i try making it in a previously setup workspace it does this
Asked by skynet on 2018-03-29 12:26:53 UTC
Yes, I used the installation script. I followed the steps posted on github but still couldn't resolve it...
Asked by Dox on 2018-03-29 14:49:56 UTC
I'm curious what your catkin_make error is because I have a line
which is where i originally tried to install g2o so its directory is like cashed
Asked by skynet on 2018-03-29 15:38:54 UTC
After modifying FindG2o.cmake I also added C++11 support. Then I run rosdep install rgbdslam so that g2o is installed. Currently catkin_make returns
Asked by Dox on 2018-03-29 16:22:10 UTC
im running into the same problem now, did you sovle it?
Asked by greg on 2018-03-29 22:24:05 UTC
I found that when I use the script to make a completely new workspace it works but when I use it to add rgbdslam to my current WS it has this problem. I am going to add a computer to my robot and run the install script there and just run my rgbdslam on that.
Asked by skynet on 2018-03-30 08:05:19 UTC
I've also installed it again using script and it worked, but now when I try to launch rgbdslam.launch file I get the following error:
Have you tried running it?
Asked by Dox on 2018-04-01 14:26:27 UTC
@Dox I am using a modified launch file in order to connect with iai_kinect2. I will edit the bottom of my question to include the rgbdslam_kinect2.launch file but, originally I believe it worked for me off the bat.
Asked by skynet on 2018-04-01 16:11:15 UTC
@skynet I've found the same issue reported on github so I am trying to resolve it following the guide provided.
Asked by Dox on 2018-04-01 16:39:09 UTC