karalabe / xgo

Go CGO cross compiler
MIT License
2.14k stars 279 forks source link

Picking libc -- glibc, musl, bionic, eglibc #56

Open ghost opened 8 years ago

ghost commented 8 years ago

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.

karalabe commented 8 years ago

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).

nullchinchilla commented 8 years ago

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.