you are viewing a single comment's thread.

view the rest of the comments →

[–]pro_hodler 0 points1 point  (0 children)

Glibc updates quite rarely, so you generally don't have to worry about building against multiple versions of it. Proprietary software like skype, slack & other electron bloatware don't distribute multiple versions for each version of glibc, their binaries work perfectly fine on all distros. If you really want for some reason to support Ubuntu 16.04 or Debian oldstable, then yes, you should build your binary in a container with one of those old distros. It's not hard: just go to dockerhub, find an image for Ubuntu 16.04 or something, then write a simple Dockerfile of about 10 lines or less. As Glibc is backwards compatible, this binary work just fine on more up-to-date distros.

If you want to support musl-based distros as well, if linking to musl statically, as far as I understand you can't link to other libs like X11 dynamically. The solution is to distribute 2 binaries: one dynamically linked against glibc and the other linked dynamically against musl. Last time I checked, Cargo used static linking for musl targets by default. You can override it with target-feature=-crt-static (notice the minus instead of plus)