Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack haddock failure with GHC 9.2.2 #5694

Closed
j-rockel opened this issue Mar 24, 2022 · 4 comments
Closed

stack haddock failure with GHC 9.2.2 #5694

j-rockel opened this issue Mar 24, 2022 · 4 comments

Comments

@j-rockel
Copy link

General summary/comments

(Not sure this is a stack issue, so do let me know if it sounds like I should be asking this elsewhere!)

I'm trying to bump an existing project to GHC 9.2.2 and it builds fine but the haddock generation fails with

haddock: internal error: /home/jrockel/.stack/snapshots/x86_64-linux-tinfo6/884d4d343f77f5fb965c9e0f9769046bef8d969a1fc518f93e837c8b1418a14c/9.2.2/doc/Diff-0.4.1/doc-index.json: openBinaryFile: does not exist (No such file or directory)

I've played around with removing different dependencies in a test project and there are some rare cases where it doesn't happen (with only text as a dependency for example), but in the majority of cases the same error occurs, sometimes citing a different package as the issue (most of the time it's Diff, but i've seen QuickCheck too for example). These need not be direct dependencies.

Using the same resolver but compiler: ghc-9.2.1 everything works just fine.

Any ideas why this might be happening?

Steps to reproduce

  1. stack new testproj
  2. Set resolver: nightly-2022-03-24 in stack.yaml
  3. Add Diff to the dependencies in package.yaml
  4. Run stack haddock.

Expected

Successfully builds Haddock docs.

Actual

Haddock reports an internal error about the doc-index.json for a dependency (in this case Diff) not existing and fails.

$ stack haddock
Stack has not been tested with GHC versions above 9.0, and using 9.2.2, this may fail
Stack has not been tested with Cabal versions above 3.4, but version 3.6.3.0 was found, this may fail
testproj> configure (lib + exe)
Configuring testproj-0.1.0.0...
testproj> build (lib + exe)
Preprocessing library for testproj-0.1.0.0..
Building library for testproj-0.1.0.0..
[2 of 2] Compiling Lib
Preprocessing executable 'testproj-exe' for testproj-0.1.0.0..
Building executable 'testproj-exe' for testproj-0.1.0.0..
Linking .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.6.3.0/build/testproj-exe/testproj-exe ...
testproj> haddock
Preprocessing library for testproj-0.1.0.0..
Running Haddock on library for testproj-0.1.0.0..
   0% (  0 /  2) in 'Lib'
  Missing documentation for:
    Module header
    someFunc (src/Lib.hs:8)
haddock: internal error: /home/jrockel/.stack/snapshots/x86_64-linux-tinfo6/884d4d343f77f5fb965c9e0f9769046bef8d969a1fc518f93e837c8b1418a14c/9.2.2/doc/Diff-0.4.1/doc-index.json: openBinaryFile: does not exist (No such file or directory)

--  While building package testproj-0.1.0.0 (scroll up to its section to see the error) using:
      /home/jrockel/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_3.6.3.0_ghc-9.2.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.6.3.0 haddock --html --hoogle --html-location=../$pkg-$version/ --haddock-option=--hyperlinked-source --haddock-option=--quickjump
    Process exited with code: ExitFailure 1

Stack version

$ stack --version
Version 2.7.5, Git revision ba147e6f59b2da75b1beb98b1888cce97f7032b1 x86_64 hpack-0.34.4

Method of installation

  • Via GHCup, version 0.1.17.6

For additional context, this is in WSL2 with Ubuntu on a Windows 10 host.

@mpilgrem
Copy link
Member

mpilgrem commented Mar 26, 2022

I have a similar problem with resolver lts-19.0 (GHC 9.0.2) on Windows 11 with dependencies on certain packages (for example basement) but not others. I am using stack --version:

Version 2.7.6, Git revision 80c5860f0698ed8ff41ed3347ade01a7ec9e4d3f (dirty) (8410 commits) RELEASE-CANDIDATE x86_64

For example, for stack new test with basement added as a dependency in package.yaml, stack haddock --haddock-arguments=-odocs yields (extract):

test> configure (lib + exe)
Configuring test-0.1.0.0...
test> build (lib + exe)
Preprocessing library for test-0.1.0.0..
Building library for test-0.1.0.0..
[1 of 2] Compiling Lib
[2 of 2] Compiling Paths_test
Preprocessing executable 'test-exe' for test-0.1.0.0..
Building executable 'test-exe' for test-0.1.0.0..
[1 of 2] Compiling Main [Lib changed]
[2 of 2] Compiling Paths_test
Linking .stack-work\dist\d53b6a14\build\test-exe\test-exe.exe ...
test> haddock
Warning: The documentation for the following packages are not installed. No
Preprocessing library for test-0.1.0.0..
links will be generated to these packages: Win32-2.12.0.1, base-4.15.1.0,
Running Haddock on library for test-0.1.0.0..
filepath-1.4.2.1, ghc-bignum-1.1, ghc-prim-0.7.0
   0% (  0 /  2) in 'Lib'
  Missing documentation for:
    Module header
    someFunc (src\Lib.hs:5)
haddock: internal error: C:\sr\snapshots\8ebdf17c\doc\basement-0.0.14\doc-index.json: openBinaryFile: does not exist (No such file or directory)

--  While building package test-0.1.0.0 (scroll up to its section to see the error) using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.4.1.0_ghc-9.0.2.exe --builddir=.stack-work\dist\d53b6a14 haddock --html --hoogle --html-location=../$pkg-$version/ --haddock-option=--hyperlinked-source --haddock-option=-odocs --haddock-option=--quickjump
    Process exited with code: ExitFailure 1

In case it is relevant, stack exec -- where.exe haddock yields:

C:\Users\mikep\AppData\Local\Programs\stack\x86_64-windows\ghc-9.0.2\bin\haddock.exe
C:\Users\mikep\AppData\Roaming\local\bin\haddock.exe

and stack exec -- haddock --version yields:

Haddock version 2.25.1, (c) Simon Marlow 2006
Ported to use the GHC API by David Waern 2006-2008

However, if I switch to resolver lts-18.28 (GHC 8.10.7) the same code behaves as expected. That is with the Haddock version 2.24.2 that ships with GHC 8.10.7.

@mpilgrem
Copy link
Member

mpilgrem commented Apr 2, 2022

Experimenting further with my own problem (now with resolver lts-19.1 (GHC 9.0.2)): I am using stack new test but with an added dependency to acme-missiles (which also requires an extra-dep). With stack haddock that works fine. A snapshot fe389e9f is created that has doc-index.json among the many documentation files in doc\acme-missiles-0.3.

However, if I delete that snapshot and start again with stack haddock --haddock-arguments=-odocs, the re-created snapshot fe389e9f only has one file in doc\acme-missiles-0.3, being acme-missiles.haddock, and so the creation of haddock documentation fails with:

haddock: internal error: C:\sr\snapshots\fe389e9f\doc\acme-missiles-0.3\doc-index.json: openBinaryFile: does not exist (No such file or directory)

Stack also outputs:

acme-missiles> Documentation created:
acme-missiles> .stack-work\dist\d53b6a14\doc\html\acme-missiles\index.html,
acme-missiles> .stack-work\dist\d53b6a14\doc\html\acme-missiles\acme-missiles.txt

but at the end, the only thing in .stack-work\dist\d53b6a14\doc\html\ is a test folder.

@athas
Copy link

athas commented Apr 18, 2022

I am experiencing the same problem using cabal haddock --haddock-for-hackage, so I do not think it is Stack-specific. It is the --haddock-for-hackage flag that screws it up for me.

@mpilgrem
Copy link
Member

This may be a problem with the Cabal library: see haskell/cabal#8104.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants