haskell/haskell-language-server

Build failure with ghc 9.8.4

ii8 opened this issue · 4 comments

ii8 commented

I'm trying to build haskell-language-server but it fails with the following message:

...
haskell-language-server            > Preprocessing library for haskell-language-server-2.11.0.0..
haskell-language-server            > Building library for haskell-language-server-2.11.0.0..
haskell-language-server            > 
haskell-language-server            > <no location info>: warning: [GHC-42258] [-Wunused-packages]
haskell-language-server            >     The following packages were specified via -package or -package-id flags,
haskell-language-server            >     but were not needed for compilation:
haskell-language-server            >       - ghc-9.8.4 (exposed by flag -package-id ghc-9.8.4-0f24)
haskell-language-server            > [1 of 5] Compiling HlsPlugins
haskell-language-server            > [2 of 5] Compiling Paths_haskell_language_server
haskell-language-server            > [3 of 5] Compiling Ide.Version
haskell-language-server            > 
haskell-language-server            > <no location info>: error:
haskell-language-server            >     Error loading shared library libHShaskell-language-server-2.11.0.0-9OGEztfF4ClG0QqBvXEJy0-hls-refactor-plugin-ghc9.8.4.so: No such file or directory (needed by /builddir/haskell-language-server-2.11.0.0/.stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-rename-plugin/libHShaskell-language-server-2.11.0.0-LLEEQOQOXsnFbnyT9FlSq3-hls-rename-plugin-ghc9.8.4.so)
haskell-language-server            > [4 of 5] Compiling Ide.Arguments
haskell-language-server            > 
haskell-language-server            > <no location info>: error:
haskell-language-server            >     Error loading shared library libHShaskell-language-server-2.11.0.0-9OGEztfF4ClG0QqBvXEJy0-hls-refactor-plugin-ghc9.8.4.so: No such file or directory (needed by /builddir/haskell-language-server-2.11.0.0/.stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-rename-plugin/libHShaskell-language-server-2.11.0.0-LLEEQOQOXsnFbnyT9FlSq3-hls-rename-plugin-ghc9.8.4.so)
Completed 257 action(s).

Error: [S-7282]
       Stack failed to execute the build plan.
       
       While executing the build plan, Stack encountered the error:
       
       [S-7011]
       While building package haskell-language-server-2.11.0.0 (scroll up to its section to see the error) using:
       /builddir/haskell-language-server-2.11.0.0/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_O_vy6YIf_3.10.3.0_ghc-9.8.4 --verbose=1 --buil
ddir=.stack-work/dist/x86_64-linux/ghc-9.8.4 build lib:haskell-language-server lib:ghcide-bench-lib lib:hls-alternate-number-format-plugin lib:hl
s-cabal-fmt-plugin lib:hls-cabal-gild-plugin lib:hls-cabal-plugin lib:hls-call-hierarchy-plugin lib:hls-change-type-signature-plugin lib:hls-clas
s-plugin lib:hls-code-range-plugin lib:hls-eval-plugin lib:hls-explicit-fixity-plugin lib:hls-explicit-imports-plugin lib:hls-explicit-record-fie
lds-plugin lib:hls-floskell-plugin lib:hls-fourmolu-plugin lib:hls-gadt-plugin lib:hls-hlint-plugin lib:hls-module-name-plugin lib:hls-notes-plug
in lib:hls-ormolu-plugin lib:hls-overloaded-record-dot-plugin lib:hls-pragmas-plugin lib:hls-qualify-imported-names-plugin lib:hls-refactor-plugi
n lib:hls-rename-plugin lib:hls-retrie-plugin lib:hls-semantic-tokens-plugin lib:hls-splice-plugin lib:hls-stan-plugin lib:hls-stylish-haskell-pl
ugin exe:ghcide-bench exe:ghcide-test-preprocessor exe:haskell-language-server exe:haskell-language-server-wrapper --ghc-options ""

It looks like things are not getting built in the right order so the rename component can't find the rewrite component it needs.

