alexwl / haskell-code-explorer

Web application for exploring and understanding Haskell codebases
MIT License
509 stars 20 forks source link

Failing to index #46

Closed matsumonkie closed 3 years ago

matsumonkie commented 3 years ago

Hello, First things first, thank you for this awesome project. I'm trying to index a simple project (just a blank project I created with stack new ...) but I'm failing so far :-( I'm using the stack-8.8.3.yml for haskell-code-explorer.

Whether I have ghc-8.8.3 installed or not, whether I use the installed haskell-code-explorer binary or run stack exec haskell-code-indexer -- -p myProject it fails with cabal-helper-wrapper: Installing Cabal version 3.0.1.0 failed.

I have tried to install cabal 3.0.0.0 (with ghcup if that's relevant) but same problem.

I'm not too sure what I'm doing wrong and I'd love to have your input on this.

This is the log when I run with --verbose. Note that it says that GHC version 8.6.5.0 is used instead of 8.8.3 (also not sure if this is normal).

matsumonkie commented 3 years ago

So I've tried to index another project with ghc 8.6.5 and cabal 2.4.0.1 installed and it worked fine. both methods (running the binary "naked" or prefixing it with stack exec) work fine!

One thing though, while running haskell-code-indexer, it reinstalls Cabal even though it was already installed. Is this normal behavior?

alexwl commented 3 years ago

Hi,

I haven't added support for GHC 8.8 and Cabal 3.0 yet.

One thing though, while running haskell-code-indexer, it reinstalls Cabal even though it was already installed. Is this normal behavior?

haskell-code-indexer uses cabal-helper (https://hackage.haskell.org/package/cabal-helper) library that builds (at runtime) an executable linked against a certain version Cabal.

Here's a quote from cabal-helper docs:

The fundamental problem cabal-helper solves is the fact that in order to access the data Cabal stores in the setup-config file we have to link against lib:Cabal. However the binary format of this file is unstable and there is no backwards compatibility mechanism in the library. So to read a setup-config file produced by a certain version of Cabal we have to link against exactly that version.

To solve this problem the cabal-helper library builds a small executable at runtime who's only purpose is to link against lib:Cabal, read the contents of setup-config and present the data there in a Cabal version independent format for consumption by the cabal-helper library.

matsumonkie commented 3 years ago

I haven't added support for GHC 8.8 and Cabal 3.0 yet.

I see, I got fooled by the stack-8.8.3.yaml file :-S

Thanks a lot for the explanation!