[GHC] #14775: GHC 8.4.1-alpha3 regression: Build error when `build-type: Custom` and `license: OtherLicense` are in the .cabal file

GHC ghc-devs at haskell.org
Wed Feb 7 17:16:13 UTC 2018


#14775: GHC 8.4.1-alpha3 regression: Build error when `build-type: Custom` and
`license: OtherLicense` are in the .cabal file
-------------------------------------+-------------------------------------
        Reporter:  asr               |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.4.1-alpha3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by phadej):

 TL;DR, I don't think this a valid issue. To fix, use up-to-data `cabal-
 install`.
 We have to work on the error reporting though, as I mention below

 ---

 The failure is caused by unfortunately late (it missed by a few hours
 `alpha2`) change
 to `Cabal`, which affects how `ghc-pkg` stores licence field. It will be
 stored as SPDX expression
 in Cabal-2.2 / GHC-8.4

 {{{
 % ghc-pkg-8.4.1 dump | grep license | sort -u
 license: BSD-2-Clause
 license: BSD-3-Clause
 }}}

 Side note: As e.g. Agda is currently `OtherLicense`, please consider
 bumping to
 `cabal-version: 2.2` and using `MIT AND BSD-3-Clause` instead of opaque
 `OtherLicense`. That's one of motivation of using SPDX license expressions
 starting from cabal spec 2.2.

 ---

 There are two things wrong with the premise:

 - There aren't `custom-setup` & `setup-depends`. This causes `cabal-
 install` to apply implicit `Cabal < 2` bound. Then `Setup.hs` is built
 against `Cabal-1.24` which cannot know about GHC-8.4. We will fix that buy
 making old `Cabal` non-compilable against `base-4.11`. It's semantically
 incorrect (as they compile fine, they just don't know about GHC-8.4).
     - It was an oversight to allow `Cabal-1.24` to work with GHC-8.2. But
 that ship has sailed.

 - Similarly, as `cabal-install-2.0` uses `Cabal-2.0` (as version shows),
 that old `Cabal` lib version isn't compatible with GHC-8.4
     - It's on the task list to make `Cabal` (and thus `cabal-install`) to
 refuse to work with GHCs it doesn't know about. We cannot predict the
 future.

 To illustrate, I try a dry build with package as reported:

 {{{
 % /opt/cabal/2.0/bin/cabal new-build  --dry
 Resolving dependencies...
 In order, the following would be built (use -v for more details):
  - Foo-0.1.0.0 (lib:Foo) (first run)

 % cabal-plan topo
 Foo-0.1.0.0 lib setup
 transformers-0.5.2.0
 template-haskell-2.12.0.0
 ghc-boot-th-8.2.2
 old-time-1.1.0.3
 old-locale-1.0.0.7
 Cabal-1.24.2.0 <-- !!!
 process-1.4.3.0
 pretty-1.1.3.3
 directory-1.3.0.2
 unix-2.7.2.2
 time-1.8.0.2
 filepath-1.4.1.2
 binary-0.8.5.1
 containers-0.5.10.2
 bytestring-0.10.8.2
 deepseq-1.4.3.0
 array-0.5.2.0
 base-4.10.1.0
 integer-gmp-1.0.1.0
 ghc-prim-0.5.1.1
 rts-1.0
 }}}

 Note: `Cabal-1.24.2.0` is built!

 If I actually try to build with GHC-8.4.1 alpha, I have to allow-newer

 {{{
 % /opt/cabal/2.0/bin/cabal new-build -w ghc-8.4.1 --allow-newer='Cabal'
 --dry
 Resolving dependencies...
 In order, the following would be built (use -v for more details):
  - old-time-1.1.0.3 (lib) (requires build)
  - Foo-0.1.0.0 (lib:Foo) (first run)

 % cabal-plan topo
 Foo-0.1.0.0 lib setup
 template-haskell-2.13.0.0
 ghc-boot-th-8.4.0.20180204
 old-time-1.1.0.3
 old-locale-1.0.0.7
 Cabal-2.1.0.0
 process-1.6.3.0
 pretty-1.1.3.6
 parsec-3.1.12
 text-1.2.3.0
 mtl-2.2.2
 transformers-0.5.5.0
 directory-1.3.1.5
 unix-2.7.2.2
 time-1.8.0.2
 filepath-1.4.2
 binary-0.8.5.1
 containers-0.5.11.0
 bytestring-0.10.8.2
 deepseq-1.4.3.0
 array-0.5.2.0
 base-4.11.0.0
 integer-gmp-1.0.1.0
 ghc-prim-0.5.2.0
 rts-1.0
 }}}

 But still, there's old `Cabal` in `cabal-install-2.0` so build will fail,
 as reported.
 With `new-build` a bit differently:

 {{{
 % /opt/cabal/2.0/bin/cabal new-build -w ghc-8.4.1 --allow-newer='Cabal'

 Resolving dependencies...
 In order, the following will be built (use -v for more details):
  - old-time-1.1.0.3 (lib) (requires build)
  - Foo-0.1.0.0 (lib:Foo) (first run)
 Configuring old-time-1.1.0.3 (lib)...

 Failed to build old-time-1.1.0.3. The failure occurred during the
 configure
 step.
 Build log (
 /home/ogre/.cabal/logs/ghc-8.4.0.20180204/old-
 time-1.1.0.3-327228ceac90b6d4a229ac30aefee4aa0a193769fd1eeeece7e4a5f18f88fe98.log
 ):
 Configuring library for old-time-1.1.0.3..
 cabal: failed to parse output of 'ghc-pkg dump'
 cabal: Failed to build old-time-1.1.0.3 (which is required by
 Foo-0.1.0.0).
 See the build log above for details.
 }}}

 However if we use `cabal-install-head` (which will become 2.2 soon-ish):

 {{{
 % /opt/cabal/head/bin/cabal new-build -w ghc-8.4.1 --allow-newer='Cabal'
 }}}

 is ok.

 Also if we add proper `custom-setup` we won't need `--allow-newer`:

 {{{
 % git diff
 diff --git a/Foo.cabal b/Foo.cabal
 index e4fb0c2..587ccd4 100644
 --- a/Foo.cabal
 +++ b/Foo.cabal
 @@ -4,6 +4,9 @@ license:             OtherLicense
  build-type:          Custom
  cabal-version:       >=1.10

 +custom-setup
 +  setup-depends: Cabal >= 1.10 && <2.3, base
 +
  library
    exposed-modules:     Foo
    build-depends:       base

 % /opt/cabal/head/bin/cabal new-build -w ghc-8.4.1
 Build profile: -w ghc-8.4.0.20180204 -O1
 In order, the following will be built (use -v for more details):
  - Foo-0.1.0.0 (lib:Foo) (first run)
 Preprocessing library for Foo-0.1.0.0..
 Building library for Foo-0.1.0.0..
 }}}

 And finally, using sandboxes and `cabal-install-head` build works too:

 {{{
 % /opt/cabal/head/bin/cabal sandbox init
 Writing a default package environment file to
 /home/ogre/mess/issue-14475/cabal.sandbox.config
 Creating a new sandbox at /home/ogre/mess/issue-14475/.cabal-sandbox

 % /opt/cabal/head/bin/cabal install
 Resolving dependencies...
 Notice: installing into a sandbox located at
 /home/ogre/mess/issue-14475/.cabal-sandbox
 Configuring Foo-0.1.0.0...
 Building Foo-0.1.0.0...
 Installed Foo-0.1.0.0
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14775#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list