docs: add "Reducing closure size" tutorial (gcc closure leak) - #2552
Open
hamishmack wants to merge 1 commit into
Open
docs: add "Reducing closure size" tutorial (gcc closure leak)#2552hamishmack wants to merge 1 commit into
hamishmack wants to merge 1 commit into
Conversation
Document the existing opt-in knobs for trimming the toolchain (notably gcc) out of an executable's runtime closure: per-component dontStrip/dontPatchELF for dynamically linked exes, and remove-references-to/nukeReferences for fully static binaries, plus nix why-depends for diagnosis. Defaults are intentionally left unchanged: stripping has historically been reported to occasionally break Haskell binaries and that concern is unresolved in the thread, so the page documents the safe opt-in path and tells users to test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new tutorial page, Reducing closure size (removing the gcc dependency), under
docs/tutorials/, and wires it into the mdBookSUMMARY.mdnavigation.The page documents the existing opt-in knobs for trimming the compiler toolchain (most visibly
gcc, ~143 MB) out of an executable's runtime closure:nix why-dependsfor diagnosing what pullsgccin;dontStrip = false;+dontPatchELF = false;for dynamically linked executables (with a copy-pasteablemodulesoverride, scoped to theexescomponent);remove-references-to/nukeReferencesin apostInstallfor fully static binaries, where store paths remain baked in as string data;Defaults are intentionally unchanged
This PR is documentation only. The defaults (
dontStrip = true,dontPatchELF = trueinmodules/component-options.nix, withbuilder/comp-builder.nixpassing--disable-executable-stripping/--disable-library-strippingaccordingly) are deliberately left as-is.Stripping has historically been reported to occasionally break Haskell binaries (angerman in #336), and hamishmack's follow-up question in the thread — whether that still holds with current GHC/binutils — was never answered. Flipping the default without resolving that would be unsafe, so this documents the safe opt-in path and tells users to test their binaries after enabling it.
Flipping the executable-only default (nixpkgs strips executables by default; the historical breakage was about aggressive stripping of library object files used for further linking) could be a sensible follow-up once maintainers resolve the stripping-safety question.
Verification
modules/component-options.nix,builder/comp-builder.nix).book.tomlmultilingualfield is rejected by current mdBook and the only build warnings come from the pre-existingdev/coverage.md; both are unrelated to this change.)Closes #829.