Closed pnoltes closed 1 year ago
The default build produced a 200K shared object after stripping.
After adding corrosion_add_target_local_rustflags(rust_bundle_activator "-Cprefer-dynamic")
, a 14K shared object resulted.
If we want to have classical Celix bundle written in Rust, -Cprefer-dynamic
may be preferable over default static linking.
Another way of supporting Rust bundle is to add support for static bundles first(#94). It's known that CppMicroServices has such support: https://docs.cppmicroservices.org/en/stable/framework/doc/static_bundles.html IMO, static bundle is a nice-to-have feature even for C/C++ development.
corrosion_add_target_local_rustflags(rust_bundle_activator "-Cprefer-dynamic")
Updated. Note that the rust_bundle_activator lib now depends on the std rust lib (libstd-<some-hash>.so
).
Ideally the celix container is also linked against that (this is done in C++ by generating a C++ main source instead of C).
But IMO for now this good enough.
Another way of supporting Rust bundle is to add support for static bundles first(#94). It's known that CppMicroServices has such support: https://docs.cppmicroservices.org/en/stable/framework/doc/static_bundles.html IMO, static bundle is a nice-to-have feature even for C/C++ development.
I agree. I did have a look at static bundle a while back, even with the addition of linking a resource.zip into the lib. I will update the issue #94, so that the text is more relevant.
This PR represents the initial step in a feasibility experiment for Rust support, as described in #599.
To be clear, I currently have no plans to introduce production-ready Rust support for Apache Celix in the short or long term. However, I am curious about its potential and am willing to spend some of my free time experimenting with possible solutions.
This current PR demonstrates that it is possible to start and stop a bundle written in Rust. I intend to gradually expand this experiment with a series of small, incremental PRs over time.
Note that currently the CELIX_RUST_EXPERIMENTAL option is default OFF and not build on CI (yet)