-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
GHC >= 9.6 TemplateHaskell doesn't work in pkgsStatic #275304
Comments
My suspicion here is that this is either a |
Of note: something assumes the existence of
however
Maybe someone has an idea where the dyn_hi load comes from. |
ping: @NixOS/static |
Good to know that the hadrian regression from #208959 has been fixed, so we can at least build GHC now. |
My diagnosis is the following:
I can fix that by just disabling haddock in the same way as we do for GHC < 9.6. I'll try doing that later. @bgamari @angerman The question is of course, and you can answer that better than me, has anything changed w.r.t. hadddock and cross with Hadrian? |
Thanks @sternenseemann! Your hypothesis does sound plausible. Recently we did rework Haddock to take documentation from Haskell interface ( |
Seems plausible. I'm personally not too fussed that this change means that haddock is not “retargetable”, i.e. you always need to use the precise haddock bundled with the GHC you are using to compile the documented code. In fact, we probably should explicitly tell Cabal which haddock to use, so this kind of issue doesn't happen or is easier to diagnose. I'll need to investigate, though, under which circumstances we can build haddock with hadrian now. |
The problems seems to be that the haddock package is only built using the stage1 compiler (so as part of stage2) which we necessarily never reach in the case of cross compilation. Presumably we can work around this in UserSettings somehow (although IME you are quite limited if your solution is to be maintainable), but I feel like this is a genuine gap and there ought to be a better way to build a cross-compiler with hadrian… |
I've just skimmed the code, but why do we do this:
what's the rational for adding I guess the proper thing here is to just disable haddocks for cross, and rely on native compilers haddocks. |
Do you mean the native compiler's |
In this situation, haddock would not be built by hadrian, as there is no stage0:exe:haddock target by default. (We should eventually try adding one.) If haddock is enabled and the build->host haddock missing, Cabal tries using the build->build haddock which may fail to load the documentation from the interface files produced by the build->host GHC (e.g. due to a mismatch between dynamic and static linking). Add regression tests to haskell-updates jobset. Resolves NixOS#275304.
This :D |
It's still broken: https://github.com/domenkozar/nixpkgs-static-repo |
Even easier reproducer:
|
That suggests that the GHC was not built as stage2 compiler, or some of the new cross target logic prohibits native codegen now as well. |
Just sidestep the whole braindead install logic from hadrian. It's so bad... Just build and install the compiler with cp. |
The haskell.nix builder for GHC work around this by sidestepping hadrians build and install process and doing it a bit more explicit. I'm not even sure Hadrian can (or should be fixed). The proper solution seems to just bin it outright and build GHC with cabal only. |
I can confirm it works with haskell.nix: https://github.com/domenkozar/nixpkgs-static-repo/tree/haskell.nix |
As pointed out by @sternenseemann in #287794 (comment), the missing
If we build with https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/src/Settings/Packages.hs#L127-156 A workaround mentioned there, could be to build the static/cross compiler with the same version of GHC as bootstrap:
FTR, I tried that. To do so, I had to patch the hadrian source to allow a newer Cabal first. I then changed the bootPkgs to use ghc981 when building cross:
The build then fails with a lot of this:
I have not idea what that means and haven't gone further, yet. Just putting this here in case somebody has an idea. |
You can explicitly build iserv using hadrian. It's not a default target for some reason. And then sidestep the broken install phase of hadrian. You don't need any of this anyway with nix as you a priori know all your install locations. So you can replace the convoluted install phase with a simple EDIT: just use the same logic we have in Haskell.nix, it should be translatable to the nixpkgs GHC builder: #275304 (comment), both builders are still fairly similar. |
Just confirmed this is still a problem with GHC 9.10.1. |
This is a hadrian bug, there's apparently a patch on GHC master (9.10?). That being said, self bootstrapping isn't exactly tested upstream and has become annoying with hadrian due to the strict bounds. |
To be precise: I tested I did not test, at least yet, the self-bootstrapping approach I tried earlier with GHC 9.8. That might still be worth a try. |
Where/when was it fixed? I'd like to patch the ghc I'm using so I'd need to know which commit fixed this. |
EDIT: Mistake, ignore. |
With #208959 fixed, I now get the same external-interpreter error when building Edit: And as mentioned above for GHC 9.10 as well. So basically for GHC 9.6 up. |
I was able to successfully bootstrap GHC 9.10.1 for pkgsStatic from GHC 9.10.1 itself this time. It still doesn't solve the problem at hand, though:
All still the same. |
The original case in this issue #275304 (comment)
succeeds for me, now. |
Agree with #275304 (comment);
produces the error. Additional example:
produces the error |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/build-aarch64-docker-image-on-amd64-machine/55052/5 |
These also produce the error
9.8
|
@bgamari, can we change the title to "GHC 9.6, 9.8, 9.10 TemplateHaskell doesn't work in pkgsStatic, pkgsCross"? |
Namely: * Bump `ghc-wasm` flake to latest, which includes support for Template Haskell and macOS. Note that we now need to pass `-fno-external-interpreter` to GHC; this appears to be related to NixOS/nixpkgs#275304. * Run the Wasm build on macOS in CI, in addition to Linux. * Don't bother building Haddocks in the Wasm build. * Don't use `-fwrite-ide-info` in Wasm build. * `allow-newer` for `time` package. Signed-off-by: Drew Hess <src@drewhess.com>
Describe the bug
Haskell packages in
nixpkgs.pkgsStatic.haskell.packages.ghc98
are unable to be built.Steps To Reproduce
Steps to reproduce the behavior:
nix build nixpkgs#legacyPackages.x86_64-linux.pkgsStatic.haskell.packages.ghc98.Diff
Expected behavior
Diff
is built, linking againstmusl
.Observed behavior
Additional context
The problem here appears to manifest during building of Haddock documentation. For instance,
Notify maintainers
@nh2
The text was updated successfully, but these errors were encountered: