-
Notifications
You must be signed in to change notification settings - Fork 20
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
Support for Rust libraries in colcon workspace #17
Comments
Hi @mxgrey, I need Cargo library support and will look into this/work towards creating a PR this week. @esteve @bergercookie do you have time at the moment to review/merge a PR? I only ask since this thread was left unanswered and there hasn't been much activity on this repository. |
@allsey87 that'd be great, thank you so much! Yeah, I can review your PR and merge it. |
We may want to coordinate effort with @nnmm . I believe he was thinking about incorporating these concepts into his PRs. |
See the colcon/colcon-ros-cargo repository (currently still in a PR). |
Firstly, much thanks to the developers and maintainers for getting this plugin started! I'm very excited by the prospect of using Rust in ROS2, and more generally having a nice automated workspace overlay tool for Rust.
After trying out the tool, I noticed that Rust library packages seem to explicitly not be supported. Trying to include a library package, I get the following error message:
I assume this is an intentional limitation, since it currently seems quite difficult to have Cargo redirect to a local dependency without modifying the
Cargo.toml
of the package that needs to use the local dependency.While researching how we might be able to make libraries and dependency overlays work I learned about Cargo config files which (will) offer a patch-in-config feature. This allows a
[patch]
section to be put into a.cargo/config.toml
file, and those dependency patches will be applied to every package that belongs to the workspace that the config file is provided for. This feature is currently in thebeta
channel (version 1.56), which looks like it will move tostable
on Oct 21.I just did a quick manually set-up test of this with the following structure (relative to the root of a hypothetical colcon workspace):
.cargo/config.toml
:src/hello_lib/Cargo.toml
:src/hello_lib/src/lib.rs
:src/hello_app/Cargo.toml
:src/hello_app/main.rs
:Then run the following command from
src/hello_app
:You should find that the
hello_app
successfully builds, runs, and prints outHello, library!
. (Make sure you have runrustup install beta
andrustup update
before running the command.)I think this would be a solid strategy for fully integrating Cargo into colcon. The documentation for this feature explicitly mentions that the feature is intended for external build tools (such as colcon):
Does anyone have thoughts on this? It's exciting to think that we might be able to have complete colcon+cargo integration in just a few weeks when this feature goes stable.
The text was updated successfully, but these errors were encountered: