From a90c768aa3d84a5fbc0ad04f9115ed562720a9b8 Mon Sep 17 00:00:00 2001 From: jneira <atreyu.bbb@gmail.com> Date: Sat, 29 Jan 2022 18:21:27 +0100 Subject: [PATCH] Complete th workarounds --- docs/troubleshooting.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index d4f29150..a6133634 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 -- GitLab