mimalloc_rust
mimalloc_rust copied to clipboard
add an environment variable for dynamic linking
Hi, could we add an environment variable for dynamic linking?
Something that like CARGO_MIMALLOC_DYNAMIC_LINKING
that would do something akin to https://github.com/fede1024/rust-rdkafka/blob/master/rdkafka-sys/build.rs#L41
(finding the lib with pkg-config).
There might be a version mismatch, but there are several advantages.
- you don't need to do the static build everytime for project in development (if your rust version changes or if you cargo clean).
- some OS have a hard time with static compilation (in my case NixOS) because it has strict rules for dependencies. Since it can be found as a dependency already built in the OS, dynamic compilation would be best.
to give you a bit more context, I've tried to package something recently in rust that had a dependency on mimalloc_rust and had to give up (because compiling mimalloc has some dependencies not included when compiling for darwin).
I have the same issue here, for MacOS Darwin, static link is always very hard while dynamic link is preferred. I would love to see it working on MacOS.
Thanks, Jianshu