Closed luca-della-vedova closed 7 months ago
Is it possible to conditionally enable the optimization based on some cargo build args?
I believe we could do a feature flag so people that want to build with dynamic linking could do cargo run --features dynamic-linking [...]
, that is some extra typing but I'm not sure there is a better way to do it
The dynamic linking optimization that we use here does reduce compile times quite significantly (on my machine it went from 55s to 46s), but as noted in the docs it makes redistributing the app more tricky.
Specifically, because (probably?) colcon expects the binary to be statically linked, building the package with colcon and trying to run it results in the following error:
On the other hand, if we remove the optimization we get longer compile times but
ros2 run
works like a charm. It's a tradeoff but I believe for greater integration with ROS 2 we should probably drop the dynamic linking (maybe only use it on the local developer workstation if they really want?)CC @Yadunund @mxgrey for feedback