NicolasT / reedsolomon

Reed-Solomon Erasure Coding in Haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

haddock failure

bergmark opened this issue · comments

I can reproduce this by running stack haddock in the source repo.

Haddocks are therefore disabled on stackage, please send a PR or ping me when this is fixed.

Running Haddock for reedsolomon-0.0.4.1...
Preprocessing library reedsolomon-0.0.4.1...
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: array-0.5.1.1, base-4.9.0.0,
binary-0.8.3.0, bytestring-0.10.8.1, containers-0.5.7.1, deepseq-1.4.2.0,
directory-1.2.6.2, filepath-1.4.1.0, ghc-boot-th-8.0.1, ghc-prim-0.5.0.0,
integer-gmp-1.0.0.1, pretty-1.1.3.3, process-1.4.2.0,
template-haskell-2.11.0.0, time-1.6.0.1, transformers-0.5.2.0, unix-2.7.2.0
haddock: internal error: The Glorious Glasgow Haskell Compilation System, version 8.0.1
/opt/ghc/8.0.1/lib/ghc-8.0.1/settings: openFile: does not exist (No such file or directory)

Now that's interesting... I have no clue why some tool would require access to $GHC_ROOT/lib/ghc-8.0.1/settings, what that file would/should contain, and why it's not there while it's expected to be.

I'll dig into this, though I'd be very surprised this is caused by something specific to reedsolomon: as far as I know the package does nothing fancy specific to Haddock:

$ git grep -i haddock
circle.yml:    - cabal haddock --hyperlink-source
src/Data/ReedSolomon.lhs:> {-# OPTIONS_HADDOCK show-extensions #-}
src/Data/Vector/Generic/Sized.hs:{-# OPTIONS_HADDOCK show-extensions #-}
src/Data/Vector/Storable/ByteString.hs:{-# OPTIONS_HADDOCK show-extensions #-}

As you can see, on CircleCI I do run cabal haddock --hyperlink-source, not using Stack but system-installed GHC, which completes successfully: see the artifacts at https://457-39705040-gh.circle-artifacts.com/0//tmp/circle-artifacts.opF3BYY/index.html

I filed a stack issue for this commercialhaskell/stack#2631

Here's what's going on:

$ strace -ff stack haddock 2>&1 | grep settings
[pid 18809] open("/home/nicolas/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 10
[pid 18821] open("/home/nicolas/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 10
[pid 18857] open("/home/nicolas/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 10
[pid 18876] open("/home/nicolas/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 10
[pid 18876] open("/home/nicolas/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 10
[pid 18880] open("/home/nicolas/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 10
[pid 18889] open("/home/nicolas/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 10
[pid 18901] open("The Glorious Glasgow Haskell Compilation System, version 8.0.1\n/home/nicolas/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings", O_RDONLY|O_NOCTTY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
/home/nicolas/.stack/programs/x86_64-linux/ghc-8.0.1/lib/ghc-8.0.1/settings: openFile: does not exist (No such file or directory)

The package contains a 'wrapper' for GHC to sometimes alter arguments passed to GHC, because there's no sane way to do so through Cabal: build-tools/ghc-wrapper (which is set as the GHC executable in Setup.hs).

Changing this to simply run GHC, then building Haddocks, works:

$ git diff
diff --git a/build-tools/ghc-wrapper b/build-tools/ghc-wrapper
index 7d9553e..5875c87 100755
--- a/build-tools/ghc-wrapper
+++ b/build-tools/ghc-wrapper
@@ -1,5 +1,7 @@
 #!/bin/bash -ue

+exec $@
+
 set -ue

 set +e

Some tool somewhere parses some kind of GHC output to retrieve some file location, then tries to open it, but my wrapper changes the output of GHC slightly (which I didn't expect it to?!). Needs more investigation, but doesn't seem like a Stack (or Stack GHC dist) issue.

Hmpf, my wrapper outputs some stuff on GHC 8 systems, which is not expected of course. This patch fixes this:

diff --git a/build-tools/ghc-wrapper b/build-tools/ghc-wrapper
index 7d9553e..28239a0 100755
--- a/build-tools/ghc-wrapper
+++ b/build-tools/ghc-wrapper
@@ -10,7 +10,7 @@ RC=$?
 set -e

 set +e
-$1 --version | grep 'version 8'
+$1 --version | grep 'version 8' > /dev/null 2>&1
 GHC8=$?
 set -e

I'll need to create a new release. The build on CircleCI succeeded because there GHC 7 is used.

reedsolomon-0.0.4.2 containing a fix has been pushed to Hackage. The CI scripts were adapted to validate Haddock building on supported platforms/build systems as well.