build: Forbid linking glibc statically again

Static linking against glibc has crashes depending on the name
resolution setup (I think when it needs to dlopen). It is a fundamental glibc
limitation that we cannot fix on our end.

It will crash when doing `echo ~<TAB>`.

This carves out a specific exception for "gnu", i.e. glibc, targets.

Other targets, including musl and other operating systems, continue to
allow static linking.
This commit is contained in:
Fabian Boehm 2024-08-30 18:30:03 +02:00
parent 5278259312
commit 848921a391

View file

@ -50,6 +50,9 @@ fn main() {
// Keep verbose mode on until we've ironed out rust build script stuff
target.set_verbose(true);
detect_cfgs(&mut target);
#[cfg(all(target_env = "gnu", target_feature = "crt-static"))]
compile_error!("Statically linking against glibc has unavoidable crashes and is unsupported. Use dynamic linking or link statically against musl.");
}
/// Check target system support for certain functionality dynamically when the build is invoked,