If you statically link glibc, you must comply with the LGPL and provide a linkable object or source format of your code. This comes up a surprising amount for Go programmers. The
os/user packages require using
cgo and a
libc, for example, and default to dynamic linking to save you from this gotcha when you include those. But then you're stuck requiring the exact same
glibc version at runtime.
CGO_ENABLED=0 to build with a pure-Go version of packages (which are feature-limited and some big, popular ones will just bail with a message) or switch to
Build like normal on e.g. Alpine Linux or install
musl and then tell Go to use it:
CC=musl-gcc go build --ldflags '-linkmode external -extldflags "-static"' .
A bunch of technomancers in the fediverse. Keep it fairly clean please. This arcology is for all who wash up upon it's digital shore.