Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails in windows for ghc >= 8.8.3 on floskell: Access violation in generated code #86

Closed
tuomohopia opened this issue May 4, 2020 · 17 comments
Labels
can-workaround CI Continuous integration os: windows status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@tuomohopia
Copy link

tuomohopia commented May 4, 2020

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.

@jneira
Copy link
Member

jneira commented May 5, 2020

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?

@tuomohopia
Copy link
Author

tuomohopia commented May 5, 2020

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.

@jneira
Copy link
Member

jneira commented May 5, 2020

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

@tuomohopia
Copy link
Author

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!

@jneira jneira added CI Continuous integration os: windows type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels May 5, 2020
@jneira jneira changed the title Install fails on WIN10 for GHC 8.8.3 Install fails on WIN10 for GHC 8.8.3: Access violation in generated code May 5, 2020
@jneira
Copy link
Member

jneira commented May 5, 2020

  • 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

@jneira jneira changed the title Install fails on WIN10 for GHC 8.8.3: Access violation in generated code Install fails on windows and stack for ghc-8.8.3: Access violation in generated code May 6, 2020
@jneira
Copy link
Member

jneira commented May 14, 2020

  • The error continue being reproduced with lastest 8.8.3 lts

@hsenag
Copy link
Member

hsenag commented May 15, 2020

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

@ndmitchell
Copy link
Collaborator

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

@hsenag
Copy link
Member

hsenag commented May 15, 2020

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)

@ndmitchell
Copy link
Collaborator

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

@hsenag
Copy link
Member

hsenag commented May 15, 2020

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.

@jneira
Copy link
Member

jneira commented May 29, 2020

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

@jneira jneira added the status: blocked Not actionable, because blocked by upstream/GHC etc. label Jul 6, 2020
@jneira
Copy link
Member

jneira commented Jul 25, 2020

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: ennocramer/floskell#50 and the ghc one: https://gitlab.haskell.org/ghc/ghc/-/issues/18496.

@jneira jneira changed the title Install fails on windows and stack for ghc-8.8.3: Access violation in generated code Install fails in windows for ghc-8.8.3 on floskell: Access violation in generated code Jul 25, 2020
@jneira jneira changed the title Install fails in windows for ghc-8.8.3 on floskell: Access violation in generated code Install fails in windows for ghc >= 8.8.3 on floskell: Access violation in generated code Jul 25, 2020
@jneira
Copy link
Member

jneira commented Jul 25, 2020

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

@jneira
Copy link
Member

jneira commented Jan 15, 2021

It seems this issue is gone for ghc-8.10.3, maybe we should keep this open until we drop support for ghc-8.8

@jneira jneira removed the status: blocked Not actionable, because blocked by upstream/GHC etc. label Jan 15, 2021
@jneira
Copy link
Member

jneira commented Oct 4, 2021

I've workarounded the issue in our ci setting in cabal.project

package floskell
  ghc-options: -O0

disabling all compile time optimizations. Not sure if it is a good idea but 🤷

@jneira jneira added the status: blocked Not actionable, because blocked by upstream/GHC etc. label Oct 4, 2021
@jneira
Copy link
Member

jneira commented Oct 4, 2021

This is essentially not fixable as it is a ghc error and ghc is not releasing more fixes for ghc-8.8. It has a workaround for building it and the prebuilt binary is available so i am gonna close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can-workaround CI Continuous integration os: windows status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

4 participants