-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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 packages with separate bin outputs fail due to a reference cycle on aarch64-darwin #140774
Comments
See also #140180 for the same issue. Seems like haskell packages with separate |
@NixOS/darwin-maintainers please can someone look into this issue? I literally have no way of debugging this. |
I attempted to build niv with |
Setting |
Well, that's an obvious workaround, what I'm more interested in is why do |
Which references are causing the cycles? Is it something like an extra codesigning binary in bin which is also used from out? |
While GHC now can be bootstrapped and built on aarch64-darwin, it seems to work only to an extent. All sorts of strange issues have manifested themselves in `haskellPackages` and downstream usage which leads me to conclude that it would be misleading to call it supported on this platform, especially in a stable channel. To give a few examples, separate bin outputs just don't work in general [1] and `opt` fails for unknown reasons in some derivations [2]. As I don't own any appropriate hardware, I have tried tackling these issues by staring into my crystal ball, but so far to no avail (even worse, new issues [3] have cropped up due to changes that should have been an improvement). Given these circumstances, I'm not willing to call GHC supported on aarch64-darwin for the stable channel. I'm (for now) hopeful that we can improve the situation on `master` going forward, but it is not guaranteed that these changes will be backportable without a ton of effort. Should it turn out that we can't resolve these issues or maintain GHC's aarch64-darwin support due to a lack of contributors going forward, I am also prepared to drop aarch64-darwin support completely. While it has been proclaimed a Tier 3 platform, I would argue that the “popular” package GHC has never been working, at least not properly. [1]: NixOS#140774 NixOS#140180 [2]: https://matrix.to/#/!RbXGJhHMsnQcNIDFWN:nixos.org/$C6FK74EajqSTk58JzriYpQJ9f6x3UH3tIREcn04Y-rM?via=nixos.org&via=matrix.org&via=tchncs.de [3]: srid/haskell-template#1 (comment)
I'm seeing this issue in a Nix shell with |
Yes, every haskell package with a separate |
I think we should change the title of the issue to reflect the broader scope. I tried bisecting on my M1 machine earlier but build times are brutal for all the Haskell machinery. I might have to try a different approach later on. I did check if |
I can upload the failed build directory of ormolu (a failing haskell package) being built on aarch64-darwin if that helps? |
This is of limited use because it doesn't really tell you what is wrong in the installed outputs. I'd expect that the references get introduced in This nix feature would be useful right about now… |
If I do:
Those directories do have the built binaries in libs in there. Would that be of more use? i.e, would the |
I've been doing a bit more digging on this and after running
I'm not too sure how these references are found, but I presume that it's doing something similar to running
The reference from
Having a reference from |
Actually the I wonder how the reference comes into existence… |
@sternenseemann Indeed, you are correct. I've just checked on my x86_darwin system and there is a reference from ghcid-bin-aarch64-darwin.tar.gz Update: These symbols don't exist in the |
Maybe we can just make bin output a no-op on aarch64-darwin until it's fixed? |
I'm against this for the simple reason it eliminates any incentive to fix the bug. Separate Given Rosetta, there is a decent enough workaround for the failing builds. |
That's the incentive :) |
Building Haskell Language Server with GHC 9.2.5 runs into the same issue. Does your reference cycle patch still work @srid? Maybe I'm doing something wrong 😅 my-hls = pkgs.haskell-language-server.override {
supportedGhcVersions = ["925"];
}; The overlay (imported by my {pkgs, ...}: let
# Workaround for https://github.com/NixOS/nixpkgs/issues/140774
fixCyclicReference = drv:
pkgs.haskell.lib.overrideCabal drv (_: {
enableSeparateBinOutput = false;
});
in {
nixpkgs.overlays = [
(self: super: {
self.haskell.packages.ghc925.ghcid = fixCyclicReference super.haskell.packages.ghc925.ghcid;
self.haskell.packages.ghc925.haskell-language-server = super.haskell.packages.ghc925.haskell-language-server.overrideScope (lself: lsuper: {
ormolu = fixCyclicReference super.haskell.packages.ghc925.ormolu;
cabal-fmt = fixCyclicReference super.haskell.packages.ghc925.cabal-fmt;
});
self.haskell.packages.ghc925.ormolu = fixCyclicReference super.haskell.packages.ghc925.ormolu;
self.haskell.packages.ghc925.cabal-fmt = fixCyclicReference super.haskell.packages.ghc925.cabal-fmt;
})
];
} /nix/store/3yfs41f4b60jya2gk6xikx4s97zsxjr0-stdenv-linux/setup: line 1578: 487 Killed ./Setup haddock --html --hoogle --quickjump --hyperlink-source
error: builder for '/nix/store/awvc6kdfxlv9l904gjl6kbv56slw6z49-hls-cabal-fmt-plugin-0.1.0.0.drv' failed with exit code 137
error: 1 dependencies of derivation '/nix/store/jc87f5ihxp3l4kx731ypnykdnxznq3m6-haskell-language-server-1.9.0.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ncb3yayx43mwsfvb7wg7q37l5nxhwb3g-haskell-language-server-1.9.0.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9dk674w9pvb9j6fwzm5f25z79jard8kd-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2fv01z15fns1bvh9gc4is4s0rxqfvnxj-nixos-system-nixps-23.05pre452935.724bfc08923.drv' failed to build - system: `"x86_64-linux"`
- host os: `Linux 6.1.10, NixOS, 23.05 (Stoat), 23.05pre452326.fab09085df1`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.13.2`
- channels(root): `"home-manager, nixos"`
- channels(jasonbalaci): `"home-manager"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos` |
@balacij "Killed" in the error message suggests that the kernel killed the build process? Out of memory? By the way, for anyone that uses 🚀 |
Hi @srid, thank you. Yes, it seemingly continuously rebuilds the plugins for |
I revived/reworked the PR to workaround this for 9.2.x releases: #216857 |
The main change here is enabling the separate `bin` output for `ormolu`, which is currently necessary to get HLS working on `aarch64-darwin`. See: NixOS/nixpkgs#140774 (comment) Adding in the overlay to fix that entailed some surgery to `ghc.nix` and `flake.nix`, but I tried my best to make it as unintrusive as possible.
The main change here is enabling the separate `bin` output for `ormolu`, which is currently necessary to get HLS working on `aarch64-darwin`. See: NixOS/nixpkgs#140774 (comment) Adding in the overlay to fix that entailed some surgery to `ghc.nix` and `flake.nix`, but I tried my best to make it as unintrusive as possible.
The main change here is enabling the separate `bin` output for `ormolu`, which is currently necessary to get HLS working on `aarch64-darwin`. See: NixOS/nixpkgs#140774 (comment) Adding in the overlay to fix that entailed some surgery to `ghc.nix` and `flake.nix`, but I tried my best to make it as unintrusive as possible.
commit a9d9ac2 Merge: 80f2ab3 c686098 Author: Gabriella Gonzalez <gabriella@mercury.com> Date: Tue Feb 21 16:36:19 2023 -0800 Merge branch 'master' into gabriella/fix_build commit 80f2ab3 Author: Gabriella Gonzalez <gabriella@mercury.com> Date: Fri Feb 10 10:29:37 2023 -0800 Fix hash commit 46dc419 Merge: 2d2b8e8 84e4f9c Author: Gabriella Gonzalez <gabriella@mercury.com> Date: Fri Feb 10 10:04:33 2023 -0800 Merge branch 'master' into gabriella/fix_build commit 2d2b8e8 Author: Gabriella Gonzalez <gabriella@mercury.com> Date: Thu Feb 2 12:50:40 2023 -0800 Fix build failures on `aarch64-darwin` The main change here is enabling the separate `bin` output for `ormolu`, which is currently necessary to get HLS working on `aarch64-darwin`. See: NixOS/nixpkgs#140774 (comment) Adding in the overlay to fix that entailed some surgery to `ghc.nix` and `flake.nix`, but I tried my best to make it as unintrusive as possible.
The main change here is enabling the separate `bin` output for `ormolu`, which is currently necessary to get HLS working on `aarch64-darwin`. See: NixOS/nixpkgs#140774 (comment) Adding in the overlay to fix that entailed some surgery to `ghc.nix` and `flake.nix`, but I tried my best to make it as unintrusive as possible.
The main change here is enabling the separate `bin` output for `ormolu`, which is currently necessary to get HLS working on `aarch64-darwin`. See: NixOS/nixpkgs#140774 (comment) Adding in the overlay to fix that entailed some surgery to `ghc.nix` and `flake.nix`, but I tried my best to make it as unintrusive as possible.
The main change here is enabling the separate `bin` output for `ormolu`, which is currently necessary to get HLS working on `aarch64-darwin`. See: NixOS/nixpkgs#140774 (comment) Adding in the overlay to fix that entailed some surgery to `ghc.nix` and `flake.nix`, but I tried my best to make it as unintrusive as possible.
@matthewess Does this fix also work on |
@shinzui I haven't tested it myself, you could check out my PR and try applying the patch to the appropriate |
🎉 |
This ports our infamous patch for `Cabal` which cheesily prevents an output cycle for derivations that use separate bin outputs where references caused by the `Paths_*` module can't be eliminated by the GHC aarch64-darwin codegen backend. See also - the original issue NixOS#140774, - the original patch for GHC 9.2 NixOS#216857 - the ported patch for GHC 9.4 NixOS@f6f780f Co-authored-by: sternenseemann <sternenseemann@systemli.org>
This ports our infamous patch for `Cabal` which cheesily prevents an output cycle for derivations that use separate bin outputs where references caused by the `Paths_*` module can't be eliminated by the GHC aarch64-darwin codegen backend. See also - the original issue #140774, - the original patch for GHC 9.2 #216857 - the ported patch for GHC 9.4 f6f780f Co-authored-by: sternenseemann <sternenseemann@systemli.org>
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, …
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, … (cherry picked from commit 3885dfe)
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, … (cherry picked from commit 3885dfe)
Describe the bug
niv
fails to build onaarch64-darwin
with the following errors:Recent hydra builds also fail: https://hydra.nixos.org/job/nixpkgs/nixpkgs-unstable-aarch64-darwin/niv.aarch64-darwin
Steps To Reproduce
Steps to reproduce the behavior:
nix-shell -p niv
Expected behavior
niv
should install and be available.Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Maintainer information:
The text was updated successfully, but these errors were encountered: