If you update ICU on macOS, some packages are dynamically linked against a specific version, but the older version might dissapear. You'll see this with something like,
$ stack --stack-yaml=stack-8.0.2.yaml install --extra-lib-dirs=/usr/local/opt/icu4c/lib --extra-include-dirs=/usr/local/opt/icu4c/include
...
HaRe-0.8.4.1: copy/register
brittany-0.11.0.0: copy/register
Progress 18/20
-- While building custom Setup.hs for package haskell-lsp-0.2.1.0 using:
/Users/tehnix/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /Users/tehnix/GitHub/Clones/haskell-ide-engine/.stack-work/logs/haskell-lsp-0.2.1.0.log
Configuring haskell-lsp-0.2.1.0...
Building haskell-lsp-0.2.1.0...
Preprocessing library haskell-lsp-0.2.1.0...
[1 of 8] Compiling Language.Haskell.LSP.Types ( src/Language/Haskell/LSP/Types.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Language/Haskell/LSP/Types.o )
[2 of 8] Compiling Language.Haskell.LSP.Messages ( src/Language/Haskell/LSP/Messages.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Language/Haskell/LSP/Messages.o )
[3 of 8] Compiling Language.Haskell.LSP.Diagnostics ( src/Language/Haskell/LSP/Diagnostics.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Language/Haskell/LSP/Diagnostics.o )
<command line>: can't load .so/.DLL for: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.21/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStext-icu-0.7.0.1-EllpGYmNw3bJ3FIJMPisuJ-ghc8.0.2.dylib (dlopen(/Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.21/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStext-icu-0.7.0.1-EllpGYmNw3bJ3FIJMPisuJ-ghc8.0.2.dylib, 5): Library not loaded: /usr/local/opt/icu4c/lib/libicuuc.61.dylib
Referenced from: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.21/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStext-icu-0.7.0.1-EllpGYmNw3bJ3FIJMPisuJ-ghc8.0.2.dylib
Reason: image not found)
I've described this before in haskell-ide-engine#513, but I seem to keep loosing it, so here's a gist with it too :) The problem comes from a package pulling in libHStext-icu
, which in our case is yi-rope
. The solution is to unregister yi-rope
and remove it.
$ stack --stack-yaml=stack-8.0.2.yaml exec -- ghc-pkg unregister --force text-icu
$ stack --stack-yaml=stack-8.0.2.yaml exec -- ghc-pkg unregister --force yi-rope
$ rm -r $HOME/.stack/snapshots/x86_64-osx/lts-9.21/8.0.2/lib/x86_64-osx-ghc-8.0.2/text-icu-0.7.0.1-EllpGYmNw3bJ3FIJMPisuJ
$ rm -r $HOME/.stack/snapshots/x86_64-osx/lts-9.21/8.0.2/lib/x86_64-osx-ghc-8.0.2/yi-rope-0.9-EsHB6fIN3uG2Q1h8EdpARr