haskell / docker-haskell

MIT License
61 stars 36 forks source link

Haddock can't find link destinations #97

Closed memowe closed 1 year ago

memowe commented 1 year ago

I use the images to build and test my projects continuously, which works fine. However, when trying to invoke cabal haddock, it can't find link destinations for basic internal types like GHC.Types.IO.

I tried to generate a minimal example:

memowe@machine:~$ docker run -ti --entrypoint /bin/sh haskell:9.2.5

# cabal user-config update
Config file path source is default config file.
Config file not found: /root/.cabal/config
Writing default configuration to /root/.cabal/config
Renaming /root/.cabal/config to /root/.cabal/config.backup.
Writing merged config to /root/.cabal/config.

# cabal update
Downloading the latest package list from hackage.haskell.org
Package list of hackage.haskell.org has been updated.
The index-state is set to 2023-01-04T10:31:13Z.

# mkdir /tmp/foo
# cd /tmp/foo   
# cabal init --non-interactive --lib
The name foo is already in use by another package on Hackage.
[Log] Guessing dependencies...
[Log] Using cabal specification: 3.8
[Warning] unknown license type, you must put a copy in LICENSE yourself.
[Log] Creating fresh file CHANGELOG.md...
[Log] Creating fresh directory ./src...
[Log] Creating fresh file src/MyLib.hs...
[Log] Creating fresh file foo.cabal...
[Warning] No synopsis given. You should edit the .cabal file and add one.
[Info] You may want to edit the .cabal file and add a Description field.

# cabal haddock --haddock-hyperlinked-source
Resolving dependencies...
Build profile: -w ghc-9.2.5 -O1
In order, the following will be built (use -v for more details):
 - foo-0.1.0.0 (lib) (first run)
Configuring library for foo-0.1.0.0..
Preprocessing library for foo-0.1.0.0..
Running Haddock on library for foo-0.1.0.0..
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: base-4.16.4.0, ghc-bignum-1.2,
ghc-prim-0.8.0
Warning: --source-* options are ignored when --hyperlinked-source is enabled.
   0% (  0 /  2) in 'MyLib'
  Missing documentation for:
    Module header
    someFunc (src/MyLib.hs:3)
Warning: MyLib: could not find link destinations for:

    - GHC.Types.IO
Documentation created:
/tmp/foo/dist-newstyle/build/x86_64-linux/ghc-9.2.5/foo-0.1.0.0/doc/html/foo/index.html

Am I missing something here? What did I do wrong?

AlistairB commented 1 year ago

Thanks for the report! Nice find. It seems that it was a bit overzealous to remove the GHC docs from /opt/ghc/9.2.5/share. I tested that adding these back resolves this issue.

I'll merge the linked PR, then trigger a release.

memowe commented 1 year ago

That's great, thank you very much! 💪

memowe commented 1 year ago

Confirmed, the fixed image does the trick for me. Looking forward to docker-library/official-images#13834 to be merged. :)

memowe commented 1 year ago

docker-library/official-images#13834 got merged and I got the problem already fixed with the initial example using the official docker hub image. Awesome, thanks!

AlistairB commented 1 year ago

Excellent!