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

haskell.compiler.ghc865Binary: disable stripping once again on ARMv8 #98265

Closed
wants to merge 1 commit into from

Conversation

delroth
Copy link
Contributor

@delroth delroth commented Sep 19, 2020

Motivation for this change

There seems to be a latent bug with strip + patchelf on the GHC stage2
binary which got triggered again by patchelf 0.12. Until this is
properly fixed in patchelf, re-disable stripping.

Not going through staging since all the rebuilds are currently broken at head anyway.

Fixes #97407.

@GrahamcOfBorg build pandoc

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

There seems to be a latent bug with strip + patchelf on the GHC stage2
binary which got triggered again by patchelf 0.12. Until this is
properly fixed in patchelf, re-disable stripping.

Fixes NixOS#97407.
@delroth
Copy link
Contributor Author

delroth commented Sep 19, 2020

Hmm, I'm confused as to why there's a diff on Darwin and why ofborg seems to be trying to rebuild some x86_64 targets. I was expecting this to only cause rebuilds on ARMv8.

Evaluation also fails on ARMv8 and it seems to be for a completely unrelated reason :(

@cdepillabout
Copy link
Member

@delroth

Hmm, I'm confused as to why there's a diff on Darwin and why ofborg seems to be trying to rebuild some x86_64 targets. I was expecting this to only cause rebuilds on ARMv8.

I think this is causing rebuilds because it defines dontStrip in the builder environment even when not on ARM:

$ git checkout PARENT_COMMIT_OF_THIS_PR # the parent commit of ab85f1b 
$ nix-instantiate -A haskell.compiler.ghc865Binary
/nix/store/pz3g8s49cz7y7pq1lw04ssgl9f01fk5p-ghc-8.6.5-binary.drv
$ git checkout ab85f1b # the commit from this PR
$ nix-instantiate -A haskell.compiler.ghc865Binary
/nix/store/h3hbi22nns76xszisi5hwg5j087m4z1r-ghc-8.6.5-binary.drv
$ nix-diff /nix/store/pz3g8s49cz7y7pq1lw04ssgl9f01fk5p-ghc-8.6.5-binary.drv /nix/store/h3hbi22nns76xszisi5hwg5j087m4z1r-ghc-8.6.5-binary.drv
- /nix/store/pz3g8s49cz7y7pq1lw04ssgl9f01fk5p-ghc-8.6.5-binary.drv:{out}
+ /nix/store/h3hbi22nns76xszisi5hwg5j087m4z1r-ghc-8.6.5-binary.drv:{out}
• The environments do not match:
    + dontStrip=

The above is on Linux x86_64. You can see that dontStrip= exists in the environment now, even though it is empty.

In the future, if you wanted to do this without causing a mass rebuild, most people optionally append the attribute:

stdenv.mkDerivation ({
  ...
} // lib.optional stdenv.hostPlatform.isAarch64 {
  dontStrip = true;
})

This avoids the mass rebuild on platforms other than aarch64.


However, in the Haskell case, we normally send all PRs to the haskell-updates branch, and just let the mass rebuild take place.

So can you change the base branch for this PR to haskell-updates?

@vcunat
Copy link
Member

vcunat commented Sep 21, 2020

Yes. However, null values are filtered, so I'd use a simpler modification:

stdenv.mkDerivation {
  # ...
  dontStrip = if stdenv.hostPlatform.isAarch64 then true else null;
}

@vcunat
Copy link
Member

vcunat commented Sep 21, 2020

But, to be clear... this commit doesn't fix the bootstrap for me:

