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

The hoogle created by stack hoogle doesn't contain base package #6136

Open
diqye opened this issue Jun 2, 2023 · 9 comments
Open

The hoogle created by stack hoogle doesn't contain base package #6136

diqye opened this issue Jun 2, 2023 · 9 comments

Comments

@diqye
Copy link

diqye commented Jun 2, 2023

My local hoogle doesn't contain the document base package while my versions is as below.

~/p/api-diqye[1]>stack --version                                
Version 2.11.1, Git revision c1167a6abc3f4978ccded5ba0246a57387da0e2f x86_64 hpack-0.35.2
~/p/api-diqye>cat stack.yaml | grep resolver             0.102s (main|✚↑1) 00:07
# A snapshot resolver dictates the compiler version and the set of packages
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
# resolver: lts-16.26
# resolver: 
# resolver: nightly-2021-11-06
resolver: lts-20.13
# Dependency packages to be pulled from upstream that are not in the resolver.
~/p/api-diqye>

After I have generated database by runing stack hoogle setup/rebuild, it seems like as below

image
@mpilgrem
Copy link
Member

mpilgrem commented Jun 3, 2023

@diqye, thanks for reporting. After a little investigation and experimentation, I think stack hoogle -- generate will create a Hoogle database for the (project, platform, source map, ghc version) combination that contains both the local project package(s) AND all of Stackage LTS Haskell (including base), but that results in each .stack-work\hoogle\<platform-source_map-ghc_version> folder containing ~300 MB of Hoogle data.

I've not found a way to generate a Hoogle database that contains only the local project packages and the remote base package, and this 2019 Hoogle issue makes me think that this is, in part, a current upstream limitation with Hoogle: ndmitchell/hoogle#288.

@mpilgrem
Copy link
Member

mpilgrem commented Jun 3, 2023

On further investigation, I think this problem arises because ghc-pkg dump yields (for example, extract):

name:                 base
version:              4.16.4.0
...
haddock-html:         ${pkgroot}/../../docs/html/libraries/base
pkgroot: "C:\\Users\\mikep\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-9.2.7\\lib"

and, in the hoogle package, Input.Cabal.readCabal parses only:

packageDocs = find (not . null) $ ask "haddock-html"

and does not understand the ${pkgroot} syntax.

@mpilgrem
Copy link
Member

mpilgrem commented Jun 4, 2023

If I amend the hoogle package to parse the ${pkgroot} syntax, then Stack works with the revised hoogle executable. I'll raise a pull request at the Hoogle repository.

@mpilgrem
Copy link
Member

mpilgrem commented Jun 4, 2023

It looks to me that there is a related upstream error with GHC: https://gitlab.haskell.org/ghc/ghc/-/issues/23476.

@mpilgrem
Copy link
Member

mpilgrem commented Jun 4, 2023

Step 1, I've raised an issue at the Hoogle repository: ndmitchell/hoogle#404.

EDIT: Step 2, I've raised a pull request that I consider fixes the issue.

@diqye
Copy link
Author

diqye commented Jun 4, 2023

@mpilgrem Thanks your investigation and analysis. Now I want to , downgrading, resolve my problem with stack --resolver lts-16.26 hoogle --rebuild but it doesn't seem support my system

Warning: No hoogle version was found, trying to install the latest version
ghc: panic! (the 'impossible' happened)
  (GHC version 8.8.4 for x86_64-apple-darwin):
	Prelude.chr: bad argument: 2667577347

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug


Error: [S-6374]
       While building simple Setup.hs (scroll up to its section to see the
       error) using:
       /Users/diqye/.stack/programs/x86_64-osx/ghc-8.8.4/bin/ghc-8.8.4 -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.0.1.0 /Users/diqye/.stack/setup-exe-src/setup-6HauvNHV.hs /Users/diqye/.stack/setup-exe-src/setup-shim-6HauvNHV.hs -o /Users/diqye/.stack/setup-exe-cache/x86_64-osx/tmp-Cabal-simple_6HauvNHV_3.0.1.0_ghc-8.8.4

And my system version is

~/p/api-diqye>uname -a                                         (main|?↑1) 22:14
Darwin 192.168.1.7 22.3.0 Darwin Kernel Version 22.3.0: Thu Jan  5 20:49:43 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T8103 arm64

@mpilgrem
Copy link
Member

mpilgrem commented Jun 4, 2023

@diqye, I think you may be encountering this GHC bug: https://gitlab.haskell.org/ghc/ghc/-/issues/19452.

@mpilgrem
Copy link
Member

mpilgrem commented Jun 4, 2023

Returning to the original issue, this also affects Haddock documentation built by Cabal (the library) and, consequently, by Stack. I've raised a Cabal issue: haskell/cabal#9000

@diqye
Copy link
Author

diqye commented Nov 4, 2024

I resolved this issue with

Genereate haddoc

stack hoogle -- generate --local

and run

stack hoogle -- server --local --haddoc=/Users/diqye/.stack/snapshots/aarch64-osx/25d4b28a33395db971897b7591139ba61e4ce6ab903d99f94a62dfe9d99ea72a/9.6.6/doc

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

2 participants