input-output-hk / haskell.nix

Alternative Haskell Infrastructure for Nixpkgs
https://input-output-hk.github.io/haskell.nix
Apache License 2.0
559 stars 238 forks source link

`cabal-3.2.0.0` possibly fails to build; used by GHCJS 8.6 and 8.8 #1377

Closed peterbecich closed 2 years ago

peterbecich commented 2 years ago

I see here that Cabal 3.2.0.0 is used for GHCJS projects when GHC is less than 8.10: https://github.com/input-output-hk/haskell.nix/blob/b5ff7dc103b1eb4c49db0e532820c3f7e6506ff1/lib/ghcjs-project.nix#L39-L54

This demonstrates an error in building Cabal 3.2.0.0: https://github.com/peterbecich/haskell.nix-ghcjs-issue/tree/cabal-3.2.0.0-build-error

nix build -f default.nix
...
error: builder for '/nix/store/6wjgavmacpma7ghkfiihqxd56np122hs-cabal-install-exe-cabal-3.2.0.0.drv' failed with exit code 1;

The specific error is:

Distribution/Client/SetupWrapper.hs:114:1: error:
    Could not find module ‘Distribution.Compat.Process’
    Perhaps you meant
      Distribution.Compat.Lens (from Cabal-3.2.0.0)
      Distribution.Compat.Prelude
      Distribution.Compat.SnocList
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
    |
114 | import Distribution.Compat.Process (createProcess)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Thanks

yorickvP commented 2 years ago

Yeah, hitting this on ghcjs.

hamishmack commented 2 years ago

I think the cabal 3.2 issue has been fixed (I did not see it, but I did start by running nix update haskellNix). There were some other problems with the example though. See https://github.com/peterbecich/haskell.nix-ghcjs-issue/pull/1

peterbecich commented 2 years ago

I believe this remains an issue; demo here: https://github.com/peterbecich/haskell.nix-ghcjs-issue/tree/ghcjs-865

Using GHCJS 8.6.5, Cabal 3.2, and the latest haskell.nix, nix build gives:

% nix build -f default.nix
...
error: builder for '/nix/store/8jc7khkaasn1drrygdshj6vnw7zn0kvn-cabal-install-exe-cabal-3.2.0.0.drv' failed with exit code 1;
       last 10 log lines:
       > [127 of 158] Compiling Distribution.Client.ProjectConfig ( Distribution/Client/ProjectConfig.hs, dist/build/cabal/cabal-tmp/Distribution/Client/ProjectConfig.o )
  ...
       > [152 of 158] Compiling Distribution.Client.BuildReports.Storage ( Distribution/Client/BuildReports/Storage.hs, dist/build/cabal/cabal-tmp/Distribution/Client/BuildReports/Storage.o )
       For full logs, run 'nix log /nix/store/8jc7khkaasn1drrygdshj6vnw7zn0kvn-cabal-install-exe-cabal-3.2.0.0.drv'.
error: 1 dependencies of derivation '/nix/store/dlx2av0m2jhkvja381n862fq6bz2i23b-configured-ghcjs-src.drv' failed to build
(use '--show-trace' to show detailed location information)

nix log /nix/store/8jc7khkaasn1drrygdshj6vnw7zn0kvn-cabal-install-exe-cabal-3.2.0.0.drv:

[121 of 158] Compiling Distribution.Client.SetupWrapper ( Distribution/Client/SetupWrapper.hs, dist/build/cabal/cabal-tmp/Distribut>
Distribution/Client/SetupWrapper.hs:114:1: error:
    Could not find module ‘Distribution.Compat.Process’
    Perhaps you meant
      Distribution.Compat.Lens (from Cabal-3.2.0.0)
      Distribution.Compat.Prelude
      Distribution.Compat.SnocList
    Use -v to see a list of the files searched for.
    |
114 | import Distribution.Compat.Process (createProcess)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[125 of 158] Compiling Distribution.Client.Sandbox.PackageEnvironment ( Distribution/Client/Sandbox/PackageEnvironment.hs, dist/bui>[126 of 158] Compiling Distribution.Client.ProjectConfig.Legacy ( Distribution/Client/ProjectConfig/Legacy.hs, dist/build/cabal/cab>[127 of 158] Compiling Distribution.Client.ProjectConfig ( Distribution/Client/ProjectConfig.hs, dist/build/cabal/cabal-tmp/Distrib>[141 of 158] Compiling Distribution.Client.CmdClean ( Distribution/Client/CmdClean.hs, dist/build/cabal/cabal-tmp/Distribution/Clie>[142 of 158] Compiling Distribution.Client.Outdated ( Distribution/Client/Outdated.hs, dist/build/cabal/cabal-tmp/Distribution/Clie>

And the same result for GHCJS 8.8.4, which also uses Cabal 3.2:

Distribution/Client/SetupWrapper.hs:114:1: error:
    Could not find module ‘Distribution.Compat.Process’
    Perhaps you meant
      Distribution.Compat.Lens (from Cabal-3.2.0.0)
      Distribution.Compat.Prelude
      Distribution.Compat.SnocList
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
    |
114 | import Distribution.Compat.Process (createProcess)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[125 of 158] Compiling Distribution.Client.Sandbox.PackageEnvironment ( Distribution/Client/Sandbox/PackageEnvironment.hs, dist/bui>

It does not appear with GHCJS 8.10.7 and newer, which do not require Cabal 3.2:

% nix build -f default.nix                                                               
...
% 

Thanks

hamishmack commented 2 years ago

Please try again now #1447 is merged.

peterbecich commented 2 years ago

It works; Cabal builds successfully: https://github.com/peterbecich/haskell.nix-ghcjs-issue/commit/6b70abe46d058608f6127bab3312f9ace22cfdd6

Thanks!