简体   繁体   English

Haskell-Stack:构建期间的访问冲突错误

[英]Haskell-Stack: Access violation error during build

I've been trying to build my Haskell project for the last couple days using stack and I'm getting an access violation error. 我一直在尝试使用堆栈构建我最近几天的Haskell项目,并且我遇到了访问冲突错误。 From what I understand I have the latest stack version and GHC. 根据我的理解,我有最新的堆栈版本和GHC。

This was all originally working until I added a library to my cabal file. 这一切都是最初工作,直到我将库添加到我的cabal文件。 I've now removed it but the error still occurs. 我现在已将其删除,但错误仍然存​​在。 I've also reverted back to when my code was definitely working so I'm sure this is something caused by stack. 我还回到了我的代码肯定正在工作的时候,所以我确定这是由堆栈引起的。

I've tried uninstalling stack, deleting .stack-work and reinstalling. 我已经尝试卸载堆栈,删除.stack-work并重新安装。 Then doing a stack setup. 然后进行堆栈设置。 I've tried many variations of commands but no results. 我尝试了很多命令,但没有结果。

I've now also tried creating a new project with Stack and building it and I get the same issue. 我现在也尝试使用Stack创建一个新项目并构建它,我也遇到了同样的问题。

stack build

Building all executables for `haskell-project' once. After a successful build of all of them, only specified executables will be rebuilt.
haskell-project-0.1.0.0: configure (exe)
Access violation in generated code when reading 000000000e58391a

--  While building custom Setup.hs for package haskell-project-0.1.0.0 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.0.1.0_ghc-8.2.2.exe --builddir=.stack-work\dist\5c8418a7 configure --with-ghc=C:\Users\Michael\AppData\Local\Programs\stack\x86_64-windows\ghc-8.2.2\bin\ghc.EXE --with-ghc-pkg=C:\Users\Michael\AppData\Local\Programs\stack\x86_64-windows\ghc-8.2.2\bin\ghc-pkg.EXE --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\13cecb13\pkgdb --package-db=C:\Users\Michael\Desktop\haskell-project\.stack-work\install\ccbce92a\pkgdb --libdir=C:\Users\Michael\Desktop\haskell-project\.stack-work\install\ccbce92a\lib --bindir=C:\Users\Michael\Desktop\haskell-project\.stack-work\install\ccbce92a\bin --datadir=C:\Users\Michael\Desktop\haskell-project\.stack-work\install\ccbce92a\share --libexecdir=C:\Users\Michael\Desktop\haskell-project\.stack-work\install\ccbce92a\libexec --sysconfdir=C:\Users\Michael\Desktop\haskell-project\.stack-work\install\ccbce92a\etc --docdir=C:\Users\Michael\Desktop\haskell-project\.stack-work\install\ccbce92a\doc\haskell-project-0.1.0.0 --htmldir=C:\Users\Michael\Desktop\haskell-project\.stack-work\install\ccbce92a\doc\haskell-project-0.1.0.0 --haddockdir=C:\Users\Michael\Desktop\haskell-project\.stack-work\install\ccbce92a\doc\haskell-project-0.1.0.0 --dependency=base=base-4.10.1.0 --dependency=containers=containers-0.5.10.2 --dependency=mtl=mtl-2.2.1-DscMMmDQUE6GBfOSl4qMUH --dependency=parsec=parsec-3.1.11-3BgBURmbRiVF8fgoxhAiBa --dependency=pretty-simple=pretty-simple-2.0.1.0-J3QTM6x6LHL5fhqavYvVhJ --dependency=text=text-1.2.2.2-9VTsh6V7U7hpagw2HDvpZ --extra-include-dirs=C:\Users\Michael\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include --extra-lib-dirs=C:\Users\Michael\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\bin --extra-lib-dirs=C:\Users\Michael\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib --enable-tests --enable-benchmarks
    Process exited with code: ExitFailure 1

What would be the steps to fix this or likely causes? 解决这个或可能原因的步骤是什么?

I managed to find a temporary solution for anybody who is having the same issue. 我设法为任何遇到同样问题的人找到了一个临时解决方案。

I downgraded cabal to version 1.24.0.2 and changed the resolver to using GHC version 8.0.1 ( resolver: ghc-8.0.1 ). 我将cabal降级到版本1.24.0.2并将解析器更改为使用GHC版本8.0.1( resolver: ghc-8.0.1 )。

After then running stack solver I'm now able to build. 然后运行stack solver我现在能够构建。

The issue #3765 on the stack tracker has some workarounds for this, in addition to Michael's answer . 除了迈克尔的回答之外,堆栈跟踪器上的问题#3765还有一些解决方法。

The best solution, it seems, is to unset __COMPAT_LAYER , which when set to INSTALLER can reproduce the bug. 似乎最好的解决方案是取消设置__COMPAT_LAYER ,当设置为INSTALLER可以重现该错误。

C:\\>set __COMPAT_LAYER=

The cause might be a bug in some versions of GHC, which is catching exceptions it ought to propagate to the user. 原因可能是GHC的某些版本中的错误,它会捕获应该传播给用户的异常。 If this is the case, there is an underlying problem, and this bug is hiding it. 如果是这种情况,则存在潜在的问题,并且此错误正在隐藏它。

Do please add a comment on the aforementioned issue, as it will help the maintainers track the prevalence of this problem. 请对上述问题添加评论,因为这将有助于维护人员跟踪此问题的普遍性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM