Troubleshooting
Quick solutions to common ros-z build and runtime issues. Click on any question to expand the answer.
Most issues fall into three categories: build configuration, runtime connectivity, or ROS 2 integration.
Build Issues
Build fails with 'Cannot find ROS packages' or package discovery errors
Build fails with 'Cannot find ROS packages' or package discovery errors
Root Cause: ROS 2 environment not sourced or packages not installed.
Solutions:
-
Source ROS 2 environment:
source /opt/ros/jazzy/setup.bash # or for rolling: source /opt/ros/rolling/setup.bash -
Verify environment variables:
echo $AMENT_PREFIX_PATH echo $CMAKE_PREFIX_PATH -
Check package installation:
ros2 pkg prefix example_interfaces # If fails, install: sudo apt install ros-jazzy-example-interfaces -
Clean and rebuild:
cargo clean -p ros-z-msgs cargo build -p ros-z-msgs
Common Error Messages:
| Error | Solution |
|---|---|
| "Package X not found" | Source ROS 2 environment |
| "Cannot find ament_index" | Install ROS 2 or use bundled msgs |
| "AMENT_PREFIX_PATH not set" | Run source /opt/ros/jazzy/setup.bash |
Compiler error: cannot find crate ros_z_msgs
Compiler error: cannot find crate ros_z_msgs
Root Cause: ros-z-msgs is not part of default workspace members.
Solution:
# Build ros-z-msgs explicitly
cargo build -p ros-z-msgs
# Then build your example
cargo build --example z_srvcli
Note: ros-z-msgs is excluded from default builds to avoid requiring ROS 2 for core development. Build it explicitly when needed.
Build takes too long to complete
Build takes too long to complete
Solutions:
# Use parallel builds (automatic on most systems)
cargo build -j $(nproc)
# Build only what you need
cargo build -p ros-z-msgs --features std_msgs,geometry_msgs
Linker errors during build (especially with rcl-z)
Linker errors during build (especially with rcl-z)
Solution:
# Clear cache and rebuild
cargo clean
source /opt/ros/jazzy/setup.bash
cargo build -p rcl-z
Warning: After changing feature flags or updating ROS 2, run cargo clean -p ros-z-msgs to force message regeneration.
Runtime Issues
Publishers and subscribers on different processes don't communicate
Publishers and subscribers on different processes don't communicate
Root Cause: Zenoh router not running or nodes not configured correctly.
Solution:
-
Ensure the router is running:
cargo run --example zenoh_router -
Verify endpoint matches in your code:
let ctx = ZContextBuilder::default() .with_router_endpoint("tcp/localhost:7447") // Must match router .build()?;
Router fails to start with 'Address already in use' error
Router fails to start with 'Address already in use' error
Root Cause: Another process is using port 7447.
Solutions:
-
Stop the conflicting process
-
Use a custom port:
// Custom router port let router_config = RouterConfigBuilder::new() .with_listen_port(7448) .build()?; // Connect sessions to custom port let ctx = ZContextBuilder::default() .with_router_endpoint("tcp/localhost:7448") .build()?;
Don't want to manage a router for simple local testing
Don't want to manage a router for simple local testing
Solution: Use peer mode with multicast discovery:
let ctx = ZContextBuilder::default()
.with_zenoh_config(zenoh::Config::default())
.build()?;
Warning: Peer mode won't interoperate with ROS 2 nodes using rmw_zenoh_cpp in router mode.
Resources
- Building Guide - Correct build procedures
- Networking - Zenoh router setup
- Feature Flags - Available features
- GitHub Issues - Report bugs
Most issues are environmental. Verify your setup matches the build scenario requirements before diving deeper.