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

haskellPackages: GHC 9.10 fix, infrastructure improvements #315167

Merged
merged 41 commits into from
Jun 8, 2024

Conversation

sternenseemann
Copy link
Member

@sternenseemann sternenseemann commented May 27, 2024

Follow up to #312934.

No package updates in this one since we have some mass-rebuild changes that need testing before we can land them.

Currently the eval is mostly cancelled on Hydra as we have a lot of builds for 23.11/24.05 scheduled at the moment.

Builds on haskell-updates.

github-actions bot and others added 7 commits May 26, 2024 00:14
Previously, we would set GHC_PACKAGE_PATH after configure, the reasons
being that

1. Setup.hs configure forbids this from being set since it can make a
   build fail that would otherwise succeed (since it influences how
   GHC behaves when invoked by Cabal).
2. Setting GHC_PACKAGE_PATH being set is sound in our case, since
   we set it precisely to the packages available to Cabal at configure
   time, so there should be no room for a mismatch.
3. Some test suites require GHC_PACKAGE_PATH or GHC_ENVIRONMENT to be
   set, so they can invoke GHC(i) with build dependencies available.
   Cabal >= 3.12 forbids GHC_PACKAGE_PATH from being set after
   <haskell/cabal@d6e38041a7c778fadf8f416>.
   Setting GHC_ENVIRONMENT would be possible, but is cumbersome without
   cabal-install (which has the handy cabal exec command which takes
   care of that). Additionally, it is not clear if it'll remain possible
   to do that: <haskell/cabal#7792>.

Our solution to Cabal 3.12's change is to be more targeted about setting
GHC_PACKAGE_PATH: We _just_ set it for the actual test suite executable.
This can be achieved by using --test-wrapper which when given is invoked
by Cabal to run the test suite. Here we can set any environment
variables after Cabal has already done its environment checks. As long
as we don't do anything stupid, this should be unproblematic.

Users can also arbitrarily influence what GHC_PACKAGE_PATH will contain
using the NIX_GHC_PACKAGE_PATH_FOR_TEST environment variable. This is
un(der)documented for now, since I want to keep some wiggle room for
changing stuff in the coming weeks. Also it's rarely necessary to
actually touch this variable.
elfutils is used in the RTS (rts/Libdw.c), i.e. it will be used on the
target platform.

Tested via pkgsCross.gnu32.haskellPackages.ghc [1], though #304605 needs
to be cherry-picked for elfutils to build.

[1]: nix-shell -E 'with import ./. { crossSystem = "i686-linux"; };
       mkShell { nativeBuildInputs = [haskellPackages.ghc ]; }'
Patches `crypton-x509-system` to use the full path to the `security`
binary.
This makes `justStaticExecutables` error if the produced store path
contains references to GHC. This is almost always erroneous and due to
the generated `Paths_*` module being imported. This helps prevent
`justStaticExecutables` from producing binaries with closure sizes in
the gigabytes.

See: #164630

Co-authored-by: sternenseemann <[email protected]>
This change ensures that packages won't be rebuild compared to before
the introduction of disallowedRequisites/disallowGhcReference unless
they use one of those arguments.

It may be nice to revert this in the future (via staging) for greater
simplicity, but will help with initial regression testing.
@sternenseemann
Copy link
Member Author

I've rescheduled the remaining builds now. We'll have to keep an eye peeled for regressions.

After 120f242, GHC_PACKAGE_PATH isn't
set implicitly in installPhase anymore. Instead we achieve the same by
telling the Makefile the exact ghc command line to use.

As a benefit, we can now cleanly separate build and host in this case:
We used to (implicitly) reuse the host package db. Now we can explicitly
request the package db also used for building Setup.hs.
@sternenseemann
Copy link
Member Author

sternenseemann commented May 28, 2024

W.r.t. regressions affecting aarch64-darwin/linux: #304352 (comment)

github-actions bot and others added 3 commits May 29, 2024 00:14
It is somewhat curious that it behaves differently exclusively here, but
I don't think it is necessary to stop shipping a package due to floating
point arithmetic error—it would be unreasonable to assume there were
none…

See ekmett/ad#113.
This ports our infamous patch for Cabal that prevents certain parts of
the Paths_* module from being generated in order to prevent unnecessary
references on aarch64-darwin, to GHC >= 9.10.

See also:

- Original issues: #140774
- Patches
  - Original patch for GHC >= 8.10 && < 9.2 / Cabal >= 3.2 && < 3.6:
    b0dcd7f
  - Patch for GHC >= 9.2 && < 9.10 / Cabal >= 3.6 && < 3.12: #216857,
    f6f780f129f50df536fb30,
    …
@sternenseemann
Copy link
Member Author

sternenseemann commented May 31, 2024

Edit: See #318013.

Regressions from #304352 on aarch64-darwin.