error: --- Error --- nix-daemon
builder for '/nix/store/hmwa7c6igf1hkqbhzn2y1iwmdfc13fgv-hscolour-1.24.4.drv' failed with exit code 134; last 10 log lines:
  Preprocessing library for hscolour-1.24.4..
  Building library for hscolour-1.24.4..
  /nix/store/v3xrdb3hg9gwhm9ccdrcymmyxdcrzdw7-ghc-8.6.5-binary/lib/ghc-8.6.5/bin/ghc: /nix/store/b1q7iryv7m1s5z6apflis28ai4ln5wlg-ncurses-6.2-abi5-compat/lib/libtinfo.so.5: no version information available (required by /nix/store/v3xrdb3hg9gwhm9ccdrcymmyxdcrzdw7-ghc-8.6.5-binary/lib/ghc-8.6.5/bin/../haskeline-0.7.4.3/libHShaskeline-0.7.4.3-ghc8.6.5.so)
  /nix/store/v3xrdb3hg9gwhm9ccdrcymmyxdcrzdw7-ghc-8.6.5-binary/lib/ghc-8.6.5/bin/ghc: /nix/store/b1q7iryv7m1s5z6apflis28ai4ln5wlg-ncurses-6.2-abi5-compat/lib/libtinfo.so.5: no version information available (required by /nix/store/v3xrdb3hg9gwhm9ccdrcymmyxdcrzdw7-ghc-8.6.5-binary/lib/ghc-8.6.5/bin/../ghc-8.6.5/libHSghc-8.6.5-ghc8.6.5.so)
  /nix/store/v3xrdb3hg9gwhm9ccdrcymmyxdcrzdw7-ghc-8.6.5-binary/lib/ghc-8.6.5/bin/ghc: /nix/store/b1q7iryv7m1s5z6apflis28ai4ln5wlg-ncurses-6.2-abi5-compat/lib/libtinfo.so.5: no version information available (required by /nix/store/v3xrdb3hg9gwhm9ccdrcymmyxdcrzdw7-ghc-8.6.5-binary/lib/ghc-8.6.5/bin/../terminfo-0.4.1.2/libHSterminfo-0.4.1.2-ghc8.6.5.so)
  [ 1 of 16] Compiling Language.Haskell.HsColour.Classify ( Language/Haskell/HsColour/Classify.hs, dist/build/Language/Haskell/HsColour/Classify.o )
  ghc: internal error: MUT_VAR_CLEAN object entered!
      (GHC version 8.6.5 for aarch64_unknown_linux)
      Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
  /nix/store/khaz6yssv0bf5xidnp64dd5gra88ldba-stdenv-linux/setup: line 1302:   249 Aborted                 (core dumped) ./Setup build
error: --- Error --- nix-daemon
1 dependencies of derivation '/nix/store/rs8dpxn2245hq89i25swr5am7y36lvqs-hscolour-1.24.4.drv' failed to build
[2 built (1 failed), 99 copied (1052.2 MiB), 328.4 MiB DL]
error: error: --- Error --- nix-daemon
1 dependencies of derivation '/nix/store/85a4jxrb8q1bq7cnl3191wfndy85qiwb-ghc-8.8.4.drv' failed to build

(ghc attribute, the shared box) EDIT: we could try to push it and see, but IIRC the stripping was done due to us hitting Hydra's output size limit (was it 2 GiB for sum of output NAR sizes?)

@cdepillabout
Copy link
Member

we could try to push it and see, but IIRC the stripping was done due to us hitting Hydra's output size limit (was it 2 GiB for sum of output NAR sizes

Oh yeah, good memory. This does sound familiar. I think you're right here. This appears to be the issue where it was discussed:

#66277

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

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

I don't think that PR actually helps. I have applied this patch to a current version of master

--- a/pkgs/development/compilers/ghc/8.6.5-binary.nix
+++ b/pkgs/development/compilers/ghc/8.6.5-binary.nix
@@ -55,6 +55,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ perl ];
   propagatedBuildInputs = stdenv.lib.optionals useLLVM [ llvmPackages.llvm ];
 
+  dontStrip = true;
+
   # Cannot patchelf beforehand due to relative RPATHs that anticipate
   # the final install location/
   ${libEnvVar} = libPath;

and then tried to build pandoc, but without success. The build of ghc-8.6.5-binary now succeeds, but it fails quickly trying to build hscolour:

[ 1 of 16] Compiling Language.Haskell.HsColour.Classify ( Language/Haskell/HsColour/Classify.hs, dist/build/Language/Haskell/HsColour/Classify.o )
/nix/store/k832pghqg9z887j8py47ddhwzrn4yj1f-stdenv-linux/setup: line 1302:   226 Bus error               (core dumped) ./Setup build
builder for '/nix/store/a4b1pcyf3js8dlsfaigafdkffwvycmr3-hscolour-1.24.4.drv' failed with exit code 135
cannot build derivation '/nix/store/ldnrk1wbwk93c938sw16zj9q4gnyv12c-hscolour-1.24.4.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/hjljkfwkd4bki9lzn9yx61xc54ypf17z-ghc-8.10.2.drv': 1 dependencies couldn't be built
error: build of '/nix/store/hjljkfwkd4bki9lzn9yx61xc54ypf17z-ghc-8.10.2.drv' failed

The same thing happens when trying to compile pandoc with ghc-8.8.4 with that patch applied.

EDIT: For what it's worth, I tried that build on a Raspberry Pi 4b running nixos-unstable.

@delroth
Copy link
Contributor Author

delroth commented Sep 25, 2020

I'm still not sure why this seems to completely solve the problem when building on my ec2 aarch64 builder but not elsewhere... I'll close this PR for now and will focus on trying to actually fix patchelf instead of working around the issue.

@delroth delroth closed this Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ghc won't bootstrap on aarch64-linux anymore
4 participants