0

I've tried invoking haddock via stack using the following commands:

stack haddock --no-haddock-deps --haddock-internal webservice:lib

stack haddock --haddock-arguments "--odir=/tmp/haddock" --no-haddock-deps --haddock-internal webservice:lib

stack haddock --haddock-arguments "--odir=/tmp/haddock --no-warnings" --no-haddock-deps --haddock-internal webservice:lib

stack haddock --haddock-arguments "--odir=/tmp/haddock --no-warnings --no-print-missing-docs" --no-haddock-deps --haddock-internal webservice:lib

And each time, towards the end of haddock's output I notice the following:

Documentation created:
.stack-work/dist/x86_64-linux/Cabal-2.2.0.1/doc/html/webservice/index.html,
Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3: can't find source for QCTest in
.stack-work/dist/x86_64-linux/Cabal-2.2.0.1/doc/html/webservice/webservice.txt
.stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/webservice-test/webservice-test-tmp,
Preprocessing test suite 'webservice-test' for webservice-0.1.0.0..
test, src


--  While building custom Setup.hs for package webservice-0.1.0.0 using:
      /home/vl/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 haddock --html --hoogle --html-location=../$pkg-$version/ --haddock-option=--hyperlinked-source --internal --haddock-option=--odir=/tmp/haddock --haddock-option=--no-warnings --haddock-option=--no-print-missing-docs --haddock-option=--hoogle --haddock-option=--quickjump
    Process exited with code: ExitFailure 1

The documentation of webservice:lib seems to be have been generated, but still haddock exits with 1, thus completely breaking my CI scripts.

Edit - debugging output:

Command:

stack haddock --haddock-arguments "--odir=/tmp/haddock -v3 --no-haddock-hyperlink-source" --no-haddock-deps --haddock-internal webservice:lib

Output:

Warning: Unable to find a known
         candidate for the Cabal entry
         Keys, but did find: 
         * Keys.hs.sample If you are
         using a custom preprocessor for
         this module with its own file
         extension, consider adding the
         file(s) to your .cabal under
         extra-source-files.
webservice-0.1.0.0: build (lib)
Preprocessing library for webservice-0.1.0.0..
Building library for webservice-0.1.0.0..
ignoring (possibly broken) abi-depends field for packages
webservice-0.1.0.0: haddock
Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3:
'/home/vl/.stack/programs/x86_64-linux/ghc-8.4.3/bin/haddock' exited with an
error:


--  While building custom Setup.hs for package webservice-0.1.0.0 using:
      /home/vl/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 haddock --html --hoogle --html-location=../$pkg-$version/ --haddock-option=--hyperlinked-source --internal --haddock-option=--odir=/tmp/haddock --haddock-option=-v3 --haddock-option=--no-haddock-hyperlink-source
    Process exited with code: ExitFailure 1
Saurabh Nanda
  • 6,373
  • 5
  • 31
  • 60
  • 1
    Looks like Haddock is segfaulting. There's a couple of bugs in the last version of Haddock that might cause this. Is `webservice` a package that is published so I can replicate? – Alec Sep 13 '18 at 03:35
  • @Alec thank you for offering to help. Unfortunately, `webservice` is private/proprietary code and I won't be able to share publicly. Any other debugging information that I can share? – Saurabh Nanda Sep 13 '18 at 06:07
  • I'm not too familiar with `stack`, but there should be some way to tell it to pass `-v3` to the underlying call to Cabal. You'll probably get more output there (so it'll be easier to tell approx when the segfault happened). Also, just a wild guess at the bug you may be hitting: try passing `--no-haddock-hyperlink-source` and see if things succeed... – Alec Sep 13 '18 at 06:21
  • @Alec I've added some debugging output to the question. Does this help in any way? Btw, has the bug (that you're suspecting) been fixed? How do I upgrade haddock? – Saurabh Nanda Sep 13 '18 at 07:14
  • Not quite, I was thinking of `--cabal-verbose` (I do wish stack advertised that option a bit more). The bug I'm thinking of has been fixed. Upgrading your Haddock version isn't quite as easy as it sounds. If you really want to, the simplest way about this is probably to build/install Haddock from source. You'll need to checkout the branch corresponding to the GHC version you are using. Even after that, I'm not sure how to instruct stack to use that `haddock` binary (with `cabal`, you'd use `--with-haddock`)... – Alec Sep 13 '18 at 07:34

0 Answers0