9999years and others added 6 commits June 4, 2024 01:20
Remove references to `hpack` and `distribution-nixpkgs` paths so that
`cabal2nix` can build on macOS.

See: #304352
I suspect that we'll be able to upgrade to 9.10.* for all three packages
after the next haskell-language-server update. I'll leave that to
maralorn.
Since emanote incurs a reference on GHC on all platforms this override
is all but uselless.
This matches what we do for GHC 8.10.7 where we also can't build the 9.6
versions.
This just requires picking the right version of the package for all
compiler versions.
@sternenseemann
Copy link
Member Author

haskell-updates build report from hydra

evaluation 1806779 of nixpkgs commit 4def049 as of 2024-06-04 14:22 UTC

🟡 Potential issues (and possibly evaluation errors)

  • mergeable jobset is not finished.
  • maintained jobset is not finished.

Build summary

Platform Failed ❌ DependencyFailed ❗ TimedOut ⌛🚫 Unfinished ⏳ Success ✅
aarch64-darwin 🍏 79 32 3 28 6277
aarch64-linux 📱 8 4 1 24 6437
x86_64-darwin 🍎 61 31 2 27 6295
x86_64-linux 🐧 2 16 1 29 6480

Maintained Linux packages with failed dependency

[Removed temporary pkgsMusl failures].

Maintained Darwin packages with build failure

45 job(s)

Maintained Darwin packages with failed dependency

18 job(s)

Unmaintained packages with build failure

114 job(s)

Unmaintained packages with failed dependency

126 job(s)

Top 50 broken packages, sorted by number of reverse dependencies

50 job(s)

gogol-core ⤴️ 184
haskell98 ⤴️ 152
failure ⤴️ 72
connection ⤴️ 56
enumerator ⤴️ 56
util ⤴️ 49
derive ⤴️ 48
system-fileio ⤴️ 45
web-routes ⤴️ 43
accelerate ⤴️ 42
syb-with-class ⤴️ 42
MonadCatchIO-transformers ⤴️ 41
TypeCompose ⤴️ 41
singletons-base ⤴️ 41
PrimitiveArray ⤴️ 35
crypto-random ⤴️ 35
rank1dynamic ⤴️ 33
dual ⤴️ 32
hsp ⤴️ 32
distributed-static ⤴️ 31
language-ecmascript ⤴️ 31
distributed-process ⤴️ 30
iteratee ⤴️ 29
polysemy-time ⤴️ 29
composite-base ⤴️ 28
polysemy-resume ⤴️ 28
polysemy-conc ⤴️ 27
regexpr ⤴️ 26
crypto-numbers ⤴️ 25
either-unwrap ⤴️ 25
polysemy-log ⤴️ 25
HList ⤴️ 24
web-routes-th ⤴️ 24
Crypto ⤴️ 22
crypto-pubkey ⤴️ 22
haskelldb ⤴️ 22
wxdirect ⤴️ 22
BiobaseTypes ⤴️ 21
alg ⤴️ 21
mmsyn2 ⤴️ 21
userid ⤴️ 21
wxc ⤴️ 21
biocore ⤴️ 20
reform ⤴️ 20
wxcore ⤴️ 20
attoparsec-enumerator ⤴️ 19
bytestring-show ⤴️ 19
cprng-aes ⤴️ 19
fay ⤴️ 19
harp ⤴️ 19

⤴️: The number of packages that depend (directly or indirectly) on this package (if any). If two numbers are shown the first (lower) number considers only packages which currently have enabled hydra jobs, i.e. are not marked broken. The second (higher) number considers all packages.

Report generated with maintainers/scripts/haskell/hydra-report.hs

github-actions bot and others added 10 commits June 5, 2024 00:13
elmPackages.elm: fix build failure on darwin
Fixes `cabal-install` to remove references to GHC, mostly through other
libraries that are included in the binary.

See: #304352

Co-authored-by: sternenseemann <[email protected]>
All these references would (indirectly) incur a GHC requisite which is
prevented by #304352 via justStaticExecutables. Consequently, we can
stop setting disallowedReferences.

As it turns out the references we were removing aren't currently
created, so our life gets even easier.
Since it incurs a GHC reference anyways, we have to disable
justStaticExecutables!
github-actions bot and others added 4 commits June 8, 2024 00:14
This commit disables justStaticExecutables for packages on
aarch64-darwin that incur a (usually incorrect) reference on GHC.
justStaticExecutables now fails when a GHC reference remains in the
output (#304352). Due to this reference justStaticExecutables (before
these changes) would only marginally reduce closure size.

In the future, we'll be able to re-introduce justStaticExecutables
after (manually) removing the incorrect references stemming from the use
of Paths_* modules. Tracking Issue: #318013
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.

Haskell tests suites cannot be run with ghc 9.10
5 participants