haskell-ide-engine icon indicating copy to clipboard operation
haskell-ide-engine copied to clipboard

Conflict between running cabal manually and using hie

Open newhoggy opened this issue 3 years ago • 1 comments

I'm getting intermittent build failures like this:

ld: library not found for -lHSshelley-spec-ledger-0.1.0.0-inplace-ghc8.6.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

And this:

ld: can't open file, errno=2 file '/Users/jky/wrk/iohk/cardano-node/dist-newstyle/build/x86_64-osx/ghc-8.6.5/cardano-prelude-0.1.0.0/build/libHScardano-prelude-0.1.0.0-inplace-ghc8.6.5.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

And this:

ghc: can't find a package database at /Users/jky/wrk/iohk/cardano-node/dist-newstyle/build/x86_64-osx/ghc-8.6.5/cardano-crypto-praos-2.0.0/package.conf.inplace
cabal: Failed to build cardano-crypto-praos-2.0.0 (which is required by
test:cardano-node-test from cardano-node-1.15.0, test:cardano-cli-test from
cardano-cli-1.15.0 and others).

This occurs when I attempt to use cabal and haskell-ide-engine at the same time.

About 50% of attempts fail. Each time it fails, I get a different error. On a different "in-place" package.

Moreover incremental builds don't work so well as it appears that incremental build artefacts get destroyed and need to get reconfigured and built.

This is my version of cabal:

cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library

This is my version of hie:

$ ~/.cabal/bin/backup/hie-8.6.5 --version
Version 1.4 x86_64 ghc-8.6.5

hie is build from this commit: a9005b2ba2050bdfdd4438f1d471a3f7985492cd

Work around

Supply an additional --build-dir flag so that my own builds go to a different dist directory so as to not interfere the cabal processes that hie launches that use the default directory dist-newstyle.

newhoggy avatar Jul 09 '20 11:07 newhoggy

Switching to haskell-language-server is also a viable work-around. In this case, make sure you generate hie.yaml files if you have any issues.

newhoggy avatar Jul 09 '20 12:07 newhoggy