xgo icon indicating copy to clipboard operation
xgo copied to clipboard

Picking libc -- glibc, musl, bionic, eglibc

Open ghost opened this issue 9 years ago • 2 comments

  • glibc is used in most desktop and server linux distributions
  • musl is used in small-footprint distributions, e.g. for containers (Alpine) or embedded devices (LEDE/OpenWrt)
  • bionic is used by Android (nothing needs to be done here, the android NDK takes care of it)
  • eglibc is simply a smaller version of glibc (this one really isn't that popular I think)

The most important one here is being able to build against musl. What currently happens if you e.g. run a glibc-based binary in Alpine, is that it refuses to run at all because it expects a glibc-based ld command.

@karalabe do you have any thoughts right off the bat? I can look into it sometime soon.

ghost avatar Jun 30 '16 23:06 ghost

If there's a cross compiler package for ubuntu that builds for musl based systems then it can be added easily enough. Otherwise I don't think I'll have the capacity to maintain it (hence why there's no freebsd cross compilation currently).

karalabe avatar Aug 08 '16 11:08 karalabe

The musl-* packages give nice wrappers like musl-gcc that allow you to easily build C programs against musl.

One nice thing about musl is that it's designed to be compatible with static linking: with musl you can make binaries that do not depend on any shared library, not even a libc. Thus, "works on anything with a Linux kernel" binaries can be compiled, which would work on Alpine, Android, OpenWRT, usual GNU/Linux, etc.

nullchinchilla avatar Sep 20 '16 14:09 nullchinchilla