darcs

Issue 2498 ghc 8 breakage and workaround

Title ghc 8 breakage and workaround
Priority Status resolved
Milestone Resolved in 2.12.0
Superseder Nosy List asr, ilovezfs
Assigned To
Topics

Created on 2016-05-26.08:23:53 by ilovezfs, last changed 2016-09-02.13:11:55 by noreply.

Files
File name Uploaded Type Edit Remove
resolve-issue2498_-workaround-missing-library-specification.dpatch ganesh, 2016-08-30.20:56:41 application/octet-stream
Messages
msg19220 (view) Author: ilovezfs Date: 2016-05-26.08:23:51
Trying to build darcs with GHC 8.0.1 fails with the error

```
Configuring darcs-2.12.0...
clang: warning: -Wl,-headerpad_max_install_names: 'linker' input unused
clang: warning: argument unused during compilation: '-L/usr/local/lib'
clang: warning: argument unused during compilation:
'-L/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries'
checking whether to use -liconv...
dist/dist-sandbox-296ea86f/setup/setup.hs:149:15-41: Irrefutable pattern
failed for pattern Just lib
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
darcs-2.12.0 failed during the configure step. The exception was:
ExitFailure 1
```

To get darcs building under GHC 8.0.1 for Homebrew (we only typically
support the latest GHC), I've needed to add a "cabal.config" file at the
root of the package containing "allow-newer: base", at which point
everything builds as expected.

TAG 2.12.0, OS X 10.11.5, Xcode 7.3.1
msg19221 (view) Author: ganesh Date: 2016-05-28.04:58:51
2.12.0 should already support base 4.9, and your error doesn't actually 
suggest a problem with the base version. Could you double-check with a 
clean build?
msg19223 (view) Author: ilovezfs Date: 2016-05-28.06:49:18
Sure, all the same outcome:
```
iMac-TMP:~ joe$ curl -OL
https://hackage.haskell.org/package/darcs-2.12.0/darcs-2.12.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time 
Current
                                 Dload  Upload   Total   Spent    Left 
Speed
100 1431k  100 1431k    0     0   802k      0  0:00:01  0:00:01 --:--:--
 802k
iMac-TMP:~ joe$ tar xf darcs-2.12.0.tar.gz 
iMac-TMP:~ joe$ cd darcs-2.12.0
iMac-TMP:darcs-2.12.0 joe$ cabal sandbox init
Writing a default package environment file to
/Users/joe/darcs-2.12.0/cabal.sandbox.config
Creating a new sandbox at /Users/joe/darcs-2.12.0/.cabal-sandbox
iMac-TMP:darcs-2.12.0 joe$ cabal update
Downloading the latest package list from hackage.haskell.org
Skipping download: local and remote files match.
iMac-TMP:darcs-2.12.0 joe$ cabal install --only-dependencies
Resolving dependencies...
All the requested packages are already installed:
Use --reinstall if you want to reinstall anyway.
iMac-TMP:darcs-2.12.0 joe$ cabal configure
Resolving dependencies...
[1 of 1] Compiling Main             ( dist/setup/setup.hs,
dist/setup/Main.o )
Linking ./dist/setup/setup ...
Configuring darcs-2.12.0...
checking whether to use -liconv... dist/setup/setup.hs:149:15-41:
Irrefutable pattern failed for pattern Just lib
iMac-TMP:darcs-2.12.0 joe$ cabal build
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
Resolving dependencies...
Configuring darcs-2.12.0...
checking whether to use -liconv... dist/setup/setup.hs:149:15-41:
Irrefutable pattern failed for pattern Just lib
iMac-TMP:darcs-2.12.0 joe$ cabal install
Resolving dependencies...
Notice: installing into a sandbox located at
/Users/joe/darcs-2.12.0/.cabal-sandbox
Configuring darcs-2.12.0...
Failed to install darcs-2.12.0
Build log ( /Users/joe/darcs-2.12.0/.cabal-sandbox/logs/darcs-2.12.0.log ):
cabal: Entering directory '.'
[1 of 1] Compiling Main             (
dist/dist-sandbox-434e74af/setup/setup.hs,
dist/dist-sandbox-434e74af/setup/Main.o )
Linking ./dist/dist-sandbox-434e74af/setup/setup ...
Configuring darcs-2.12.0...
checking whether to use -liconv...
dist/dist-sandbox-434e74af/setup/setup.hs:149:15-41: Irrefutable pattern
failed for pattern Just lib
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
darcs-2.12.0 failed during the configure step. The exception was:
ExitFailure 1
iMac-TMP:darcs-2.12.0 joe$ 
```
msg19236 (view) Author: asr Date: 2016-08-24.17:13:12
I'm getting the same reported error:

$ cabal unpack darcs
$ cd darcs-2.12.0/
$ cabal configure
...
Configuring darcs-2.12.0...
checking whether to use -liconv... dist/setup/setup.hs:149:15-41:
Irrefutable pattern failed for pattern Just lib

Any suggested workaround?
msg19241 (view) Author: ganesh Date: 2016-08-30.20:56:41
The cause of this is still a mystery and it doesn't reproduce for me 
locally.

I've attached a patch that should remove the specific error people 
are seeing and either fix the build or at least allow it to proceed 
further. Please could anyone having this problem give it a go and 
report back? It should apply cleanly to HEAD 
(http://darcs.net/screened) or 2.12 
(http://darcs.net/releases/branch-2.12)

http://irclog.perlgeek.de/darcs/2016-08-30#i_13116437 has some more 
discussion.
Attachments
msg19242 (view) Author: ganesh Date: 2016-08-30.22:23:17
Following some more investigation and discussion on IRC I think I 
know what's going on:

This bit in the cabal file is causing cabal to decide not to build 
the library at all, possibly as a way to get out of having to find a 
viable install plan:

    if (!flag(curl) && !flag(http))
        buildable: False

At present due to issue2505 there isn't an install plan with GHC 8.0 
by default, you need to pass this to cabal configure:

  --allow-newer --constraint='sandi<0.4'

I think that also roughly explains why the original reporter was 
able to solve it with allow-newer base.

I think the fix is probably just to take this section out of the 
cabal file and make curl versus http an either/or selection instead.
msg19243 (view) Author: asr Date: 2016-08-31.03:41:47
I could install darcs using the options

  --allow-newer --constraint='sandi<0.4'

Thanks!
msg19252 (view) Author: noreply Date: 2016-09-02.13:11:53
The following patch sent by Ganesh Sittampalam <ganesh@earth.li> updated issue issue2498 with
status=resolved;resolvedin=2.12.0 HEAD

* resolve issue2498: unconditionally use the Haskell HTTP package 
Ignore-this: 907b6d2ea2dcc72a2aa5a02d89574ccd

The buildable: False line in the library section was causing problems
with GHC 8.0 (https://github.com/haskell/cabal/issues/3742), and
in reality there's no value in being able to turn HTTP off.
History
Date User Action Args
2016-05-26 08:23:53ilovezfscreate
2016-05-28 04:58:55ganeshsetstatus: unknown -> needs-diagnosis/design
messages: + msg19221
2016-05-28 06:49:19ilovezfssetmessages: + msg19223
2016-08-24 17:13:14asrsetmessages: + msg19236
2016-08-24 17:15:39asrsetnosy: + asr
2016-08-30 20:56:42ganeshsetfiles: + resolve-issue2498_-workaround-missing-library-specification.dpatch
messages: + msg19241
2016-08-30 22:23:18ganeshsetmessages: + msg19242
2016-08-31 03:41:49asrsetmessages: + msg19243
2016-09-02 13:11:55noreplysetstatus: needs-diagnosis/design -> resolved
messages: + msg19252
resolvedin: 2.12.0