4

对于一个新项目,我一直在尝试构建threepenny-gui包,我过去做过很多次,没有任何麻烦。然而,这一次,我遇到了一个不寻常的错误消息:

> stack build
threepenny-gui     > configure
threepenny-gui     > Configuring threepenny-gui-0.9.0.0...
threepenny-gui     > build
threepenny-gui     > Preprocessing library for threepenny-gui-0.9.0.0..
threepenny-gui     > Building library for threepenny-gui-0.9.0.0..
threepenny-gui     > [ 1 of 29] Compiling Foreign.JavaScript.Include
threepenny-gui     > [ 2 of 29] Compiling Foreign.JavaScript.Resources
threepenny-gui     > ghc.exe: unable to load package `regex-posix-0.96.0.0'
threepenny-gui     > ghc.exe:  | C:\sr\snapshots\14724cfd\lib\x86_64-windows-ghc-8.8.4\regex-posix-0.96.0.0-11M5Q2Uki3ACYikP2WXOuq\HSregex-posix-0.96.0.0-11M5Q2Uki3ACYikP2WXOuq.o: unknown symbol `regerror'

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

现在,一个快速的谷歌显示这个错误消息之前已经看到过 - 在 2010 年,之后它通过 GHC 更新修复。我尝试更改 GHC 版本(上面的输出是使用 GHC 8.8.4),但它也不适用于 8.8.3 或 8.8.2。我还尝试删除regex-posix¹ 并重新安装它,但这也不起作用。在这一点上,我必须承认这个错误已经完全难倒了我;有没有其他人知道可能是什么原因造成的,如果有,我该如何解决?

¹ 具体来说,我删除了C:\sr\snapshots\14724cfd\lib\x86_64-windows-ghc-8.8.4\regex-posix-0.96.0.0-11M5Q2Uki3ACYikP2WXOuqand C:\sr\snapshots\14724cfd\pkgdb\regex-posix-0.96.0.0-11M5Q2Uki3ACYikP2WXOuq.conf,并且做了ghc-pkg unregister regex-posix.

4

1 回答 1

1

事实证明这是一个问题 inregex-posix而不是threepenny-gui. 这个问题可以通过启用 Cabal 标志来解决_regex-posix-clib。要设置它,我首先需要取消注册以前的版本regex-posix

> stack --resolver lts-16.23 exec -- ghc-pkg unregister regex-posix-0.96.0.0 --force

然后我需要用正确的标志重建它:

> stack build regex-posix-0.96.0.0 --flag regex-posix:_regex-posix-clib --resolver lts-16.23

之后stack build threepenny-gui --resolver lts-16.23就成功了。(出于某种原因,我需要在这些命令中明确指定解析器。)

于 2020-12-30T07:35:46.977 回答