OS: Void Linux
libc: musl
haskell-language-server version: 2.11.0.0, all default flags
stack version: 3.7.1
ghc version: 9.8.4,

Hi, thank you for the bug report!

We use dynamic linking of Haskell dependencies on linux, perhaps this doesn't quite work with musl?

Can you try compiling with stack build --flag haskell-language-server:-dynamic

ii8 commented

Thanks for the hint, but unfortunately it still happens, although it shows a different plugin.

haskell-language-server            > [1 of 5] Compiling HlsPlugins
haskell-language-server            > [2 of 5] Compiling Paths_haskell_language_server
haskell-language-server            > [3 of 5] Compiling Ide.Version
haskell-language-server            > 
haskell-language-server            > <no location info>: error:
haskell-language-server            >     Error loading shared library libHShaskell-language-server-2.11.0.0-5lh7dUyPxcxJytHdsU7gQn-hls-refactor-plugin-ghc9.8.4.so: No such file or directory (needed by /builddir/haskell-language-server-2.11.0.0/.stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-retrie-plugin/libHShaskell-language-server-2.11.0.0-4VJbtmfwJ2f3YAPIKUrfTV-hls-retrie-plugin-ghc9.8.4.so)
haskell-language-server            > [4 of 5] Compiling Ide.Arguments
haskell-language-server            > 
haskell-language-server            > <no location info>: error:
haskell-language-server            >     Error loading shared library libHShaskell-language-server-2.11.0.0-5lh7dUyPxcxJytHdsU7gQn-hls-refactor-plugin-ghc9.8.4.so: No such file or directory (needed by /builddir/haskell-language-server-2.11.0.0/.stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-retrie-plugin/libHShaskell-language-server-2.11.0.0-4VJbtmfwJ2f3YAPIKUrfTV-hls-retrie-plugin-ghc9.8.4.so)

I found that those shared objects do exist

λ ls .stack-work/dist/x86_64-linux/ghc-9.8.4/build/*/*refactor*
.stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-refactor-plugin/libHShaskell-language-server-2.11.0.0-5lh7dUyPxcxJytHdsU7gQn-hls-refactor-plugin-ghc9.8.4.so
.stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-refactor-plugin/libHShaskell-language-server-2.11.0.0-5lh7dUyPxcxJytHdsU7gQn-hls-refactor-plugin.a

But ldd shows the linker errors:

λ ldd .stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-refactor-plugin/libHShaskell-language-server-2.11.0.0-5lh7dUyPxcxJytHdsU7gQn-hls-refactor-plugin-ghc9.8.4.so |& head -n 4
ldd (0x7fec01782000)
Error loading shared library libHSghcide-2.11.0.0-GQRUkgs1BnjBT3tFOan4Nz-ghc9.8.4.so: No such file or directory (needed by .stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-refactor-plugin/libHShaskell-language-server-2.11.0.0-5lh7dUyPxcxJytHdsU7gQn-hls-refactor-plugin-ghc9.8.4.so)
Error loading shared library libHSimplicit-hie-0.1.4.0-H7VKlk3eQTt75FFXZoncp7-ghc9.8.4.so: No such file or directory (needed by .stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-refactor-plugin/libHShaskell-language-server-2.11.0.0-5lh7dUyPxcxJytHdsU7gQn-hls-refactor-plugin-ghc9.8.4.so)
Error loading shared library libHSfilepattern-0.1.3-LthGMKhql5U8BS3jMn5G6I-ghc9.8.4.so: No such file or directory (needed by .stack-work/dist/x86_64-linux/ghc-9.8.4/build/hls-refactor-plugin/libHShaskell-language-server-2.11.0.0-5lh7dUyPxcxJytHdsU7gQn-hls-refactor-plugin-ghc9.8.4.so)

Maybe there's something else I have to do to get it to statically link these.

ii8 commented

I was able to work around this by disabling tests and benchmarks.

Closing since it seems there's a workaround and it's a fairly old GHC.