-
-
Notifications
You must be signed in to change notification settings - Fork 13.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider building GHC with Haskell libraries linked in statically #129245
Comments
Sounds good to me, thank you for figuring this out! |
I asked on @mpickering says:
@adamse concurs:
My original question was:
the latter part of which @adamse explained:
@mpickering explained that I don't really understand why linking e.g. |
@mpickering / @adamse / @bgamari If you have time, could you help us out with a good explanation or upstream GHC ticket to link to? |
I think the main issue is linking the RTS statically, this currently causes GHCi and TemplateHaskell to use the home grown runtime linker to load other haskell packages object code. I don't quite remember all the details here though. I think that on some targets it would be possible to use dlopen instead of the ghc rts linker even with a statically linked rts (with ld's |
I marked this as stale due to inactivity. → More info |
Definitely not stale. |
GHC in nixpkgs is currently built with
DYNAMIC_GHC_PROGRAMS=YES
. This links Haskell libraries dynamically into GHC, and makes GHC's startup slow.That in turn makes GHC a bit of a drag to use with nix, because even a simple
--version
call is unnecessarily slow (e.g. when used from scripts or in interactive feedback loops).Here's a table of the startup time we're giving away:
--version
time (s)DYNAMIC_GHC_PROGRAMS=YES
DYNAMIC_GHC_PROGRAMS=NO
Finally,
DYNAMIC_GHC_PROGRAMS=YES
also makes the nix package larger: 435 MB vs 411 MB for static.Click here to expand data:
In nixpkgs there is no benefit in linking Haskell libraries dynamically into programs. This is why the
haskell-modules/generic-builder.nix
defaults toenableSharedExecutables ? false
for nix-built Haskell programs. We should do the same for GHC.CC @NixOS/haskell @domenkozar
Edit: We should not do that for now, see #129245 (comment).
Instead, new closing criteria for this issue:
enableShared
it in the GHC Nix derivation files.The text was updated successfully, but these errors were encountered: