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

Failure to start hie when cabal-install is installed #165

Closed
GuillaumeDesforges opened this issue Sep 17, 2019 · 2 comments
Closed

Failure to start hie when cabal-install is installed #165

GuillaumeDesforges opened this issue Sep 17, 2019 · 2 comments

Comments

@GuillaumeDesforges
Copy link

Hello

Stack trace

Child process fails on
/nix/store/a1fgqywyav0dkmk3kkq3hm8219aas6cw-cabal-helper-0.9.0.0/bin/cabal-helper-wrapper "--with-ghc=ghc" "--with-ghc-pkg=ghc-pkg" "--with-cabal=cabal" "v1-style" "/home/arsleust/projects/test-project" "/home/arsleust/projects/test-project/dist" "package-db-stack" "flags" "compiler-version" "ghc-merged-pkg-options" "config-flags" "non-default-config-flags" "ghc-src-options" "ghc-pkg-options" "ghc-lang-options" "ghc-options" "source-dirs" "entrypoints" "needs-build-output"

Setup

I am on NixOS and I use the following setup :

generated.nix : generated by cabal2nix, contains GHC and Haskell packages
                                 | (derivation)
                                \ /
   default.nix : I add custom build tools, especially non-Haskell packages
                                 |
                                \ /
                dev.nix : from which I start VS Code

default.nix

let
  pkgs = import <nixpkgs> {};
  generatedDrv = import ./generated.nix {};
in
  generatedDrv.overrideAttrs (generated: {
    buildInputs = generated.buildInputs ++ [
      ## Put additional packages here
    ];
  })

dev.nix

let
  pkgs = import <nixpkgs> {};
  defaultDrv = import ./default.nix;
  all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
  hie = all-hies.selection { selector = p: { inherit (p) ghc864; }; };
  wrapped-vscode = pkgs.runCommand "${pkgs.vscode.name}" {nativeBuildInputs = [ pkgs.makeWrapper ]; } ''
    mkdir -p $out/bin
    makeWrapper ${pkgs.vscode}/bin/code $out/bin/code --prefix PATH : ${pkgs.lib.makeBinPath [hie]}
  '';
in
  defaultDrv.overrideAttrs (default: {
    buildInputs = default.buildInputs ++ [
      ## Put additional DEV packages here
      pkgs.cabal-install
      pkgs.haskellPackages.hoogle
      wrapped-vscode
    ];
  })

Everything works good if I remove the pkgs.cabal-install above, except the warning that cabal-install is not found (and that I should read README).

Investigation

I tried to run in nix-shell the command:

[nix-shell:~/projects/test-project]$ /nix/store/a1fgqywyav0dkmk3kkq3hm8219aas6cw-cabal-helper-0.9.0.0/bin/cabal-helper-wrapper "--with-ghc=ghc" "--with-ghc-pkg=ghc-pkg" "--with-cabal=cabal" "v1-style" "/home/arsleust/projects/test-project" "/home/arsleust/projects/test-project/dist" "package-db-stack" "flags" "compiler-version" "ghc-merged-pkg-options" "config-flags" "non-default-config-flags" "ghc-src-options" "ghc-pkg-options" "ghc-lang-options" "ghc-options" "source-dirs" "entrypoints" "needs-build-output"
cabal-helper-wrapper: Installing a private copy of Cabal because we couldn't
find the right version in your global/user package-db, this might take a
while but will only happen once per Cabal version you're using.

If anything goes horribly wrong just delete this directory and try again:
    /home/arsleust/.cache/cabal-helper

If you want to avoid this automatic installation altogether install
version 2.4.1.0 of Cabal manually (into your user or global package-db):
    $ cabal install Cabal --constraint "Cabal == 2.4.1.0"

Installing Cabal 2.4.1.0 ...
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
cabal: There is no package named 'Cabal'.
You may need to run 'cabal update' to get the latest list of available
packages.

cabal-helper-wrapper: Installing Cabal version 2.4.1.0 failed.

You have the following choices to fix this:

- The easiest way to try and fix this is just reconfigure the project and try
  again:
        $ cabal clean && cabal configure

- If that fails you can try to install the version of Cabal mentioned above
  into your global/user package-db somehow, you'll probably have to fix
  something otherwise it wouldn't have failed above:
        $ cabal install Cabal --constraint 'Cabal == 2.4.1.0'

- If you're using `Build-Type: Simple`:
  - You can see if you can reinstall your cabal-install executable while
    having it linked to a version of Cabal that's available in you
    package-dbs or can be built automatically:
        $ ghc-pkg list | grep Cabal  # find an available Cabal version
            Cabal-W.X.Y.Z
        $ cabal install cabal-install --constraint 'Cabal == W.X.*'
    Afterwards you'll have to reconfigure your project:
        $ cabal clean && cabal configure

- If you're using `Build-Type: Custom`:
  - Have cabal-install rebuild your Setup.hs executable with a version of the
    Cabal library that you have available in your global/user package-db:
        $ cabal clean && cabal configure
    You might also have to install some version of the Cabal to do this:
        $ cabal install Cabal

This definitly shouldn't make the HIE crash.

My questions are :

  • is the extension crashing, or is it HIE ?
  • should it really crash for this ?
  • could a cabal update fix this ?

I'm a bit new to all this, so I might be completly wrong, ut anyway thanks for your time !

@Ptival
Copy link

Ptival commented Nov 4, 2019

I have pretty much the same error, except, because I have some ambient updated cabal, the error message is slightly different:

/nix/store/dcw6qcawz4cnq8v3yjvnvn0bp6vb73pd-cabal-helper-0.9.0.0/bin/cabal-helper-wrapper "--with-ghc=/nix/store/q4qgr4xd1x7dpmsywn4h52j6vccdwcv6-ghc-8.6.5/bin/ghc" "--with-ghc-pkg=/nix/store/q4qgr4xd1x7dpmsywn4h52j6vccdwcv6-ghc-8.6.5/bin/ghc-pkg" "--with-cabal=cabal" "v1-style" "/Users/val/Galois/projects/saw/saw-script" "/Users/val/Galois/projects/saw/saw-script/.stack-work/dist/x86_64-osx-nix/Cabal-2.4.0.1" "package-db-stack" "flags" "compiler-version" "ghc-merged-pkg-options" "config-flags" "non-default-config-flags" "ghc-src-options" "ghc-pkg-options" "ghc-lang-options" "ghc-options" "source-dirs" "entrypoints" "needs-build-output"
cabal-helper-wrapper: Installing a private copy of Cabal because we couldn't
find the right version in your global/user package-db, this might take a
while but will only happen once per Cabal version you're using.

If anything goes horribly wrong just delete this directory and try again:
    /Users/val/.cache/cabal-helper

If you want to avoid this automatic installation altogether install
version 2.4.1.0 of Cabal manually (into your user or global package-db):
    $ cabal install Cabal --constraint "Cabal == 2.4.1.0"

Installing Cabal 2.4.1.0 ...
Unpacking to Cabal-2.4.1.0/
cabal: Invalid package ID:
/private/var/folders/fr/xkmxc8ld07dgz85nwdn0zx0c0000gn/T/cabal-helper-Cabal-source65368/Cabal-2.4.1.0

cabal-helper-wrapper: Installing Cabal version 2.4.1.0 failed.

Note that my ambient version of Cabal is 3.0.

@jneira
Copy link
Member

jneira commented Jan 9, 2020

@GuillaumeDesforges @Ptival hie not longer uses cabal-helper-wrapper so this one should be fixed, feel free to reopen if it is not the case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants