Skip to content
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

doc/haskell: Dedup and edit justStaticExecutables #319298

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions doc/languages-frameworks/haskell.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -929,10 +929,12 @@ for this to work.
Haskell dependencies, but will still link dynamically against libc, GMP and
other system library dependencies.

If the library being built or its dependencies use their Cabal-generated
If a library or its dependencies use their Cabal-generated
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the doc team recommends a single line per sentence, so that we don't have to reflow. I haven't done the reflowing to keep the diff readable.

`Paths_*` module, this may not work as well if GHC's dead code elimination is
unable to remove the references to the dependency's store path that module
contains. (See [nixpkgs#164630][164630] for more information.)
contains.
As a consequence, an unused reference may be created from the static binary to such a _library_ store path.
(See [nixpkgs#164630][164630] for more information.)

Importing the `Paths_*` module may cause builds to fail with this message:

Expand Down
16 changes: 2 additions & 14 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,8 @@ in
# This is used by `haskell.lib.justStaticExecutables` to help prevent static
# Haskell binaries from having erroneous dependencies on GHC.
#
# Generated `Paths_*` modules include paths for the runtime library
# directory (and similar) of the package being built. If the `Paths_*`
# module is imported, this creates a dependency from the static binary
# being built to the _library_ being built (which is dynamically linked
# and depends on the GHC used to build it).
#
# To avoid this:
# 1. Build the impacted derivation.
# 2. Run `strings` on the built binary of the impacted derivation to
# locate the store paths it depends on.
# 3. Add `remove-references-to -t ${bad-store-path-in-binary}` to the
# impacted derivation's `postInstall`.
#
# See: https://github.com/NixOS/nixpkgs/issues/164630
# See https://nixos.org/manual/nixpkgs/unstable/#haskell-packaging-helpers
# or its source doc/languages-frameworks/haskell.section.md
, disallowGhcReference ? false
, # Cabal 3.8 which is shipped by default for GHC >= 9.3 always calls
# `pkg-config --libs --static` as part of the configure step. This requires
Expand Down