-
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
cmake export configuration #217
Comments
Really nice. I would only prefer writing |
Thanks. Actually you should be able to do g2o::stuff, g2o::core, etc. The g2o_ prefix arises from the name of the target (g2o_cli_library). This probably wasn't the best illustrative case. However, it' a test case I've been using because I can check if a library pulls in other dependent libraries properly. |
This is great! I am on Ubuntu 16.04 using a from-source build of ROS Kinetic, and I was struggling to get teb_local_planner to link against g2o. I checked out your branch, and most of the linking errors went away. I am still getting undefined references for the following functions:
Are you able to link against the csparse_extension library? All of my ROS packages and source dependencies are in a catkin workspace, including teb_local_planner and libg2o. I build the workspace using Edit: Some further information: I confirmed that |
Hmm... I haven't seen this particular issue, but I'm running on OSX and things like library linker order issues don't matter. Could you provide a bit more information on what the setup is? Can you build with "make VERBOSE=1" to confirm what libraries are being imported, and the order in which they are imported? Cheers, Simon |
These are the g2o libraries that are being imported (where {lib} represents the full path to my workspace
So it looks like the library is being imported. Does it matter that it is the first (of the g2o libraries)? |
It matters for static libraries. It might matter for shared objects: Do you know if the --as-needed flag is set? Cheers, Simon |
No --as-needed flag is set. |
Please ignore the errors I reported earlier, it turns out they came from mistakes on my end (not cleaning my build space after switching branches, incompatibilities between the versions of the packages, etc). |
Ah - thanks for letting me know. Does it all link okay? |
Sorry, didn't see your comment earlier. I took a break from trying to link it to clear my head, but will make another attempt. I'll let you know the results. |
The good news is that teb_local_planner is linking against libg2o properly now. The bad news is that I can't confirm whether your changes work on Ubuntu or not since I am using the branch of g2o provided by ROS. It's the same version I was originally using, so I'm not sure why it works now. |
@sjulier Did you ever open a pull request to merge your changes into upstream? I would welcome your additions as well. |
one suggestion: Me as user don't want to know all internal library stuff. It's easier to have just an env-variable for this. |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
g2o comes with a cmake script (FindG2O.cmake) which can be used by other applications to locate and build g2o. This uses the "Module" style of search, requires manually setting up and manual installation. However, cmake has a much more covenient "Config" style which is easier to set up and use (see https://cmake.org/cmake/help/v3.1/command/find_package.html).
I've created a new branch Export_cmake_Configuration which uses the "Config" style to create the g2o cmake configuration and automatically install it.
Usage is as follows. Suppose I have an application myApp which uses the g2o_cli library. The cmake file is:
I have tested this for both the static and dynamic library build under OSX. I don't have any other platforms I can test on right now. I would be interested to hear questions / comments.
Cheers,
Simon
The text was updated successfully, but these errors were encountered: