ros2-rust / cargo-ament-build

5 stars 9 forks source link

How to use libaries with this tool #7

Open cjbanks opened 4 months ago

cjbanks commented 4 months ago

I am trying to use this package to build a Rust crate however I get the error error: no packages found with binaries or examples when I run colcon build since the crate I'm building is a library. What's the proper way to get ROS 2 to build a Rust crate that's a library?

luca-della-vedova commented 2 weeks ago

I wonder, what is your use case for trying to build a library? Building a Rust crate usually involves compiling from source all its dependencies, dynamic linking is not really used much in the ecosystem. This is also the approach we take for messages, where the ros2-rust message generator actually just generates source code, where crates that need to use the message will find it and build it from source (compared to prebuilding then linking against it, which is done for example in C++).

What did you have in mind exactly? Would the approach of just making sure the source of your library is visible to other crates in the workspace be OK for your use case?