Open nh2 opened 5 years ago
The glibc warning:
Hello.hs
:
main = putStrLn "hello world"
% ghc --make Hello.hs -optl-static
[1 of 1] Compiling Main ( Hello.hs, Hello.o )
Linking Hello ...
rts/Linker.c:601:0: error:
warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
|
601 | hdl = dlopen(dll_name, RTLD_LAZY|RTLD_LOCAL); /* see Note [RTLD_LOCAL] */
| ^
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libnuma.a(affinity.o):function affinity_ip: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Two options:
musl
, but then lose out on Name Service Switchglibc
, but then only statically link everything other than libc.Another example of static glibc breakage: https://old.reddit.com/r/haskell/comments/vqqq7x/trying_to_build_a_statically_linked_binary/
I got this example segfault of somebody trying to use an executable statically linked with glibc and using the network.
The stacktrace is of the program crashing in
gdb
;stack build ... --no-strip
was used to obtain a sensible stack trace, otherwise it would show justin ?? ()
in the entire trace.Should probably document that somewhere as an example for why you may want to use musl here.