-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot link g2o to ROS project, after building successfully from source and installing to default system paths #749
Comments
There is a ROS package available in ROS1. Did you try using that instead of building from src? See for example, https://github.com/rst-tu-dortmund/teb_local_planner for a package using that. |
This still seems to be an issue on master and is not related to ROS. I cant link use this library when built work source. Edit: It seems to me there is an inconsistency between CMake and the expectation to find "g2o" and "G2O". For example the generated configs are g2oConfig.cmake which is not compatible with find_package(G2O..) Edit #2. You need to set your cmake module path to point the supplied FindG2O.cmake file:
It would be nice to clarify this on the README.md. Ideally it should be copied into the cmake/share folder |
@RainerKuemmerle can you please provide an answer to this issue? |
I built and installed g2o from source, and calling
which g2o
shows me that the g2o binary is installed to:
/usr/local/bin/g2o
Furthermore, I can find the headers by going to:
/usr/local/include/g2o
which gives the following directories:
EXTERNAL apps autodiff config.h core examples solvers stuff types
However, in my ROS Noetic project's CMakeLists.txt file, when I add
find_package(G2O REQUIRED)
I get the error:
I also tried copying over the
cmake_modules
directory from the g2o source directory into my project root directory and added thecmake_modules
directory to theCMAKE_MODULE_PATH
with:list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
In this way, I don't get the above error anymore, but if I print out the g2o environment variables using:
message(STATUS "G2O_INCLUDE_DIR: ${G2O_INCLUDE_DIR}")
message(STATUS "G2O_LIBRARIES: ${G2O_LIBRARIES}")
I see the following for the headers:
G2O_INCLUDE_DIR: /usr/local/include
but for the libraries I see a blank path:
G2O_LIBRARIES:
Which causes linking errors if I try and actually use something like
g2o::SparseOptimizer
in my project.So my question is, how in the world do I get CMake to see g2o so I can link my project to it correctly? I feel like what I've tried should have solved the issue, yet I've had no luck. Any help would be appreciated.
The text was updated successfully, but these errors were encountered: