From a9ce4c098e6be0fb5fd1c7673121b5008ae0b0bc Mon Sep 17 00:00:00 2001 From: duongtd Date: Sat, 31 Oct 2026 10:47:28 +0700 Subject: [PATCH] docs: document build environment pitfalls --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 4aa68c9..d5be961 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,38 @@ The shaft footprint is occupied in both static floor maps. The active `/map` cle The map switcher closes that access again if elevator state has not refreshed for 1 second (wall time). The world launch sets its shaft overlay shift to `(35.72, 0.0)` to match the relocated cabin. +## Build environment and common failures + +The supported native build target is Ubuntu 20.04 (Focal, amd64) with ROS Noetic and Gazebo Classic 11. Install ROS, Gazebo, Ignition Messages/Transport, and Protobuf from the same Focal package repositories. Having Ubuntu 20.04 alone does not guarantee a matching toolchain: local installations under `/usr/local` or Conda can take precedence over the OS packages. + +### Protobuf and Ignition header mismatch + +Gazebo's `Actor.hh` includes Ignition Transport 8, which uses generated message headers from Ignition Messages 5. Those headers depend on Protobuf's C++ API. A common failure is compiling the Focal Ignition headers against a custom Protobuf under `/usr/local`; errors can mention `SerializationTable`, `InternalMetadataWithArena`, `ArenaStringPtr`, or methods marked `final` that do not override a virtual method. These are dependency-version errors in generated/system headers, not syntax errors in this package's plugin source. + +For the Focal apt package set used by this package, the expected Protobuf toolchain reports `3.6.1`, and the compiler must resolve Protobuf headers from `/usr/include`. Check all three paths from a terminal before building: + +```bash +source /opt/ros/noetic/setup.bash +command -v protoc +protoc --version +PKG_CONFIG_PATH= PKG_CONFIG_LIBDIR=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig pkg-config --modversion protobuf +printf '#include \n' | g++ -E -H -x c++ - 2>&1 | head -n 1 +``` + +Expected results are `/usr/bin/protoc`, `libprotoc 3.6.1`, `3.6.1`, and a header path beginning `/usr/include/google/protobuf/`. `command -v protoc` and `pkg-config` alone are not sufficient: GCC normally searches `/usr/local/include` before `/usr/include`, so a custom header there can still override the Focal header even when `/usr/bin/protoc` is selected. Remove or isolate the custom Protobuf installation for the build; do not mix it with the Focal `libignition-msgs5-dev` package. If using another Protobuf version intentionally, rebuild Ignition Messages, Ignition Transport, and Gazebo against that same version. + +After correcting the dependency paths, run the build from the catkin workspace root. Remove only that workspace's generated `build/` and `devel/` directories first so CMake does not reuse cached paths to the old Protobuf installation: + +```bash +# Run these commands from your catkin workspace root. +rm -rf build devel +source /opt/ros/noetic/setup.bash +catkin_make --pkg two_floor_elevator_sim +source devel/setup.bash +``` + +For repeatable builds across machines, use one container image pinned by digest and retain that image in a registry or local archive. This repository currently documents native builds and does not include a pinned build container. ROS Noetic and Ubuntu Focal reached end of life on May 31, 2025, so keep the build image and dependency versions available locally for future rebuilds ([ROS Noetic EOL notice](https://discourse.ros.org/t/ros-noetic-end-of-life-may-31-2025/43160)). + ## Verify that the moving workers appear in LiDAR From the workspace, build the package and source its setup file, then start a stationary T800 on the floor-1 dispatch aisle: