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

Nix fails when Cabal 2.4 wildcard paths feature is used #64173

Closed
mrkkrp opened this issue Jul 2, 2019 · 2 comments
Closed

Nix fails when Cabal 2.4 wildcard paths feature is used #64173

mrkkrp opened this issue Jul 2, 2019 · 2 comments

Comments

@mrkkrp
Copy link
Member

mrkkrp commented Jul 2, 2019

Issue description

Nix fails when Cabal 2.4 wildcard paths feature is used. The feature allows us to use ** in paths when we specify collections of e.g. data files. Instead of respecting that, current nixpgks creates a directory literally called ** and so install phase fails because of that.

Steps to reproduce

Clone this branch of Ormolu:

tweag/ormolu#149

where I try to make use of the feature.

Then just do nix-build.

The failure is also visible in respective Circle CI logs here:

https://circleci.com/gh/tweag/ormolu/535?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-checks-link

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.19.34, NixOS, 19.03.git.f52505f (Koi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3pre6631_e58a7144
  • channels(mark): "nixos-18.09.2337.5d972dd2c94"
  • nixpkgs: /home/mark/nixpkgs

(I don't believe the info has any significance in this case.)

@cdepillabout
Copy link
Member

cdepillabout commented Jul 3, 2019

I took a look at this, but I am having trouble getting the branch you linked to working with just plain cabal.

At the end of the nix-build for Haskell packages, Setup install or Setup copy is called:

installPhase = ''
runHook preInstall
${if !isLibrary then "${setupCommand} install" else ''
${setupCommand} copy

This is what is failing.

However, I couldn't figure out why this would be failing, so I tried to reproduce it with just cabal. Setup install and Setup copy should be relatively similar to just calling cabal install, cabal copy, or cabal new-install.

Each of these commands appears to fail as well.

First, the setup for running cabal:

$ git clone ...
$ cd ormolu/
$ nix-shell

Now try with cabal copy:

$ cabal build
(succeeds...)
$ cabal copy
/home/illabout/.cabal/share/x86_64-linux-ghc-8.6.4/ormolu-0.0.1.0/data/examples/import: copyFile: does not exist (No such file or directory)

Try with cabal install:

$ cabal install
Resolving dependencies...
Starting     ormolu-0.0.1.0
Building     ormolu-0.0.1.0
Failed to install ormolu-0.0.1.0
Build log ( /home/illabout/.cabal/logs/ghc-8.6.4/ormolu-0.0.1.0-FG1czeAr5Q63OC8on7h99e.log ):
cabal: Entering directory '.'
Configuring ormolu-0.0.1.0...
Preprocessing library for ormolu-0.0.1.0..
Building library for ormolu-0.0.1.0..
Preprocessing executable 'ormolu' for ormolu-0.0.1.0..
Building executable 'ormolu' for ormolu-0.0.1.0..
/home/illabout/.cabal/share/x86_64-linux-ghc-8.6.4/ormolu-0.0.1.0/data/examples/import: copyFile: does not exist (No such file or directory)
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
ormolu-0.0.1.0-FG1czeAr5Q63OC8on7h99e failed during the final install step.
The exception was:
ExitFailure 1

Try with cabal new-install:

$ cabal new-build
(succeeds...)
$ cabal new-install exe:ormolu
Resolving dependencies...
Build profile: -w ghc-8.6.4 -O1
In order, the following will be built (use -v for more details):
 - ormolu-0.0.1.0 (lib) (requires build)
 - ormolu-0.0.1.0 (exe:ormolu) (requires build)
Starting     ormolu-0.0.1.0 (lib)
Building     ormolu-0.0.1.0 (lib)
Installing   ormolu-0.0.1.0 (lib)
Warning: Some package(s) failed to build. Try rerunning with -j1 if you can't
see the error.

Failed to build ormolu-0.0.1.0. The failure occurred during the final install
step.
Build log (
/home/illabout/.cabal/logs/ghc-8.6.4/ormolu-0.0.1.0-92a9154ca931fd51a93dff32cdbea6dc0ddb6dbdc5d057c74b04741d826ca4f7.log
):
Configuring library for ormolu-0.0.1.0..
Preprocessing library for ormolu-0.0.1.0..
Building library for ormolu-0.0.1.0..
[ 1 of 33] Compiling Ormolu.Anns      ( src/Ormolu/Anns.hs, dist/build/Ormolu/Anns.o )
[ 2 of 33] Compiling Ormolu.CommentStream ( src/Ormolu/CommentStream.hs, dist/build/Ormolu/CommentStream.o )
[ 3 of 33] Compiling Ormolu.Config    ( src/Ormolu/Config.hs, dist/build/Ormolu/Config.o )
...
[32 of 33] Compiling Ormolu.Diff      ( src/Ormolu/Diff.hs, dist/build/Ormolu/Diff.o )
[33 of 33] Compiling Ormolu           ( src/Ormolu.hs, dist/build/Ormolu.o )
/home/illabout/.cabal/store/ghc-8.6.4/incoming/new-12791/home/illabout/.cabal/store/ghc-8.6.4/ormolu-0.0.1.0-92a9154ca931fd51a93dff32cdbea6dc0ddb6dbdc5d057c74b04741d826ca4f7/share/data/printer: copyFile: does not exist (No such file or directory)
cabal: Failed to build ormolu-0.0.1.0 (which is required by exe:ormolu from
ormolu-0.0.1.0). See the build log above for details.

The cabal documentation suggests that the data-files line in ormolu.cabal should work, so my guess is that this is a cabal bug:

https://cabal.readthedocs.io/en/latest/developing-packages.html#pkg-field-data-files

@mrkkrp
Copy link
Member Author

mrkkrp commented Jul 3, 2019

The corresponding Cabal issue appears to be fixed now.

@mrkkrp mrkkrp closed this as completed Jul 3, 2019
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

2 participants