hoogle commands don't work in lts-15 even from a fresh project
$ stack new testhoogle
$ cd testhoogle
$ stack haddock
$ stack hoogle --setup --verbose
Version 2.1.3.1 x86_64 hpack-0.31.2
2020-03-17 09:12:38.832822: [debug] Checking for project config at: /Users/davidspies/testhoogle/stack.yaml
2020-03-17 09:12:38.833261: [debug] Loading project config file stack.yaml
2020-03-17 09:12:38.837065: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-03-16 16:12:38.837019 UTC]
2020-03-17 09:12:38.837432: [debug] Using package location completions from a lock file
2020-03-17 09:12:38.958762: [debug] Running hpack on /Users/davidspies/testhoogle/package.yaml
2020-03-17 09:12:38.961305: [debug] hpack output unchanged in /Users/davidspies/testhoogle/testhoogle.cabal
2020-03-17 09:12:38.963102: [warn] Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
2020-03-17 09:12:38.963436: [debug] Installed tools:
- ghc-8.6.4
- ghc-8.6.5
- ghc-8.8.3
- ghc-8.2.2
- ghc-8.8.2
- ghc-8.4.4
2020-03-17 09:12:38.963793: [debug] Potential GHC builds: standard
2020-03-17 09:12:38.963841: [debug] Found already installed GHC builds: standard
2020-03-17 09:12:38.964057: [debug] SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_path","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","global_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "/Users/davidspies/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-8.8.3"]
2020-03-17 09:12:39.009270: [debug] Loaded compiler information from cache
2020-03-17 09:12:39.009382: [warn] Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
2020-03-17 09:12:39.010325: [debug] Resolving package entries
2020-03-17 09:12:39.010384: [debug] Parsing the targets
2020-03-17 09:12:39.012419: [debug] Checking flags
2020-03-17 09:12:39.012460: [debug] SourceMap constructed
2020-03-17 09:12:39.016555: [debug] Starting to execute command inside EnvConfig
2020-03-17 09:12:39.016907: [debug] Run process: /Users/davidspies/.local/bin/hoogle --numeric-version
2020-03-17 09:12:39.073053: [debug] Process finished in 56ms: /Users/davidspies/.local/bin/hoogle --numeric-version
2020-03-17 09:12:39.073312: [warn] No Hoogle database yet. Automatically building haddocks and hoogle database (use --no-setup to disable) ...
2020-03-17 09:12:39.073415: [debug] Using package location completions from a lock file
2020-03-17 09:12:39.194543: [warn] Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
2020-03-17 09:12:39.194927: [debug] Installed tools:
- ghc-8.6.4
- ghc-8.6.5
- ghc-8.8.3
- ghc-8.2.2
- ghc-8.8.2
- ghc-8.4.4
2020-03-17 09:12:39.195053: [debug] Potential GHC builds: standard
2020-03-17 09:12:39.195083: [debug] Found already installed GHC builds: standard
2020-03-17 09:12:39.195247: [debug] SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_path","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","global_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "/Users/davidspies/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-8.8.3"]
2020-03-17 09:12:39.238072: [debug] Loaded compiler information from cache
2020-03-17 09:12:39.238194: [warn] Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
2020-03-17 09:12:39.238598: [debug] Resolving package entries
2020-03-17 09:12:39.238647: [debug] Parsing the targets
2020-03-17 09:12:39.241027: [debug] Checking flags
2020-03-17 09:12:39.241065: [debug] SourceMap constructed
2020-03-17 09:12:39.244908: [debug] Starting to execute command inside EnvConfig
2020-03-17 09:12:39.246324: [debug] Finding out which packages are already installed
2020-03-17 09:12:39.246695: [debug] Run process: /Users/davidspies/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-pkg-8.8.3 --global --no-user-package-db dump --expand-pkgroot
2020-03-17 09:12:39.309817: [debug] Process finished in 63ms: /Users/davidspies/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-pkg-8.8.3 --global --no-user-package-db dump --expand-pkgroot
2020-03-17 09:12:39.313579: [debug] Run process: /Users/davidspies/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-pkg-8.8.3 --user --no-user-package-db --package-db /Users/davidspies/.stack/snapshots/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/pkgdb dump --expand-pkgroot
2020-03-17 09:12:39.361199: [debug] Process finished in 48ms: /Users/davidspies/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-pkg-8.8.3 --user --no-user-package-db --package-db /Users/davidspies/.stack/snapshots/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/pkgdb dump --expand-pkgroot
2020-03-17 09:12:39.361459: [debug] Run process: /Users/davidspies/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-pkg-8.8.3 --user --no-user-package-db --package-db /Users/davidspies/testhoogle/.stack-work/install/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/pkgdb dump --expand-pkgroot
2020-03-17 09:12:39.411755: [debug] Process finished in 50ms: /Users/davidspies/.stack/programs/x86_64-osx/ghc-8.8.3/bin/ghc-pkg-8.8.3 --user --no-user-package-db --package-db /Users/davidspies/testhoogle/.stack-work/install/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/pkgdb dump --expand-pkgroot
2020-03-17 09:12:39.412270: [debug] Constructing the build plan
2020-03-17 09:12:39.413511: [debug] SELECT "id","directory","type","pkg_src","active","path_env_var","haddock" FROM "config_cache" WHERE "directory"=? AND "type"=?; [PersistText "/Users/davidspies/testhoogle/.stack-work/install/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/",PersistText "lib:testhoogle-0.1.0.0-AQ7NVcG0mkmClBnn1oJWKz"]
2020-03-17 09:12:39.413920: [debug] SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 2]
2020-03-17 09:12:39.414155: [debug] SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_no_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 2]
2020-03-17 09:12:39.414300: [debug] SELECT "id", "config_cache_id", "ghc_pkg_id" FROM "config_cache_dep" WHERE ("config_cache_id"=?); [PersistInt64 2]
2020-03-17 09:12:39.414489: [debug] SELECT "id", "config_cache_id", "component" FROM "config_cache_component" WHERE ("config_cache_id"=?); [PersistInt64 2]
2020-03-17 09:12:39.416146: [debug] Start: getPackageFiles /Users/davidspies/testhoogle/testhoogle.cabal
2020-03-17 09:12:39.418104: [debug] Finished in 2ms: getPackageFiles /Users/davidspies/testhoogle/testhoogle.cabal
2020-03-17 09:12:39.419172: [debug] Checking if we are going to build multiple executables with the same name
2020-03-17 09:12:39.419249: [debug] Executing the build plan
2020-03-17 09:12:39.420453: [info] Haddock index for local packages already up to date at:
/Users/davidspies/testhoogle/.stack-work/install/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/doc/index.html
2020-03-17 09:12:39.421161: [info] Haddock index for local packages and dependencies already up to date at:
/Users/davidspies/testhoogle/.stack-work/install/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/doc/all/index.html
2020-03-17 09:12:39.424789: [info] Haddock index for snapshot packages already up to date at:
/Users/davidspies/.stack/snapshots/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/doc/index.html
2020-03-17 09:12:39.425142: [info] Built docs.
2020-03-17 09:12:39.425588: [debug] Run process: /Users/davidspies/.local/bin/hoogle generate --local --database=/Users/davidspies/testhoogle/.stack-work/hoogle/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/database.hoo
Starting generate
Reading ghc-pkg... 0.09s
Packages missing documentation: array base binary bytestring Cabal containers deepseq directory filepath ghc ghc-boot ghc-boot-th ghc-compact ghc-heap ghc-prim ghci haskeline hpc integer-gmp libiserv mtl parsec pretty process stm template-haskell terminfo testhoogle text time transformers unix xhtml rts
No packages were found, aborting (use no arguments to index all of Stackage)
2020-03-17 09:12:39.575777: [error] Received ExitFailure 1 when running
Raw command: /Users/davidspies/.local/bin/hoogle generate --local --database=/Users/davidspies/testhoogle/.stack-work/hoogle/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/database.hoo
$ stack --version
Version 2.1.3.1 x86_64 hpack-0.31.2
stack upgradeHello, thanks for the report. Would you please update the log with one produced using --verbose?
Done
Thanks. It looks like it is hoogle that is failing — it may be being passed the wrong arguments. What version are you using?
stack --verbose exec -- hoogle --version
I would imagine the following produces the same, failed output:
stack --verbose exec -- hoogle generate --local --database=$(stack path)/database.hoo
It might be clear from the hoogle changelog what is going on.
$ stack install hoogle
$ stack exec hoogle -- --version
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Hoogle 5.0.17.15, https://hoogle.haskell.org/
I copy-pasted the command that failed and wrapped it in stack exec:
$ stack exec -- /Users/davidspies/.local/bin/hoogle generate --local --database=/Users/davidspies/testhoogle/.stack-work/hoogle/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/database.hoo
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Starting generate
Reading ghc-pkg... 0.07s
Packages missing documentation: array base binary bytestring Cabal containers deepseq directory filepath ghc ghc-boot ghc-boot-th ghc-compact ghc-heap ghc-prim ghci haskeline hpc integer-gmp libiserv mtl parsec pretty process stm template-haskell terminfo text time transformers unix xhtml rts
No packages were found, aborting (use no arguments to index all of Stackage)
Same error
However, when I _don't_ wrap it in stack exec
$ /Users/davidspies/.local/bin/hoogle generate --local --database=/Users/davidspies/testhoogle/.stack-work/hoogle/x86_64-osx/f5a6c2ecaea5767a8268d6af4b93a0008e867891b1d58dc88ea8b85370eaa0e3/8.8.3/database.hoo
Starting generate
Reading ghc-pkg... 0.19s
[5/28] bytestring... 0.07s
[10/28] ghc... 1.77s
[27/28] xhtml... 0.04s
Packages missing documentation: rts
Found 49 warnings when processing items
Reordering items... 0.01s
Writing tags... 0.10s
Writing names... 0.05s
Writing types... 0.41s
Took 4.74s
It works
@dspies-leapyear could you try running master version of Stack? A couple of months ago I did some Hoogle-related fixes , they could be a problem (unfortunately I didn't have time yet to look deeper into this issue yet)
Also do you have anything ghc-related in your ~/.stack/config.yaml?
Tried master version of Stack.
Same result
I have nothing in my ~/.stack/config.yaml
So I tried nuking everything everywhere
rm -r .stack
rm -r .hoogle
rm -r .cabal
rm -r .ghc
rm -r .local/bin/*
And then re-installing stack and running stack upgrade
and now I try the thing and it _builds_ hoogle, but then get the error:
Couldn't find hoogle in path after installing. This shouldn't happen, may be a bug.
Hangup: 1
I have to explicitly run stack install hoogle
After which I get the same error I got before
What version of hoogle are _you_ running?
@dbaynard Pinging on this again. I'm curious what your setup is to see if I can replicate it as a workaround for now
Have been having the same problem for a few months now.
I just went through the process of deleting ~/.stack/ and rebuilding everything. Had an empty ./stack-work, a freshly installed hoogle (latest on Hackage), and I still can't get any variants of stack hoogle --server, stack hoogle --rebuild or stack hoogle --setup to succeed.
Same error with Stack 2.3.1. Cleaned everything.
Found a workaround:
the key is to use
--local=<haddock-dir>instead of--local
cymp:localdoc cyue$ stack hoogle --rebuild
No hoogle version was found, trying to install the latest version
Minimum version is hoogle-5.0. Found acceptable hoogle-5.0.17.15 in your index, requiring its installation.
Rebuilding database ...
Haddock index for local packages and dependencies already up to date at:
/fw/Wander/Haskell/localdoc/.stack-work/install/x86_64-osx/d8fc80d492dbccc03f7819e69e02743a1433ab59849868e540e0d5de125456e0/8.8.3/doc/all/index.html
Haddock index for snapshot packages already up to date at:
/Users/cyue/.stack/snapshots/x86_64-osx/d8fc80d492dbccc03f7819e69e02743a1433ab59849868e540e0d5de125456e0/8.8.3/doc/index.html
Built docs.
Starting generate
Reading ghc-pkg... 0.10s
Packages missing documentation: array async atomic-primops attoparsec base base-orphans base64-bytestring binary blaze-builder bytestring Cabal cabal-doctest call-stack case-insensitive clock containers data-default-class deepseq directory entropy exceptions filepath ghc ghc-boot ghc-boot-th ghc-compact ghc-heap ghc-prim ghci hashable haskeline hpc HUnit integer-gmp integer-logarithms io-streams io-streams-haproxy libiserv lifted-base massiv megaparsec monad-control mtl neat-interpolation network network-uri old-locale parsec parser-combinators pretty primitive process QuickCheck random readable regex-base regex-posix repa scheduler scientific SHA snap-core snap-server splitmix stm streaming-commons template-haskell terminfo text time transformers transformers-base transformers-compat unix unix-compat unliftio-core unordered-containers vector websockets xhtml zlib zlib-bindings bytestring-builder localdoc rts
No packages were found, aborting (use no arguments to index all of Stackage)
Received ExitFailure 1 when running
Raw command: /Users/cyue/.local/bin/hoogle generate --local --database=/fw/Wander/Haskell/localdoc/.stack-work/hoogle/x86_64-osx/d8fc80d492dbccc03f7819e69e02743a1433ab59849868e540e0d5de125456e0/8.8.3/database.hoo
cymp:localdoc cyue$
cymp:localdoc cyue$
cymp:localdoc cyue$ stack exec bash
bash-5.0$
bash-5.0$
bash-5.0$ hoogle generate --local=/fw/Wander/Haskell/localdoc/.stack-work/install/x86_64-osx/d8fc80d492dbccc03f7819e69e02743a1433ab59849868e540e0d5de125456e0/8.8.3/doc --local=/Users/cyue/.stack/snapshots/x86_64-osx/d8fc80d492dbccc03f7819e69e02743a1433ab59849868e540e0d5de125456e0/8.8.3/doc --database=/fw/Wander/Haskell/localdoc/.stack-work/hoogle/x86_64-osx/d8fc80d492dbccc03f7819e69e02743a1433ab59849868e540e0d5de125456e0/8.8.3/database.hoo
Starting generate
[3/82] QuickCheck... 0.11s
[9/82] base... 1.15s
[26/82] ghc... 3.21s
[42/82] massiv... 0.23s
[67/82] template-haskell... 0.22s
[81/82] zlib... 0.04s
[90/82] base... 1.20s
[107/82] ghc-prim... 0.45s
[135/82] snap-core... 0.12s
[151/82] vector... 0.33s
[154/82] zlib-bindings... 0.01s
Found 204 warnings when processing items
Reordering items... 0.04s
Writing tags... 0.28s
Writing names... 0.14s
Writing types... 1.22s
Took 16.50s
bash-5.0$
bash-5.0$
bash-5.0$ exit
exit
cymp:localdoc cyue$
cymp:localdoc cyue$
cymp:localdoc cyue$ stack hoogle --server
No hoogle version was found, trying to install the latest version
Minimum version is hoogle-5.0. Found acceptable hoogle-5.0.17.15 in your index, requiring its installation.
Server started on port 8080
Reading log...0.00s
2020-05-13T16:43:29.220866 - Server starting on port 8080 and host/IP Host "127.0.0.1"
...
stack: Version 2.3.1, Git revision de2a7b694f07de7e6cf17f8c92338c16286b2878 (8103 commits) x86_64 hpack-0.33.0
lts: lts-15.11
I was able to use the workaround posted above to at least get past this bug by cleanly doing the following all in a ubuntu 18.04 container, however it still runs into strange issues toward the end
stack clean
stack haddock
At this point the documentation works, and I can even service on an nginx elsewhere.
Then i try to get hoogle working by doing the following
stack install hoogle
hoogle generate -v --download --local=$(stack path --local-doc-root) --local=$(stack path --snapshot-doc-root) --database=$(stack path --local-hoogle-root)/database.hoo
The generation seems to get past the ExitFailure 1 in this particular bug, however the following serves with really broken links (i have tried many combinations of flags all to the same avail)
hoogle server --local --host "*" --port=12345 --haddock=$(stack path --local-doc-root) --haddock=$(stack path --snapshot-doc-root) --database=$(stack path --local-hoogle-root)/database.hoo
All the links hoogle serves end up being of the form haddockfile:///PATH_TO_SOMEWHERE and the browser has no idea how to serve them.
I'm not sure this is the right place to reply with all this, but I imagine this is caused by the workaround of having to call hoogle by hand.
Is there any magic stack would normally be doing that I'm missing by having to workaround this bug?
The end result is I'd like to take the hoogle database (and haddock docs) and deploy them to a production environment somehow, but I am so far unable to even get it to work locally.
Hi @merc1031,
What works for me is a slightly different hoogle generate and hoogle server invocation than you used. I include my full script for completeness:
This is fish shell syntax but I'm sure you can convert it to bash or your shell of choice.
stack haddock
set LOCAL_DOC_ROOT (stack path --local-doc-root)
set SNAPSHOT_DOC (stack path --snapshot-doc-root)
set DATABASE (stack path --local-hoogle-root)/database.foo
stack exec -- hoogle generate --local=$LOCAL_DOC_ROOT --local=$SNAPSHOT_DOC --database=$DATABASE
hoogle server --local --port=9876 --database=$DATABASE
And then I can connect to it through my browser at http://localhost:9876/
I hope that helps.
Versions:
hoogle --version
Hoogle 5.0.17.15
stack --version
Version 2.3.1, Git revision de2a7b694f07de7e6cf17f8c92338c16286b2878 (8103 commits) x86_64 hpack-0.33.0
resolver: lts-15.12
Thanks @gittywithexcitement, that worked for me too.
To save people the (minimal) effort of converting fish to bash, here is my script:
#!/bin/bash
# Based on code by @gittywithexcitement :
# https://github.com/commercialhaskell/stack/issues/5228#issuecomment-629738842
stack haddock
LOCAL_DOC_ROOT=$(stack path --local-doc-root)
SNAPSHOT_DOC=$(stack path --snapshot-doc-root)
DATABASE="$(stack path --local-hoogle-root)/database.foo"
stack exec -- hoogle generate --local=$LOCAL_DOC_ROOT --local=$SNAPSHOT_DOC --database=$DATABASE
hoogle server --local --port=9876 --database=$DATABASE
Thanks for writing this up Nielius! This worked like a charm for me.
In order to get hoogle to generate and serve up a database when enabling nix support, I used the following commands:
$ stack --nix build --haddock
$ stack --nix hoogle -- generate --local=$(stack --nix path --local-doc-root) --local=$(stack --nix path --snapshot-doc-root) --database "$(stack --nix path --local-hoogle-root)/database.hoo"
$ stack --nix hoogle -- server --database "$(stack --nix path --local-hoogle-root)/database.hoo" --local -n
Most helpful comment
Thanks @gittywithexcitement, that worked for me too.
To save people the (minimal) effort of converting fish to bash, here is my script: