My dream is to meld Erlang and Rust in one application. Daniel Goertzen has written a nice library (ruster_unsafe on GitHub) that helps with this. It builds fine on Mac, Linux, and FreeBSD. However, the demo does not build on Mac. I've found out a way to build it, which is to invoke cargo rustc -- --codegen link-args='-flat_namespace -undefined suppress'
, which is all well and good, but I was hoping for a more streamlined approach. That is, anyone could clone my repo and simply invoke cargo build
and be done.
One idea I had was to write a build.rs
that output cargo:rustc-link-args="-flat_namespace -undefined suppress"
but that option is not supported in cargo. If it were supported, the script would output this when running on Darwin, but not on other platforms.
I understand that passing linker flags via cargo/rustc is verboten, but I really want this to work on Mac, and this is the only way I have found to make it work. If there is a better approach, I'm all ears.
Thanks