haskell-code-explorer icon indicating copy to clipboard operation
haskell-code-explorer copied to clipboard

Consider including GHC version in executable name

Open seagreen opened this issue 5 years ago • 2 comments

My understanding is that the GHC version used to build haskell-code-explorer needs to match the GHC version of the project you're indexing (eg see https://github.com/alexwl/haskell-code-explorer/issues/16#issuecomment-454966542).

This wasn't initially clear to me when initially trying to get haskell-code-indexer working, and using a haskell-code-indexer built with the wrong version of GHC lead to confusing error messages, eg

2019-03-20 17:18:19.736738839 EDT : [error] Error while indexing component li
KSLx7jSwdIM:
    MonadRandom-0.5.1.1-9vmCiRoafqTKSLx7jSwdIM is unusable due to missing dep
      primitive-0.6.4.0-1mvPxVOk6Q6KOkWCZxqESf transformers-0.5.5.0 transform
    (use -v for more information)

Because of this, would it make sense to adopt Haskell IDE Engine's convention for executable naming? They append each executable with the GHC version used to build it, eg:

$ ls hie*
hie      hie-8.2.1  hie-8.4    hie-8.4.3  hie-8.6    hie-8.6.2
hie-8.2  hie-8.2.2  hie-8.4.2  hie-8.4.4  hie-8.6.1  hie-wrapper

As you can see they also build one version of hie without the GHC version appended, but I'm not sure we even need that.

This would also make it really easy to have lots of different versions of haskell-code-indexer on your machine at once.

seagreen avatar Mar 20 '19 21:03 seagreen

My understanding is that the GHC version used to build haskell-code-explorer needs to match the GHC version of the project you're indexing

That's correct. It should be mentioned in the README (I will update it).

Currently, haskell-code-indexer doesn't check if its version of GHC matches the version that was used to build the project you're indexing. As a result of this, GHC version mismatch causes GHC itself to fail with an unhelpful error message (the message "*** is unusable due to missing dependencies" comes from the GHC: https://github.com/ghc/ghc/blob/610ec224a49e092c802a336570fd9613ea15ef3c/compiler/main/Packages.hs#L1164).

I will implement a GHC version check in haskell-code-indexer. It should be simple because the first line of the setup-config file from the dist directory of each Cabal package contains the version of GHC, e.g., "Saved package config for haskell-code-explorer-0.1.0.0 written by Cabal-2.4.0.1 using ghc-8.6".

I agree it makes sense to adopt Haskell IDE Engine's convention for executable naming.

alexwl avatar Mar 22 '19 00:03 alexwl

Executables with GHC version appended merged in https://github.com/alexwl/haskell-code-explorer/pull/29

seagreen avatar Mar 24 '19 19:03 seagreen