Repository navigation
Fails to index #4
Description
Activity
Since the file
/home/maerwald/git/hpath/dist-newstyle/setup-configdoesn't exist, then it is possible that the packagehpathwas not built. The package should be built (usingcabalorstack) before indexing (i.e.,cabal new-build,cabal build, orstack buildcommand should be executed).Sorry, I should have added that to the README (I will update the README soon).
The package was definitely built.
Oh, now I see, I've provided an incorrect example in the README.
distdirectory (wheresetup-configfile is saved) forcabal new-buildshould be not justdist-newstyle, but something likedist-newstyle/build/x86_64-linux/ghc-8.2.2/hpath-0.9.2.Can you try to find a directory with
setup-configfile manually? I'm not sure if there is a cabal command that returns relative path to adistdirectory (likestack path --dist-dir).Yes, that seems to work, but as expected... cabal-helper fails with random errors. It's a plague, really.
Can you show the output of
haskell-code-indexerwith--verboseoption?Registering library for Cabal-2.2.0.0.. done [1 of 4] Compiling CabalHelper.Shared.Common ( /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/Common.hs, /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/Common.o ) [2 of 4] Compiling CabalHelper.Shared.InterfaceTypes ( /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/InterfaceTypes.hs, /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/InterfaceTypes.o ) [3 of 4] Compiling CabalHelper.Shared.Sandbox ( /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/Sandbox.hs, /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/Sandbox.o ) [4 of 4] Compiling Main ( /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Runtime/Main.hs, /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/Main.o ) /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Runtime/Main.hs:47:1: error: Could not find module ‘Distribution.PackageDescription.Parse’ Perhaps you meant Distribution.PackageDescription.Parsec (from Cabal-2.2.0.0) Distribution.PackageDescription.Check (from Cabal-2.2.0.0) Distribution.PackageDescription.Quirks (from Cabal-2.2.0.0) Use -v to see a list of the files searched for. | 47 | import Distribution.PackageDescription.Parse | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...cabal-helper-0.8.0.2that is used byhaskell-code-indexersupports only Cabal >=1.14 && <1.26 || ==2.0.*I should update the
cabal-helperpackageI'm having precisely this same issue. Would be great if you could add support!
cabal-helperis a terrible hack. It really just adds more fragility to the tooling ecosystem.Of course, compiling and linking
cabal-helperexecutable at runtime is an additional point of failure. Is there a simpler way to get build information (https://www.haskell.org/cabal/release/latest/doc/API/Cabal/Distribution-Simple-LocalBuildInfo.html)? The problem is that a format ofsetup-configfile depends on a version ofCaballibrary.I've hit this. It's trying to pick up MyProjectFoo/bar/dist/setup-config when the path should instead be:
$ cd MyProjectFoo/bar $ ls bar.cabal src $ stack path --dist-dir .stack-work/dist/x86_64-linux/Cabal-2.0.1.0(It did work for me for the top level project which lives at
MyProjectFoo/)Is there a workaround for this?
To answer my own question, this appears to work:
stack exec --no-ghc-package-path haskell-code-indexer -- -p . --dist $(stack path --dist-dir)When there is no
--distoption,haskell-code-indexertries to find the 'dist' directory: https://haskell-code-explorer.mfix.io/package/haskell-code-explorer-0.1.0.0/show/src/HaskellCodeExplorer/PackageInfo.hs#L315The logic is as follows: if the package directory contains
stack.yamlfile,haskell-code-indexerexecutesstack path --dist-dircommand to get the 'dist' directory, otherwise it tries to use the default 'dist' directorydist.So in my situation there is a
MyProjectFoo/stack.yamlbut noMyProjectFoo/bar/stack.yaml; the dist directory forbaris atMyProjectFoo/bar/.stack-work/dist/x86_64-linux/Cabal-2.0.1.0. Should the indexer check upper directories for astack.yamland if it finds one fall back to runningstack path --dist-dirin the CWD?I don't see how this is related to the original issue, which was about using cabal.
Apologies, I've filed a separate issue for that #13.
I have no idea why it's trying to get into
.stack-workdirectory of my package. I don't use stack for that package and told it to usedist-newstyle.