diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index d4f29150e4db918f4a974aa4b2998dcdd7baaae7..a6133634f02432317d1f50b225b45a3005bd20e1 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -160,18 +160,28 @@ The server log will show which cradle is being chosen. Using an explicit `hie.yaml` to configure the cradle can resolve the problem, see the [configuration page](./configuration.md#configuring-your-project-build). -### Static binaries +### Static binaries and template haskell support Static binaries use the GHC linker for dynamically loading dependencies when typechecking TH code, and this can run into issues when loading shared objects linked against mismatching system libraries, or into GHC linker bugs (mainly the Mach linker used in Mac OS, but also potentially the ELF linker). Dynamically linked binaries (including`ghci`) use the system linker instead of the GHC linker and avoid both issues. The easiest way to obtain a dynamically linked HLS binary is to build it locally. With `cabal` this can be done as follows: - cabal update && cabal install haskell-language-server --enable-executable-dynamic +```bash +cabal update && cabal install haskell-language-server --enable-executable-dynamic +``` With `stack` you need to manually add the ghc option `-dynamic`. -Note: HLS binaries prior to 1.6.0 were statically linking `glibc` which is not a supported configuration and has been replaced by `musl`. +```bash +stack install haskell-language-server --ghc-options="-dynamic" +``` + +You also can also leverage `ghcup compile hls`: + +```bash +ghcup compile hls -g master --ghc 8.10.7 -- --enable-executable-dynamic +``` ### Preprocessors