One major reason is that some libraries are incredibly difficult to link fully statically. Glibc is an example for that. For that reason, statically linked programs usually use musl libc. That’s not generally bad, but there are differences between these libc implementations and some use cases may need glibc specifically.
The Crystal interpreter has a specific use case for libdl
: it needs to be able to load dynamic libraries at runtime for handling lib
bindings in interpreted code. libdl
is simply not available as a static library. So it’s impossible to statically link a fully functional interpreter.
See Shipping the interpreter for details.