Skip to content

Commit 451a9e6

Browse files
committed
Revert "Add the -dynamic flag and update build instructions (haskell#2668)"
This reverts commit 3f12824.
1 parent 08ad115 commit 451a9e6

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

docs/troubleshooting.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Troubleshooting
21

32
## Help, I have no idea what these words mean
43

@@ -165,34 +164,34 @@ Using an explicit `hie.yaml` to configure the cradle can resolve the problem, se
165164
Static binaries use the GHC linker for dynamically loading dependencies when typechecking Template Haskell 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).
166165
Dynamically linked binaries (including`ghci`) use the system linker instead of the GHC linker and avoid both issues.
167166

168-
The easiest way to obtain a dynamically linked HLS binary is to build HLS locally. With `cabal` this can be done as follows:
167+
The easiest way to obtain a dynamically linked HLS binary is to build it locally. With `cabal` this can be done as follows:
169168

170169
```bash
171-
cabal update && cabal install pkg:haskell-language-server
170+
cabal update && cabal install pkg:haskell-language-server --ghc-options="-dynamic"
172171
```
173172

174173
If you are compiling with a ghc version with a specific `cabal-ghc${ghcVersion}.project` in the repo you will have to use it. For example for ghc-9.0.x:
175174

176175
```bash
177-
cabal update && cabal install pkg:haskell-language-server --project-file=cabal-ghc90.project
176+
cabal update && cabal install pkg:haskell-language-server --project-file=cabal-ghc90.project --ghc-options="-dynamic"
178177
```
179178

180-
Or with `stack`:
179+
With `stack` you also need add the ghc option `-dynamic`.
181180

182181
```bash
183-
stack install haskell-language-server --stack-yaml=stack-${ghcVersion}.yaml
182+
stack install haskell-language-server --stack-yaml=stack-${ghcVersion}.yaml --ghc-options="-dynamic"
184183
```
185184

186185
You also can leverage `ghcup compile hls`:
187186

188187
```bash
189-
ghcup compile hls -v 1.6.1.0 --ghc 8.10.7
188+
ghcup compile hls -g master --ghc 8.10.7 -- --ghc-options="-dynamic"
190189
```
191190

192191
as it uses cabal underneath you might need to use a specific cabal.project for some ghc versions:
193192

194193
```bash
195-
ghcup compile hls -v 1.6.1.0 --ghc 9.0.2 --cabal-project cabal-ghc90.project
194+
ghcup compile hls -g master --ghc 9.0.2 --project-file cabal-ghc90.project -- --ghc-options="-dynamic"
196195
```
197196

198197
### Preprocessors

haskell-language-server.cabal

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,6 @@ flag brittany
209209
default: True
210210
manual: True
211211

212-
flag dynamic
213-
description: Build with the dyn rts
214-
default: True
215-
manual: True
216-
217212
common example-plugins
218213
hs-source-dirs: plugins/default/src
219214
other-modules: Ide.Plugin.Example,
@@ -370,15 +365,6 @@ executable haskell-language-server
370365
-Wno-unticked-promoted-constructors
371366
if flag(pedantic)
372367
ghc-options: -Werror
373-
if !os(windows) && flag(dynamic)
374-
-- We want to link against the dyn rts just like official GHC binaries do;
375-
-- the linked rts determines how external libs are loaded dynamically by TH.
376-
-- The standard way of doing this is via the --enable-dynamic-executables Cabal option
377-
-- Unfortunately it doesnt' work, see https://github.com/haskell/haskell-language-server/issues/2659
378-
-- One can use --ghc-options=-dynamic but this gets applied to the dependencies as well,
379-
-- which results in massive rebuilds and incompatibilities with profiling.
380-
-- So instead we set the -dynamic flag diretly here.
381-
ghc-options: -dynamic
382368

383369
build-depends:
384370
, aeson

0 commit comments

Comments
 (0)