ros2-rust / cargo-ament-build

5 stars 9 forks source link

Prebuilt binaries #9

Closed stelzo closed 1 month ago

stelzo commented 2 months ago

Adding prebuilt binaries would make installation of this tool faster. I would suggest tools like cargo-dist for that.

Why?

It would be great to make this line

cargo install --debug cargo-ament-build  # --debug is faster to install

into

cargo binstall cargo-ament-build

for anyone who has binstall, saving a lot of time.

Also, it would make integrations for the official ROS dependencies easier, where binaries can be distributed.

esteve commented 1 month ago

That's an excellent idea, thanks! I'll set up cargo-dist for ros2_rust, would you mind reviewing the changes when I submit the PR? Thanks.

stelzo commented 1 month ago

Looks good, I did some additional experiments:

I wanted to include aarch64-unknown-linux-gnu, since my robots are running with Jetson devices and I am probably not alone with that. binstall would fallback to building from source, so not a big problem... But regarding the distribution via official ROS tooling, the target would be important.

When I created the issue, I thought it would be the most ROS way to distribute binaries mainly via debian packages etc. (rosdistro guidelines). Then I found maturin which packages binaries into PyPI for distribution. Since ament is Python-heavy, a plugin like this would, in my opinion, be okay for that. But I am probably also quite biased, since a PyPI package is much less pain and gets it quicker to rosdep.

For this case, the aarch64-linux target should be there of course. cargo-dist has no cross compilation support right now but there it is possible to specify a custom runner for the target. See the Cargo.toml from cargo-dist itself.

[workspace.metadata.dist.github-custom-runners]
aarch64-unknown-linux-gnu = "buildjet-8vcpu-ubuntu-2204-arm"
aarch64-unknown-linux-musl = "buildjet-8vcpu-ubuntu-2204-arm"

Now, I would use a custom runner and wait until cargo-dist has native support for cross compilation. There is a free ARM compute node available on Oracle Cloud. But this are just ideas, let me know what you think about all that @esteve.

esteve commented 1 month ago

@stelzo I've submitted #10 for review, please have a look and let me know if it's alright as it is. As for future plans, I wouldn't worry too much about how to distribute via rosdep and the ROS buildfarm, for now having cargo-ament-build available via cargo binstall is enough, it seems to be the most popular way of distributing Rust binaries.

maturin looks interesting, but I'd leave that for the future.