Those flags were not actually passed to GHC before, but to Setup.hs.
They were introduced in #86948. The related twitch live stream uses the
build of git-annex as a measurement. I get the following numbers when
building git-annex with doCheck = false:
- for current master: 1:40 wall clock / 340s user
- without any -A64M argument: 1:40 wall clock / 340s user
- with this fix: 1:13 wall clock / 280s user
The idea was good, but the settings were never active.
More testing revealed that this seems to work on darwin just as well, so
we're removing the isLinux condition, too.
The following sequence of operations loses ghc-options:
Setup.hs configure --ghc-options
Setup.hs build --with-ghc=...
This is described in [1].
The fix is simple: Don't pass --with-ghc in the build phase. The values
are taken from the configure step anyway. This seems to have been
introduced all the way back in 64ec4dd87b
about 8 years ago for unknown reasons.
Resolves#286285
[1]: https://github.com/haskell/cabal/issues/10069
Fixes `cabal-install` to remove references to GHC, mostly through other
libraries that are included in the binary.
See: #304352
Co-authored-by: sternenseemann <sternenseemann@systemli.org>
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 https://github.com/ekmett/ad/issues/113.
After 120f24202b, 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.
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.
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: https://github.com/NixOS/nixpkgs/issues/164630
Co-authored-by: sternenseemann <sternenseemann@systemli.org>
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
<https://github.com/haskell/cabal/commit/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: <https://github.com/haskell/cabal/issues/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.