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

unknown RTS option: -xm20000000 #2656

Closed
paulyoung opened this issue Feb 4, 2024 · 6 comments · Fixed by #2657
Closed

unknown RTS option: -xm20000000 #2656

paulyoung opened this issue Feb 4, 2024 · 6 comments · Fixed by #2657
Labels

Comments

@paulyoung
Copy link

paulyoung commented Feb 4, 2024

If I try to build clash-ghc using Nix, clash-prelude fails in the checkPhase with unknown RTS option: -xm20000000 when trying to run doctests and unittests.

I'm using an M1 Macbook Pro.

If I do the following in nix/overlay.nix the error goes away.

       clash-prelude =
-        hprev.callCabal2nixWithOptions
+        hprev.callCabal2nix
           "clash-prelude"
           ../clash-prelude
-          "--flag workaround-ghc-mmap-crash"
           { };

I've tried to override this using various Nix mechanisms (e.g. override, overrideAttrs, a custom overlay, pkgs.haskell.lib.dontCheck) and while some of these work when building clash-prelude in isolation, it doesn't help when building clash-ghc for some reason that I don't understand.

@paulyoung
Copy link
Author

If I do the following in nix/overlay.nix the error goes away.

I spoke too soon. While the build succeeds, actually trying to use clash results in a runtime error.

nix build .#clash-ghc
./result/bin/clash --help
clash: unknown RTS option: -xm20000000
...

@paulyoung
Copy link
Author

I made an additional change to nix/overlay.nix and unsurprisingly the runtime error is gone.

       clash-ghc =
         let
           unmodified =
-            hprev.callCabal2nixWithOptions
+            hprev.callCabal2nix
               "clash-ghc"
-              ../clash-ghc
-              "--flag workaround-ghc-mmap-crash" {
+              ../clash-ghc {
               inherit (hfinal) clash-lib clash-prelude;
             };
nix build .#clash-ghc
./result/bin/clash --help
Usage:

    clash [command-line-options-and-input-files]

...

@paulyoung
Copy link
Author

I've tried to override this using various Nix mechanisms

To clarify, what I meant here is that I have the flake in this repository as an input to my own flake.

@DigitalBrains1
Copy link
Member

DigitalBrains1 commented Feb 4, 2024

Thanks for the bug report and the steps to work around it!

It would seem the -xm flag is only on x86_64:
https://gitlab.haskell.org/ghc/ghc/-/blob/0df8ce27f1c418fee1ba860f1c6575f66cae2ca7/rts/RtsFlags.c?page=2#L1756

We had not realised this. We'll need to make it such that the flag is only passed on x86_64.

@paulyoung
Copy link
Author

paulyoung commented Feb 4, 2024

Thanks! I’ll probably use a fork in the meantime.

I think Rosetta should also allow people to work around this by doing something like:

let
  supportedSystems = [
    flake-utils.lib.system.aarch64-darwin
    flake-utils.lib.system.x86_64-darwin
  ];
in
  flake-utils.lib.eachSystem supportedSystems (system:
    let
      pkgs = import nixpkgs {
        system:
          if system == flake-utils.lib.system.aarch64-darwin
          then flake-utils.lib.system.x86_64-darwin
          else system;
      };

@rowanG077
Copy link
Member

rowanG077 commented Feb 4, 2024

Should be fixed with #2657. I run aarch64 but didn't use nix flakes so I didn't hit this before.

mergify bot pushed a commit that referenced this issue Feb 4, 2024
Fixes #2656

(cherry picked from commit 22b3a58)

# Conflicts:
#	clash-lib/clash-lib.cabal
#	clash-prelude/clash-prelude.cabal
mergify bot pushed a commit that referenced this issue Feb 4, 2024
DigitalBrains1 pushed a commit that referenced this issue Feb 4, 2024
…#2659)

Fixes #2656

(cherry picked from commit 22b3a58)

Co-authored-by: Rowan Goemans <[email protected]>
martijnbastiaan pushed a commit that referenced this issue Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants