haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 213 forks source link

stack build failing on Windows and ghc-8.8.3: Access violation in generated code #1779

Open a-churchill opened 4 years ago

a-churchill commented 4 years ago

Hello, I'm trying to install hie with stack ./install.hs hie-8.8.3 and the build fails every time. FYI this is in a short path (C:\hie) and I have also enabled Win32 long paths.

Here is the full output:

PS C:\hie> stack install.hs hie-8.8.3
# stack (for check)
# git (for submodules)
# git (for submodules)
Options:
    Verbosity level: Info
# stack (for hie-8.8.3)
Linking C:\\sr\\setup-exe-cache\\x86_64-windows\\tmp-Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe ...

Access violation in generated code when writing 0x0

 Attempting to reconstruct a stack trace...

   Frame        Code address
 * 0x461da80    0x37f7b66 C:\Users\chuan\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x33f7b66
 * 0x461da88    0x3277bb9 C:\Users\chuan\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x2e77bb9
 * 0x461da90    0x3
 * 0x461da98    0x69a2db1
 * 0x461daa0    0x3d80c90 C:\Users\chuan\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x3980c90
 * 0x461daa8    0x76e6c30

--  While building simple Setup.hs using:
      C:\Users\chuan\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc-8.8.3.EXE -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.0.1.0 C:\sr\setup-exe-src\setup-Z6RU0evB.hs C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs -o C:\sr\setup-exe-cache\x86_64-windows\tmp-Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe
    Process exited with code: ExitFailure 11

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

Error when running Shake build system:
  at want, called at src\Development\Shake\Internal\Args.hs:83:69 in shake-0.18.5-7VS8ovPeUeSCopHgkQQ1Vu:Development.Shake.Internal.Args
* Depends on: hie-8.8.3
  at command, called at src\\Stack.hs:80:3 in hie-install-0.8.1.0-92nHWHZTzvm7FeYed5xR9u: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
Stderr:
Linking C:\\sr\\setup-exe-cache\\x86_64-windows\\tmp-Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe ...

Access violation in generated code when writing 0x0

 Attempting to reconstruct a stack trace...

   Frame        Code address
 * 0x461da80    0x37f7b66 C:\Users\chuan\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x33f7b66
 * 0x461da88    0x3277bb9 C:\Users\chuan\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x2e77bb9
 * 0x461da90    0x3
 * 0x461da98    0x69a2db1
 * 0x461daa0    0x3d80c90 C:\Users\chuan\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x3980c90
 * 0x461daa8    0x76e6c30

--  While building simple Setup.hs using:
      C:\Users\chuan\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc-8.8.3.EXE -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.0.1.0 C:\sr\setup-exe-src\setup-Z6RU0evB.hs C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs -o C:\sr\setup-exe-cache\x86_64-windows\tmp-Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe
    Process exited with code: ExitFailure 11

I have also followed the advice in the error message and ran stack clean before rerunning the same command, but it gets the same error.

Also it's worth mentioning, stack and git are on my PATH, as is the Stack local bin directory

jneira commented 4 years ago

Hi! i am afraid the error is due a general ghc bug and it is triggered for lot of packages, see for example https://github.com/haskell/haskell-language-server/issues/86 We cant do much things here but suggest some workarounds until a ghc release that fixes it:

jneira commented 4 years ago

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