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

#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 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I'm getting the following error when `build-type: Custom` and `license: OtherLicense` are in the .cabal file: `Foo.cabal`: {{{ name: Foo version: 0.1.0.0 license: OtherLicense build-type: Custom cabal-version: >=1.10 library exposed-modules: Foo build-depends: base default-language: Haskell2010 }}} `Foo.hs`: {{{#!hs module Foo where foo :: Int -> Int foo n = n }}} `Setup.hs`: {{{#!hs import Distribution.Simple main = defaultMain }}} The error: {{{ $ cabal install Failed to install Foo-0.1.0.0 cabal: Error: some packages failed to install: Foo-0.1.0.0-33ReQaKfqaD7MoDL7J5kFM failed during the final install step. The exception was: dieVerbatim: user error (cabal: Couldn't parse the output of 'setup register --gen-pkg-config':NoParse "license" 5 ) }}} `cabal-install` version: {{{ $ cabal --version cabal-install version 2.0.0.1 compiled using version 2.0.1.0 of the Cabal library }}} If I change the `license` field ''or'' the `build` field, the error disappeared. I didn't get the above error using GHC 8.4.1-alpha2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14775 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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

#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: | -------------------------------------+------------------------------------- Description changed by asr: Old description:
I'm getting the following error when `build-type: Custom` and `license: OtherLicense` are in the .cabal file:
`Foo.cabal`: {{{ name: Foo version: 0.1.0.0 license: OtherLicense build-type: Custom cabal-version: >=1.10
library exposed-modules: Foo build-depends: base default-language: Haskell2010 }}}
`Foo.hs`: {{{#!hs module Foo where
foo :: Int -> Int foo n = n }}}
`Setup.hs`: {{{#!hs import Distribution.Simple main = defaultMain }}}
The error: {{{ $ cabal install Failed to install Foo-0.1.0.0 cabal: Error: some packages failed to install: Foo-0.1.0.0-33ReQaKfqaD7MoDL7J5kFM failed during the final install step. The exception was: dieVerbatim: user error (cabal: Couldn't parse the output of 'setup register --gen-pkg-config':NoParse "license" 5 ) }}}
`cabal-install` version: {{{ $ cabal --version cabal-install version 2.0.0.1 compiled using version 2.0.1.0 of the Cabal library }}}
If I change the `license` field ''or'' the `build` field, the error disappeared. I didn't get the above error using GHC 8.4.1-alpha2.
New description: I got an error installing Agda upstream. I could reduce the error when `build-type: Custom` and `license: OtherLicense` are in the .cabal file: `Foo.cabal`: {{{ name: Foo version: 0.1.0.0 license: OtherLicense build-type: Custom cabal-version: >=1.10 library exposed-modules: Foo build-depends: base default-language: Haskell2010 }}} `Foo.hs`: {{{#!hs module Foo where foo :: Int -> Int foo n = n }}} `Setup.hs`: {{{#!hs import Distribution.Simple main = defaultMain }}} The error: {{{ $ cabal install Failed to install Foo-0.1.0.0 cabal: Error: some packages failed to install: Foo-0.1.0.0-33ReQaKfqaD7MoDL7J5kFM failed during the final install step. The exception was: dieVerbatim: user error (cabal: Couldn't parse the output of 'setup register --gen-pkg-config':NoParse "license" 5 ) }}} `cabal-install` version: {{{ $ cabal --version cabal-install version 2.0.0.1 compiled using version 2.0.1.0 of the Cabal library }}} If I change the `license` field ''or'' the `build` field, the error disappeared. I didn't get the above error using GHC 8.4.1-alpha2. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14775#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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 asr): Replying to [comment:1 phadej]:
TL;DR, I don't think this a valid issue. To fix, use up-to-data `cabal- install`.
@phadej, thank you for a very informative answer. The oldest `GHC` version currently supported by Agda is `7.10.*`. If I understand correctly, the proposed fixes require at least `Cabal >= 1.24`. Is there a fix which also work with the `Cabal` version (i.e. `Cabal 1.22.*`) shipped with `GHC 7.10.3`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14775#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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 bgamari): phadej, any update here? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14775#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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 asr): As it was expected, I got the same issue with GHC 8.4.1. I'm waiting for a new release of `cabal-install` to see its behaviour on this situation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14775#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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 asr): Replying to [comment:3 asr]:
If I understand correctly, the proposed fixes require at least `Cabal >= 1.24`. Is there a fix which also work with the `Cabal` version (i.e. `Cabal 1.22.*`) shipped with `GHC 7.10.3`?
I realise that oldest versions of Cabal just ignore the `custom setup` stance, so please ignore my question. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14775#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: closed Priority: normal | Milestone: Component: Compiler | Version: 8.4.1-alpha3 Resolution: fixed | 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: | -------------------------------------+------------------------------------- Changes (by asr): * status: new => closed * resolution: => fixed Comment: The issue in the OP was fixed in `cabal-install` upstream (tested in the 2.2 branch on [https://github.com/haskell/cabal/commit/74781c78492590b85e21b13ff8675c6e5875... this] commit), so I'm closing it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14775#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC