Skip to content

cartographer_ros: build offline_node.cpp into cartographer_offline_node, not the library - #233

Open
lucascolley wants to merge 1 commit into
RoboStack:mainfrom
lucascolley:cartographer-ros-gflags
Open

lucascolley wants to merge 1 commit into
RoboStack:mainfrom
lucascolley:cartographer-ros-gflags

Conversation

@lucascolley

Copy link
Copy Markdown

this PR fixes a shared library vs. static library problem with the build of cartographer_ros, for tartanroboticscollective/ros2-workshop-turtlebot3#30.


LLM text:

src/offline_node.cpp defines gflags (collect_metrics, configuration_directory,
...) that node_main.cpp and assets_writer_main.cpp define too. Upstream builds
the library statically, so the linker leaves offline_node.o out of the other
executables; RoboStack builds it shared, so every executable loads it, gflags
registers each flag twice and cartographer_node aborts at startup:

  ERROR: flag 'collect_metrics' was defined more than once (in files
  '.../src/offline_node.cpp' and '.../src/node_main.cpp')

Move offline_node.cpp into the cartographer_offline_node executable, in every
distribution's patch (lyrical and rolling, whose patch links each target
explicitly, also link that executable to urdf and tf2_msgs, which the library
links privately). New build of cartographer_ros in every distribution.

Verified on osx-arm64 for humble, jazzy, lyrical and rolling: cartographer_node
gets past flag registration (fails on the missing configuration instead), and
cartographer_offline_node links and parses its own flags.

…de, not the library

src/offline_node.cpp defines gflags (collect_metrics, configuration_directory,
...) that node_main.cpp and assets_writer_main.cpp define too. Upstream builds
the library statically, so the linker leaves offline_node.o out of the other
executables; RoboStack builds it shared, so every executable loads it, gflags
registers each flag twice and cartographer_node aborts at startup:

  ERROR: flag 'collect_metrics' was defined more than once (in files
  '.../src/offline_node.cpp' and '.../src/node_main.cpp')

Move offline_node.cpp into the cartographer_offline_node executable, in every
distribution's patch (lyrical and rolling, whose patch links each target
explicitly, also link that executable to urdf and tf2_msgs, which the library
links privately). New build of cartographer_ros in every distribution.

Verified on osx-arm64 for humble, jazzy, lyrical and rolling: cartographer_node
gets past flag registration (fails on the missing configuration instead), and
cartographer_offline_node links and parses its own flags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants