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

Haddock for crypto-api-0.13.3 fails to build with Cabal 3.10.1.0 #9060

Open
mrkkrp opened this issue Jun 23, 2023 · 13 comments
Open

Haddock for crypto-api-0.13.3 fails to build with Cabal 3.10.1.0 #9060

mrkkrp opened this issue Jun 23, 2023 · 13 comments
Labels
blocked: upstream cabal-install: cmd/haddock can-workaround There is a (maybe partial) workaround for the issue or missing feature

Comments

@mrkkrp
Copy link

mrkkrp commented Jun 23, 2023

Describe the bug
Haddock for crypto-api-0.13.3 fails to build with Cabal 3.10.1.0. It appears to work with older versions of Cabal, namely with 3.8.1.0.

First observed here:
https://github.com/mrkkrp/req/actions/runs/5349288540/jobs/9700788692?pr=150#step:10:356

To Reproduce

I was able to reproduce by clonning crypto-api and running cabal haddock from the root of the repo (not entirely sure that it is the same failure as on CI (see link above) but it fails as well).

Expected behavior

cabal haddock should succeed and generate Haddocks.

System information

  • Operating system: ubuntu, NixOS
  • cabal, ghc versions:
> cabal --version
cabal-install version 3.10.1.0
compiled using version 3.10.1.0 of the Cabal library
> ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.7
@ffaf1
Copy link
Collaborator

ffaf1 commented Jun 23, 2023

cabal haddock for crypto-api errors with:

haddock: internal error: /home/f/.local/state/cabal/store/ghc-9.2.8/entropy-0.4.1.10-fd9c3ea180d740ecc8140c198284179cb3cf896d39d0ffa0dc35962213abb815/share/doc/html/doc-index.json: openBinaryFile: does not exist (No such file or directory)
Error: cabal: Failed to build documentation for crypto-api-0.13.3.

lsinsg that folder:

doc-index.html  entropy.haddock  haddock-bundle.min.js  index.html  linuwial.css  meta.json  quick-jump.css  synopsis.png  System-Entropy.html

See #8326.

@ffaf1
Copy link
Collaborator

ffaf1 commented Jun 23, 2023

From Haddock #1488, it seems it shold have been fixed and backported in GHC ≥ 9.2.4, so I wonder what is happening.

@mrkkrp
Copy link
Author

mrkkrp commented Jun 23, 2023

Is there a workaround?

@ulysses4ever
Copy link
Collaborator

@mrkkrp there's a delicate relationship between versions inside the ghc-cabal-haddock triad. It appears that the bug disappears on GHC 9.2 + Cabal 3.8 (but you already knew it) and on GHC 9.4+ (including 9.6) + Cabal 3.10.

@ulysses4ever ulysses4ever added blocked: upstream can-workaround There is a (maybe partial) workaround for the issue or missing feature and removed type: regression regression in 3.10 labels Jun 23, 2023
@ulysses4ever
Copy link
Collaborator

@coot you contributed the original fix for this issue I believe. Do you understand why GHC 9.2 with latest patches (e.g. 9.2.8) still suffers from it but only with Cabal 3.10? And more importantly, is there anything we could do (especially on the Cabal end) to make Cabal 3.10.x work with GHC 9.2? As it stands, this issue blocks the recommended badge in ghcup; we almost agreed to put it on the upcoming 3.10.2, but not anymore after we found out that the combination of 3.10 and 9.2 is still broken...

@ulysses4ever
Copy link
Collaborator

I just checked the haddock branches and the ghc-9.2 branch doesn't have the fix from haskell/haddock#1488 ghc-9.4 (and on, i assume) does have it. @ffaf1 where did you get the info about it being

backported in GHC ≥ 9.2.4

? (Btw, thanks a lot for looking up haskell/haddock#1488!)

The only mystery remaining is why Cabal <3.10 works...

@ffaf1
Copy link
Collaborator

ffaf1 commented Jun 24, 2023

backported in GHC ≥ 9.2.4

I don’t know what I was reading, sorry for spreading misinfo.

Depending on GHCup choices, this might be something quite important.

@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Jun 28, 2023

I used GHC 9.2.5 and crypto-api to bisect it down to 6d8adf1

@coot do you think we could do something to work around this issue on Cabal's side so that soon-to-be-released Cabal 3.10.2 could work well with GHC 9.2? Otherwise, people keep bumping into it as 9.2 is very popular.

@ulysses4ever
Copy link
Collaborator

In particular, this change:

     , [ "--quickjump" | isVersion 2 19
-                      , fromFlag . argQuickJump $ args ]
+                      , _ <- flagToList . argQuickJump $ args ]

@ulysses4ever
Copy link
Collaborator

In particular, it looks like that if we change

     , [ "--quickjump" | isVersion 2 19
-                      , _ <- flagToList . argQuickJump $ args ]
+                      , True <- flagToList . argQuickJump $ args ]

just like you did in the --hyperlinked-source option going next, then crypto-api does not fail anymore. Does it sound plausible to you, @coot?

ulysses4ever added a commit that referenced this issue Jun 29, 2023
Fix #9060 and improve #8326, i.e. with GHC < 9.4 `cabal haddock
--enable-doc` works in more situations. #8326 is not fixed because
`cabal haddock --enable-doc --haddock-for-hackage` still fails
and doesn't seem to be fixable without upgrading to a newer
GHC (9.4+) and Haddock.
@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Jun 29, 2023

I submitted a fix as described above: #9072 #9049 beats me to it.

Hopefully, we could squeeze it into 3.10.2.

@ulysses4ever
Copy link
Collaborator

@mrkkrp do you want to check yourself that the bug is fixed on master? We have the cabal-head rolling prerelease with binaries for x64 and the 3 major systems. If you use ghcup, you could get one of the binaries using

ghcup install cabal -u https://github.com/haskell/cabal/releases/download/cabal-head/cabal-head-Linux-x86_64.tar.gz head

(replace Linux with macOS or Windows as appropriate).

@coot
Copy link
Collaborator

coot commented Jul 3, 2023

just like you did in the --hyperlinked-source option going next, then crypto-api does not fail anymore. Does it sound plausible to you, @coot?

Yes it makes sense.

liskin added a commit to xmonad/X11 that referenced this issue Nov 12, 2023
Cabal 3.10.2.0 exposes a bug in Haddock shipped with GHC 9.0 and 9.2, so
we need to work around it by bumping the version of GHC/Haddock we use
for building/uploading docs to Hackage, and to prevent build failures we
don't ever try to build haddocks for Hackage with older versions of
GHC/Haddock.

Related: haskell/haddock#1582 (comment)
Related: haskell/cabal#8326
Related: haskell/cabal#9060
Related: haskell/cabal#9073
Related: haskell/cabal#9049
liskin added a commit to xmonad/X11-xft that referenced this issue Nov 12, 2023
Cabal 3.10.2.0 exposes a bug in Haddock shipped with GHC 9.0 and 9.2, so
we need to work around it by bumping the version of GHC/Haddock we use
for building/uploading docs to Hackage, and to prevent build failures we
don't ever try to build haddocks for Hackage with older versions of
GHC/Haddock.

Related: haskell/haddock#1582 (comment)
Related: haskell/cabal#8326
Related: haskell/cabal#9060
Related: haskell/cabal#9073
Related: haskell/cabal#9049
liskin added a commit to xmonad/xmonad that referenced this issue Nov 12, 2023
Cabal 3.10.2.0 exposes a bug in Haddock shipped with GHC 9.0 and 9.2, so
we need to work around it by bumping the version of GHC/Haddock we use
for building/uploading docs to Hackage, and to prevent build failures we
don't ever try to build haddocks for Hackage with older versions of
GHC/Haddock.

Related: haskell/haddock#1582 (comment)
Related: haskell/cabal#8326
Related: haskell/cabal#9060
Related: haskell/cabal#9073
Related: haskell/cabal#9049
liskin added a commit to xmonad/xmonad-contrib that referenced this issue Nov 12, 2023
Cabal 3.10.2.0 exposes a bug in Haddock shipped with GHC 9.0 and 9.2, so
we need to work around it by bumping the version of GHC/Haddock we use
for building/uploading docs to Hackage, and to prevent build failures we
don't ever try to build haddocks for Hackage with older versions of
GHC/Haddock.

Related: haskell/haddock#1582 (comment)
Related: haskell/cabal#8326
Related: haskell/cabal#9060
Related: haskell/cabal#9073
Related: haskell/cabal#9049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: upstream cabal-install: cmd/haddock can-workaround There is a (maybe partial) workaround for the issue or missing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants