cabal new-install brittany fails

Created on 11 Jul 2018  路  10Comments  路  Source: haskell/cabal

cabal new-install brittany fails.

command: cabal new-install  brittany
Resolving dependencies...
Build profile: -w ghc-8.4.3 -O1
In order, the following will be built (use -v for more details):
 - brittany-0.11.0.0 (exe:brittany) (requires build)
Configuring executable 'brittany' for brittany-0.11.0.0..
clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
Preprocessing executable 'brittany' for brittany-0.11.0.0..
Building executable 'brittany' for brittany-0.11.0.0..

src-brittany/Main.hs:7:10: error:
     fatal error: 'prelude.inc' file not found
  |
7 | #include "prelude.inc"
  |          ^
#include "prelude.inc"
         ^~~~~~~~~~~~~
1 error generated.
`clang' failed in phase `C pre-processor'. (Exit code: 1)
Symlinking brittany

Very verbose output available in https://gist.github.com/gwils/918a8c5cf169716e9c5c502c0bb7f7f6

I am not sure if this is a problem in brittany or in cabal but @dmwit on #hackage suggested I'd open the issue here anyway because the end result is that a broken symlink is created in ~/.cabal/bin

 ~ ls -l .cabal/bin/brittany
lrwxr-xr-x  1 andrea  staff  56 11 Jul 22:06 .cabal/bin/brittany -> ../store/ghc-8.4.3/brttny-0.11.0.0-bb725428/bin/brittany
 ~ ls -l .cabal/store/ghc-8.4.3/brttny-0.11.0.0-bb725428/bin/brittany
ls: .cabal/store/ghc-8.4.3/brttny-0.11.0.0-bb725428/bin/brittany: No such file or directory

What's worse is that without the -j1 option, the output is

 ~ cabal new-install brittany
Resolving dependencies...
Build profile: -w ghc-8.4.3 -O1
In order, the following will be built (use -v for more details):
 - brittany-0.11.0.0 (exe:brittany) (requires build)
Configuring brittany-0.11.0.0 (exe:brittany)...
Building brittany-0.11.0.0 (exe:brittany)...
Symlinking brittany

with no mention of the error.

 ~ cabal --version
cabal-install version 2.2.0.0
compiled using version 2.2.0.1 of the Cabal library

 ~ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.3

I believe the hackage timestamp is 2018-07-11T10:12:10Z.

nix-local-build bug

Most helpful comment

Can we also get new-build to fail for this bug? It's a bit worrying if things can work in your development/testing environment but then fail for users.

All 10 comments

@typedrat could you check the error handling in new-install while you're at it?

It's not passing the appropriate -I to GHC for the include-dirs. Hmm.

I'm stuck on my phone for the rest of the day so I can't check, does it build with new-build? I can't see a reason that new-install wouldn't work specifically.

@typedrat it does build with new-build, I just double checked.

@typedrat did you see my suspected cause/potential fix? Perhaps new-build lets same-package different-component settings bleed over, but new-install does not? If that is the cause, then really the new-install behaviour is the "correct" one.

That fixes it for me, at least on my branch (where new-install works for local packages).

Can we also get new-build to fail for this bug? It's a bit worrying if things can work in your development/testing environment but then fail for users.

Well, I just realized that the reason I couldn't test it was that my branch wasn't parsing verbose flags right, and well...

cabal: option `-v' is ambiguous; could be one of:
-v --verbose[=n] Control verbosity (n is 0--3, default verbosity level is 1)
-v --verbose[=n] Control verbosity (n is 0--3, default verbosity level is 1)

I don't know if that fix works.

Looks like it still doesn't work, except now it fails silently:

$ cabal new-install brittany
Resolving dependencies...
Build profile: -w ghc-8.4.4 -O1
In order, the following will be built (use -v for more details):
 - brittany-0.11.0.0 (exe:brittany) (requires build)
Starting     brittany-0.11.0.0 (exe:brittany)
Building     brittany-0.11.0.0 (exe:brittany)
Symlinking brittany
$ which brittany
brittany not found
$ ls -la ~/.cabal/bin/brittany
lrwxrwxrwx 1 refold refold 114 nov 20 22:22 /home/refold/.cabal/bin/brittany -> ../store/ghc-8.4.4/brittany-0.11.0.0-0a8c9349d1542d5ec4d9fa7e04ddc306a0d0258588195a4c6ed6da16fb792f41/bin/brittany
$ ls ~/.cabal/store/ghc-8.4.4/brittany-0.11.0.0-76e40c3851b5f7f9fc85c22c6053d9db9be484aae20dc07bcef0955f0b6ac8df/bin
ls: cannot access '/home/refold/.cabal/store/ghc-8.4.4/brittany-0.11.0.0-76e40c3851b5f7f9fc85c22c6053d9db9be484aae20dc07bcef0955f0b6ac8df/bin': No such file or directory
$ ls ~/.cabal/store/ghc-8.4.4/brittany-0.11.0.0-76e40c3851b5f7f9fc85c22c6053d9db9be484aae20dc07bcef0955f0b6ac8df/ 
cabal-hash.txt  lib/  share/

Not sure what's going on here.

It seems to be working now.

[~] cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library
[~] cabal install brittany -w ghc-8.8
Resolving dependencies...
Build profile: -w ghc-8.8.4 -O1
In order, the following will be built (use -v for more details):
 - czipwith-1.0.1.3 (lib) (requires download & build)
 - data-tree-print-0.1.0.2 (lib) (requires download & build)
 - dlist-0.8.0.8 (lib) (requires download & build)
 - extra-1.7.8 (lib) (requires download & build)
 - ghc-paths-0.1.0.12 (lib:ghc-paths) (requires download & build)
 - microlens-0.4.11.2 (lib) (requires download & build)
 - monad-control-1.0.2.3 (lib:monad-control) (requires download & build)
 - monad-memo-0.5.3 (lib) (requires download & build)
 - strict-0.3.2 (lib:strict) (requires download & build)
 - th-abstraction-0.3.2.0 (lib) (requires download & build)
 - uniplate-1.6.13 (lib) (requires download & build)
 - unsafe-0.0 (lib:unsafe) (requires download & build)
 - uuid-types-1.0.3 (lib) (requires build)
 - multistate-0.8.0.3 (lib) (requires download & build)
 - microlens-th-0.4.3.6 (lib) (requires download & build)
 - bifunctors-5.5.7 (lib) (requires download & build)
 - semigroupoids-5.3.4 (lib:semigroupoids) (requires build)
 - profunctors-5.6 (lib) (requires build)
 - assoc-1.0.2 (lib) (requires build)
 - strict-list-0.1.5 (lib) (requires download & build)
 - free-5.1.3 (lib) (requires download & build)
 - these-1.1.1.1 (lib) (requires build)
 - deque-0.4.3 (lib) (requires download & build)
 - ghc-exactprint-0.6.2 (lib) (requires download & build)
 - aeson-1.5.2.0 (lib) (requires download & build)
 - butcher-1.3.3.2 (lib) (requires download & build)
 - yaml-0.11.5.0 (lib) (requires build)
 - brittany-0.12.2.0 (lib) (requires download & build)
 - brittany-0.12.2.0 (exe:brittany) (requires download & build)
---8<---SNIP---8<---
Symlinking 'brittany'
[~] ls -l $(which brittany)
lrwxrwxrwx 1 andrea andrea 114 Nov 17 15:49 /home/andrea/.cabal/bin/brittany -> ../store/ghc-8.8.4/brittany-0.12.2.0-1d311a368c624ea3fbb64d854f2474ffcfeaad9e6a871838363b7f8de2a73e67/bin/brittany
Was this page helpful?
0 / 5 - 0 ratings