Haskell-language-server: Install fails in windows for ghc >= 8.8.3 on floskell: Access violation in generated code

Created on 5 May 2020  路  14Comments  路  Source: haskell/haskell-language-server

I'm seeing the install fail on my system for some reason with just

--  While building package floskell-0.10.2 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe --builddir=.stack-work\dist\29cc6475 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 11
Progress 3/5

********************************************************************************
Building failed, Try running `stack clean` and restart the build
If this does not work, open an issue at
        https://github.com/haskell/haskell-language-engine
********************************************************************************

Error when running Shake build system:
  at want, called at src\Development\Shake\Internal\Args.hs:83:69 in shake-0.18.5-JIltN70Z6uA8zMbpBJImj0:Development.Shake.Internal.Args
* Depends on: hls-8.8.3
  at command, called at src\\Stack.hs:83:3 in hls-install-0.8.0.0-G5s3uly41eMHHYnugIYx2Q:Stack
* Raised the exception:
Development.Shake.command, system command failed
Command line: stack --stack-yaml=stack-8.8.3.yaml install --verbosity=info
Exit code: 1

I installed haskell-language-server by:

  • First changing resolver in shake.yaml in install folder to: lts-15.11 (GHC 8.8.3)
  • Then running install via stack ./install.hs hls-8.8.3

I'm running on Windows 10 and stack version 2.3.1.

build can-workaround windows blocked upstream bug

Most helpful comment

I've just seen that the fix for that bug will be backported to ghc.8.8.4, 馃帀 : https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3373

All 14 comments

I am able to reproduce and the log building floskell says:

floskell                         > [10 of 12] Compiling Floskell.Pretty
floskell                         >
floskell                         > Access violation in generated code when executing data at 0xffffffff80e86b40
floskell                         >
floskell                         >  Attempting to reconstruct a stack trace...
floskell                         >
floskell                         >    Frame     Code address
floskell                         >  * 0x461dab0 0xffffffff80e86b40
floskell                         >  * 0x461dab8 0x2d006300680067
floskell                         >  * 0x461dac0 0x2e0038002e0038
floskell                         >  * 0x461dac8 0x690000005c0033
floskell                         >  * 0x461dad0 0x5c006e D:\bin\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x1c006e
.........................
Lot of other packages continuing being compiled
........................
--  While building package floskell-0.10.2 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe --builddir=.stack-work\dist\29cc6475 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 11

The error seems to be the same reported here: https://gitlab.haskell.org/ghc/ghc/issues/17926

could you confirm that you get the above error if you run stack build --stack-yaml stack-8.8.3.yaml --verbosity warn?

I tried running that, it seems to die abruptply like this

ghcide                 > exe\Main.hs:551:5: warning: [-Wunused-matches]
ghcide                 >     Defined but not used: `v'
ghcide                 >     |
ghcide                 > 551 |     v <- runTimeVersion
ghcide                 >     |     ^
ghcide                 >

--  While building package floskell-0.10.2 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe --builddir=.stack-work\dist\29cc6475 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 11
Progress 2/3

According to the log it was building floskell just moments earlier:

floskell               > Access violation in generated code when executing data at 0xffffffff82a8ab40
floskell               >
floskell               >  Attempting to reconstruct a stack trace...

...

floskell               >  * 0x461dba8   0x3d82f51 C:\Users\tuomo\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x3982f51
floskell               >  * 0x461dbb0   0x3937291 C:\Users\tuomo\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x3537291
floskell               >  * 0x461dbb8   0x3937281 C:\Users\tuomo\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x3537281
floskell               >  * 0x461dbc0   0x393726a C:\Users\tuomo\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x353726a
floskell               >
floskell               >    ... (maximum recursion depth reached.)
floskell               >

Edit: So yes, seems like we hit precisely the same problem with building floskell.

Yeah, the full error is the first "Access violation..." and i am afraid that it is an ugly bug in the compiler that it is not fixed.
Some alternatives:

  • stack install.hs hls-8.6.5 (installs hls with ghc-8.6.5, but your projects should use that version too)
  • cabal-hls-install hls-8.8.3 (you need to have cabal and ghc-8.8.3 on PATH)

I am checking both locally but the second one was succesful for me recently

Yes, based on your link it seems like nothing anybody can do on this end. I hope it gets fixed for GHC 8.10.1.

Since my projects are all on GHC 8.8.3 I'll try installing cabal and compiling with it, thanks for the tip!

  • I've just built the project with cabal-hls-install hls-8.8.3 succesfully
  • I am trying with an older stack version, just in case: the error is reproduced with stack-2.2.0
  • The error continue being reproduced with lastest 8.8.3 lts

FYI I'm seeing a segfault building floskell with GHC 8.10.1 as well.

The hypothesis is that the recently released process-1.6.9 might fix it. Would be good for someone to test that out. See https://github.com/haskell/process/pull/176

I just spotted that too and was testing it out just in case. But is it the process GHC was built with that matters, or the one being built for hls? (If those are different)

Dunno, but yeah, I suspect GHC needs to release a new version with that fix included.

I think (from some experiments) that hls/ghcide are tied to the one that comes with GHC anyway because of the API dependency, so I can't even try with the new process.

I've just seen that the fix for that bug will be backported to ghc.8.8.4, 馃帀 : https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3373

The floskell related segfault persists with ghc-8.8.4 which is shipped with the patched process version 馃槦
I've opened issues in the floskell repo: https://github.com/ennocramer/floskell/issues/50 and the ghc one: https://gitlab.haskell.org/ghc/ghc/-/issues/18496.

I am being able to build it with all involved versions building floskell locally (but not always, sometimes it fails):

  • pulling floskell from github or using cabal get floskell or stack unpack floskell
  • change cabal.project to include it as a local package:
packages: /path/to/floskell ./ ghcide
  • cabal clean && cabal build
  • extract the binaries inside dist-newstyle and copy them in the desired path
Was this page helpful?
0 / 5 - 0 ratings