Rust created binary dependencies

Hi all,

What are the binary dependencies for a binary created from Rust (latest version) ?
What do I need to install in order to create a binary for an old RedHat version (like Enterprise 2.1) ? Will this version be also runnable on newest Linux kernels?

I need to create a binary which will possibly run on old RedHat Linux versions. Is it still possible ?

Thanks for your help !

To handle differing version of libc with the same compiled binary, you can use the musl target to staticly link libc. See this page.
This should handle most cases, however some dependencies add additional dynamic links, and you will have to figure out how to staticly link each such dependency.

Thanks a lot, I wasn't aware of Musl. I'll check it out soon !

Per the platform support page, the official Rust builds for i686-unknown-linux-gnu and x86_64-unknown-linux-gnu are targeted for compatibility with kernel 2.6.18, corresponding to RHEL 5. If you go earlier than that, you're likely to run into missing glibc symbols and unimplemented system calls. Musl can only mitigate the issue with glibc symbols.

That's for the compiler itself, but the policy also affects the standard library.

In any case, running those binaries on newer systems should be no problem.

2 Likes

@cuviper

Thanks for your detailed answer, as always !

I have to deal with a lot of legacy systems, and some even < 2.6.18 :frowning:

1 Like

If you can limit your Rust code to #![no_std], I think it would work on any system you want. You would compile it as a static library of extern "C" FFI functions, and do any std-ish things in C/C++/etc. using the toolchain from your legacy system. I've never tried this though...

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.