-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Fix GHC not building with musl #129289
Fix GHC not building with musl #129289
Conversation
`glibcLocales` only exists when glibc is used. Similar to commit: 8727284 - haskell: only use glibcLocales when using glibc
Looks like I broke the nixpkgs manual with my new doc-related config options:
https://github.com/NixOS/nixpkgs/runs/2986064008?check_suite_focus=true#step:5:3174 Not sure why yet. Edit: Probably because GHC's if test -n "$XELATEX"; then
BUILD_SPHINX_PDF=YES
else
BUILD_SPHINX_PDF=NO
fi and by putting it explicitly in |
7123088
to
a84215b
Compare
Will need to target Edit: OK, investigated: Indeed it's via
It's actually "only" 500 non- |
Well pandoc is not really the point here, I think. I believe we use the 8102 binary to build our 8104 ghc? So this is a full haskellPackages rebuild. We normally do those on haskell-updates, so I don‘t think this needs to target staging, but haskell-updates. |
Result of 29 packages marked as broken and skipped:
6987 packages skipped due to time constraints:
2 packages built successfully:
5 suggestions:
Result of 2 packages marked as broken and skipped:
7117 packages skipped due to time constraints:
2 packages built successfully:
7 suggestions:
|
Done. |
* include fixes for GHC segfaulting: (NixOS/nixpkgs#129247, NixOS/nixpkgs#129289) * musl 1.2.2, including this important fix from musl 1.2.0: #98 (comment) * workaround for fontforge execution failure due to wrong RPATH: NixOS/nixpkgs#94126 * ilmbase musl compilation error: NixOS/nixpkgs#94205 * mesa: Fix `-Werror=int-conversion` build error on musl: NixOS/nixpkgs#94207 survey: * Update file in which stackage packages are listed. See nixpkgs commit 7f236bd4 - hackage2nix: Split configuration, auto disable hydra builds
8d536f3
to
d344593
Compare
6039bd6
to
1dd108d
Compare
I've addressed all feedback.
Ready to merge to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, although I haven't tried building anything with these changes. I'll try building the default compiler and I guess we'll check for extra regressions via the normal haskell-updates
workflow.
With this check, we no longer don't notice when the upstream bindist changes its dependencies (e.g. because a newer Debian version is used that uses a new `ncurses` version).
None of the current bindists appear to contain these paths in their `ghc-stage2` binary.
…OS#118731 NixOS#129247. This commit replaces the musl + glibc hackery in the GHC bindist compiler by using the new musl based bindist that GHC HQ provides (built on Alpine). We could alternatively also use a nix-built musl boostrap compiler, but it seems nicer to use the GHC HQ one for now. This fixes the compiler built by `pkgsMusl.haskell.compiler.ghc8102Binary` segfaulting (NixOS#118731) since the commit 5e2311d - musl: 1.2.1 -> 1.2.2 concretely, musl commit 01c7920f - remove redundant pthread struct members repeated for layout purposes which I suspect breaks some glibc/musl ABI compatibility that may have existed accidentally until then. The added lib.optional stdenv.targetPlatform.isMusl "pie"; also fixes that the packaged bindist compiler cannot create a binary in its `installCheck` phase (and overall); see detail explanation in NixOS#129247.
While this does not fix `ghc865Binary` with musl, it at least prevents that the other, newer errors are shadowed (see NixOS#129247).
…compiler. This addresses the fact that `ghc865Binary` segfaults on musl (see NixOS#118731) because of the glibc+musl mix used in there. With the previous commits, `ghc8102Binary` was changed to use the musl-based bindist from GHC HQ instead, which works. With this change, all nix Haskell compilers builds on musl: NIX_PATH=nixpkgs=. nix-build --no-link --expr 'with import <nixpkgs> {}; { inherit (pkgsMusl.haskell.compiler) ghc884 ghc8104 ghc901 ghcHEAD; }'
…musl Adds new package options: * enableDocs * enableHaddockProgram to control whether to build Sphinx docs, and GHC haddocks and the haddock program. Unfortunately currently the building of the `haddock `program and generating GHC docs are mixed into one option, see: https://gitlab.haskell.org/ghc/ghc/-/issues/20077 Making Sphinx docs disableable, and disabling them by default for Musl and cross builds, makes it much easier to provide these builds without having to support Sphinx's enormous dependency tree for those ways of building.
…and musl. This allows to implement the "HACK" mentioned in the commit to build `pkgsMusl` GHCs on Hydra without failing evaluation on Darwin. Reference of the discussion: NixOS#129289 (comment) Patch contributed by @SternI.
4b7dc37
to
63b1e6e
Compare
and update nixpkgs to master, so that that PR applies nicely. We can worry about going back to stable later (if that fix doesn’t make it anyways)
* Pull in NixOS/nixpkgs#129289 and update nixpkgs to master, so that that PR applies nicely. We can worry about going back to stable later (if that fix doesn’t make it anyways) * Bump naersk too * Bump GHC version in github action
* include fixes for GHC segfaulting: (NixOS/nixpkgs#129247, NixOS/nixpkgs#129289) * musl 1.2.2, including this important fix from musl 1.2.0: #98 (comment) * workaround for fontforge execution failure due to wrong RPATH: NixOS/nixpkgs#94126 * ilmbase musl compilation error: NixOS/nixpkgs#94205 * mesa: Fix `-Werror=int-conversion` build error on musl: NixOS/nixpkgs#94207 survey: * Update file in which stackage packages are listed. See nixpkgs commit 7f236bd4 - hackage2nix: Split configuration, auto disable hydra builds
Motivation for this change
Fixes binary GHCs segfaulting on
pkgsMusl
. See #129247, #118731.All Nix-built Haskell compilers build now on
pkgsMusl
:NIX_PATH=nixpkgs=. nix-build --no-link --expr 'with import <nixpkgs> {}; { inherit (pkgsMusl.haskell.compiler) ghc884 ghc8104 ghc901 ghcHEAD; }'
Key changes included (see commits for details):
ghc8102Binary
to use GHC HQ musl bindist instead of patching glibc bindist with musl.pkgsMusl
hardeningDisable = [ "pie" ]
where needed.static-haskell-nix
significantly, and make it cheaper to build musl-based GHC on Hydra.ncurses
version and similar dependencies the bindists have, and apostUnpack
step to ensure at build time that those are actually correct.ncurses
a bindist needs.ghc8102Binary
as a drive-by contribution.Extra review needed for
buildPlatform
,targetPlatform
etc.TODO
WIP
commit.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)CC people who care about this and may want to try whether it breaks anything, and others qualified to review:
@NixOS/haskell @expipiplus1 @peti @bgamari @nomeata @domenkozar @cdepillabout @dtzWill @lunaris @NorfairKing @maralorn @sternenseemann @dtzWill @Ericson2314 @matthewbauer @aveltras