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

Neither the Haskell package set or the Nixpkgs package set contain the tool: genprimopcode:genprimopcode (build tool dependency). #1809

Closed
ocharles opened this issue Dec 8, 2022 · 14 comments
Labels
bug Something isn't working wontfix

Comments

@ocharles
Copy link
Contributor

ocharles commented Dec 8, 2022

I'm not entirely sure what's pulling this in yet, but this is what I get when I try and upgrade work to 9.4.3.

@ocharles ocharles added the bug Something isn't working label Dec 8, 2022
@angerman
Copy link
Collaborator

angerman commented Dec 9, 2022

I think you might be trying to rebuild one of GHCs packages. We might need to expose genprimops from GHC as well.

@TeofilC
Copy link
Contributor

TeofilC commented Dec 9, 2022

Same as #1808 I think. Try out my workaround

@angerman
Copy link
Collaborator

angerman commented Dec 9, 2022

Ah! We are reinstalling lib:ghc. 😵‍💫🥴

@abarbu
Copy link

abarbu commented Dec 18, 2022

Packages that depend on ghc trigger a rebuild and in turn trigger this bug. Changing the package to depend on ghc-lib fixes this. It's mildly annoying because plugins like ghc-typelits-knownnat depend on ghc.

@abarbu
Copy link

abarbu commented Dec 18, 2022

This is also likely related to the following error when compiling some package:

     error: missing binary operator before token "("
      249 | #if MIN_VERSION_ghc(8,6,0)

MIN_VERSION_ghc_lib works

@dhess
Copy link
Contributor

dhess commented Dec 19, 2022

We're getting the same when trying to bump to 9.4.3, but for alex:

error: Neither the Haskell package set or the Nixpkgs package set contain the tool: alex:alex (build tool dependency).
       If this is a system dependency:
       You may need to augment the system package mapping in haskell.nix so that it can be found.
       If this is a Haskell dependency:
       If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
(use '--show-trace' to show detailed location information)

@abarbu
Copy link

abarbu commented Dec 19, 2022

Once you fix alex and happy by providing them as packages in nix the next problem will be genprimopcode.

The underlying problem is that haskell.nix doesn't put ghc into the packagedb for some reason. This is what is causing all of us to rebuild ghc. It also breaks a whole lot of other things! Like all plugins.

reinstallableLibGhc has something to do with writing out the packagedb. So I disabled it. After some fiddling, it all seems to work correctly.

No other workarounds required, it doesn't rebuild ghc, since it is now in the packagedb. And plugins work!

                modules = [{
                  reinstallableLibGhc = false;
                  nonReinstallablePkgs =
        [ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
          "deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
          "ghc-boot" 
          "ghc" "Win32" "array" "binary" "bytestring" "containers"
          "directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim"
          "hpc"
          "mtl" "parsec" "process" "text" "time" "transformers"
          "unix" "xhtml"
          "ghc-bignum"
          # package ghc-9.4.3 is unusable due to missing dependencies:
          # exceptions-0.10.5 stm-2.5.1.0 terminfo-0.4.1.5
          "stm" "exceptions" "terminfo"
          #
        ];
      }]

I don't know the downside of this setup.

Note that normally those last 3 entries aren't in nonReinstallablePkgs in haskell.nix, but are required.

@angerman
Copy link
Collaborator

angerman commented Dec 20, 2022

Thank you @abarbu for digging into this!

Edit: nonReinstallablePkgs needs to be a closed package set. It specifies which packages are to be taken verbatim from the GHC installation.

The downside is: you can't upgrade any of those packages in the nonReinstallablePkgs set.

@dhess
Copy link
Contributor

dhess commented Dec 20, 2022

We recently removed nonReinstallablePkgs from our derivations because it was no longer necessary. Does this mean it's back for GHC 9.4.3?

@stale
Copy link

stale bot commented Apr 19, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 19, 2023
@dhess
Copy link
Contributor

dhess commented Apr 19, 2023

We are still affected by this, or some variant of it, as we're unable to get HLS to build from tools with GHC 9.4.4.

@stale stale bot removed the wontfix label Apr 19, 2023
@ocharles
Copy link
Contributor Author

@dhess #1809 (comment) worked for me, have you tried that? I haven't tried this on HLS yet (because there are other reasons we can't get to 9.4), but the following worked to get weeder working:

  weeder =
    self.haskell-nix.hackage-tool [
      {
        inherit compiler-nix-name;
        name = "weeder";
        version = "latest";
        cabalProject = ''
          packages: weeder.cabal
          allow-newer: all
        '';
        modules = [
          {
            reinstallableLibGhc = false;
            nonReinstallablePkgs = [
              "rts"
              "ghc-heap"
              "ghc-prim"
              "integer-gmp"
              "integer-simple"
              "base"
              "deepseq"
              "array"
              "ghc-boot-th"
              "pretty"
              "template-haskell"
              "ghcjs-prim"
              "ghcjs-th"
              "ghc-bignum"
              "exceptions"
              "stm"
              "ghc-boot"
              "ghc"
              "Cabal"
              "Win32"
              "array"
              "binary"
              "bytestring"
              "containers"
              "directory"
              "filepath"
              "ghc-boot"
              "ghc-compact"
              "ghc-prim"
              "hpc"
              "mtl"
              "parsec"
              "process"
              "text"
              "time"
              "transformers"
              "unix"
              "xhtml"
              "terminfo"
            ];
          }
        ];
      }
    ];

@dhess
Copy link
Contributor

dhess commented Apr 19, 2023

@ocharles I haven't had the heart to pull out the reinstallableLibGhc trick again after believing that we'd never need it again 😭. But I'll give it a try, thanks for confirming that it works for Weeder.

@stale
Copy link

stale bot commented Aug 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 17, 2023
@stale stale bot closed this as completed Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix
Projects
None yet
Development

No branches or pull requests

5 participants