Comments (3)
Chatting with @nnmm about this, we've made some progress. Documenting here for the record.
Two issues discover with my process above:
- I was using the Base version of Ros instead of Desktop, which seemed to be missing some important things like colcon-package-selection. I resolved this by switching to ROS Desktop. I also just decided to switch to the official ROS2 Foxy Docker image.
- The
colcon build --packages-up-to rclrs_examples
command was being run in the/
dir instead of the/src/
dir.
I resolved both of these issues and created this Dockerfile:
# Ros2 Foxy runs on ubuntu focal
FROM ros:foxy as base
ARG DEBIAN_FRONTEND=noninteractive
##########################
## Rust Install
##########################
# Install Dependancies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.59.0 -y
ENV PATH=/root/.cargo/bin:$PATH
##########################
## ros2_rust install
##########################
# Install Dependancies
RUN apt-get update && apt-get install -y \
python3-vcstool \
libclang-dev \
clang \
python3.9 \
python3.9-dev \
python3-pip \
git \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pytest colcon-package-selection
# Install the colcon-cargo and colcon-ros-cargo plugins
RUN pip install git+https://github.com/colcon/colcon-cargo.git git+https://github.com/colcon/colcon-ros-cargo.git
# Install the cargo-ament-build plugin
RUN cargo install cargo-ament-build
# Install the ros2_rust package
RUN mkdir src
RUN git clone https://github.com/ros2-rust/ros2_rust.git src/ros2_rust
RUN vcs import src < src/ros
```2_rust/ros2_rust_foxy.repos
RUN . /opt/ros/foxy/setup.sh
WORKDIR /src/
RUN colcon build --packages-up-to rclrs_examples
Building this image results in the following error:
[main] Step 14/18 : RUN colcon build --packages-up-to rclrs_examples
[main] ---> Running in 4e6353cdfe09
[main] Starting >>> rosidl_runtime_rs
[main] --- stderr: rosidl_runtime_rs
[main] Traceback (most recent call last):
[main] File "/usr/lib/python3/dist-packages/colcon_core/executor/__init__.py", line 91, in __call__
[main] rc = await self.task(*args, **kwargs)
[main] File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__
[main] return await task_method(*args, **kwargs)
[main] File "/usr/local/lib/python3.8/dist-packages/colcon_ros_cargo/task/ament_cargo/[build.py](http://build.py/)", line 68, in build
[main] return await super(AmentCargoBuildTask, self).build(
[main] File "/usr/local/lib/python3.8/dist-packages/colcon_cargo/task/cargo/[build.py](http://build.py/)", line 49, in build
[main] rc = await self._build(args, env)
[main] File "/usr/local/lib/python3.8/dist-packages/colcon_ros_cargo/task/ament_cargo/[build.py](http://build.py/)", line 84, in _build
[main] new_package_paths = find_installed_cargo_packages(env)
[main] File "/usr/local/lib/python3.8/dist-packages/colcon_ros_cargo/task/ament_cargo/[build.py](http://build.py/)", line 142, in find_installed_cargo_packages
[main] for prefix in env['AMENT_PREFIX_PATH'].split(os.pathsep):
[main] KeyError: 'AMENT_PREFIX_PATH'
[main] ---
[main] Failed <<< rosidl_runtime_rs [0.02s, exited with code 1]
[main]
[main] Summary: 0 packages finished [0.51s]
[main] 1 package failed: rosidl_runtime_rs
[main] 1 package had stderr output: rosidl_runtime_rs
[main] 9 packages not processed
[main] 'AMENT_PREFIX_PATH'
[main]
[main] Removing intermediate container 4e6353cdfe09
[main] The command '/bin/sh -c colcon build --packages-up-to rclrs_examples' returned a non-zero code: 1
from ros2_rust.
Had to combine the ROS overlay command with the colcon build command to satisfy Docker, but that has resulted in a new error:
[main] Starting >>> rclrs_examples
[main] --- stderr: rclrs_examples
[main] thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-ament-build-0.1.2/src/main.rs:33:62
[main] note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[main] ---
[main] Failed <<< rclrs_examples [0.21s, exited with code 101]
[main]
[main] Summary: 9 packages finished [1min 28s]
[main] 1 package failed: rclrs_examples
[main] 2 packages had stderr output: rclrs rclrs_examples
[main] Removing intermediate container 69cf8b900e43
[main] The command '/bin/sh -c . /opt/ros/foxy/setup.sh && colcon build --packages-up-to rclrs_examples' returned a non-zero code: 101
Complete Dockerfile
# Ros2 Foxy runs on ubuntu focal
FROM ros:foxy as base
ARG DEBIAN_FRONTEND=noninteractive
##########################
## Rust Install
##########################
# Install Dependancies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.59.0 -y
ENV PATH=/root/.cargo/bin:$PATH
##########################
## ros2_rust install
##########################
# Install Dependancies
RUN apt-get update && apt-get install -y \
python3-vcstool \
libclang-dev \
clang \
python3.9 \
python3.9-dev \
python3-pip \
git \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pytest colcon-package-selection
# Install the colcon-cargo and colcon-ros-cargo plugins
RUN pip install git+https://github.com/colcon/colcon-cargo.git git+https://github.com/colcon/colcon-ros-cargo.git
# Install the cargo-ament-build plugin
RUN cargo install cargo-ament-build
# Install the ros2_rust package
RUN mkdir src
RUN git clone https://github.com/ros2-rust/ros2_rust.git src/ros2_rust
RUN vcs import src < src/ros2_rust/ros2_rust_foxy.repos
# Build rclrs
WORKDIR /src/
RUN . /opt/ros/foxy/setup.sh && colcon build --packages-up-to rclrs_examples
from ros2_rust.
This error was related to a bug in cargo-ament-build 0.1.2.
@nnmm pushed a fix in 0.1.3 https://crates.io/crates/cargo-ament-build/0.1.3 which has allowed me to compile with the dockerfile above!
from ros2_rust.
Related Issues (20)
- A small tool for creating ros2 rust packages is available. HOT 3
- Build Error: unable to find std_msgs HOT 1
- Support for Bevy HOT 7
- Investigate Release Builds with Debug Symbols under GDB for potential issues with rclrs_tests usage of DDS HOT 2
- Attempt to reproduce intermittent unit test failures with a different DDS vendor HOT 1
- Check if our CI configuration is potentially causing our intermittent failures HOT 1
- Move rclrs_test into rclrs
- Investigate the rcl struct drop order HOT 4
- Failed to build depends on `builtin_interfaces` HOT 10
- Cargo can't find `Std_msgs` HOT 6
- Your own installation process crashes HOT 2
- Strange Warning by initial rclrs compilation HOT 2
- Audit drop ordering for rcl handles HOT 2
- Your tutorial is actually too complicated for beginners. HOT 5
- How to build subscribers? HOT 1
- `self.node.get_clock().now().to_ros_msg().unwrap()` doesn't work anymore HOT 8
- QoS for Clients and Services HOT 6
- Prevent message packages from crates.io to be included during the build HOT 15
- Crate imports_granularity requires nightly HOT 4
- Action_msgs not findable, because of relocation from `/ros_ws/install/action_msgs/share/action_msgs/rust` to `/ros_ws/install/share/action_msgs/rust/` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ros2_rust.