“无法加载软件包"regex-posix"……未知符号"regerror"" [英] “Unable to load package `regex-posix` … unknown symbol ‘regerror’”
问题描述
对于一个新项目,我一直在尝试构建 threepenny-gui
包,这是我过去做过很多次的事情,没有遇到任何麻烦.但是,这一次,我遇到了一条异常的错误消息:
For a new project, I have been trying to build the threepenny-gui
package, something which I have done many times in the past without any trouble. This time however, I ran into an unusual error message:
> 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
现在,快速的Google显示该错误消息 曾在2010年出现过,此后已通过GHC更新对其进行了修复.我尝试更改GHC版本(上面的输出是GHC 8.8.4的结果),但它在8.8.3或8.8.2中均不起作用.我也尝试删除 regex-posix
¹并再次重新安装,但这也没有用.在这一点上,我必须承认这个错误完全困扰了我.其他人不知道可能是什么原因吗?如果是,我该如何解决?
Now, a quick Google shows that this error message has been seen before — in 2010, after which it was fixed with a GHC update. I tried changing GHC versions (that output above was with GHC 8.8.4), but it didn’t work with 8.8.3 or 8.8.2 either. I also tried deleting regex-posix
¹ and reinstalling it again, but that didn’t work either. At this point, I must confess that this error has completely stumped me; does anyone else have any idea what might be causing it, and if so, how can I fix it?
¹具体来说,我删除了 C:\ sr \ snapshots \ 14724cfd \ lib \ x86_64-windows-ghc-8.8.4 \ regex-posix-0.96.0.0-11M5Q2Uki3ACYikP2WXOuq
和 C:\ sr \ snapshots \ 14724cfd \ pkgdb \ regex-posix-0.96.0.0-11M5Q2Uki3ACYikP2WXOuq.conf
,并且 ghc-pkg取消了regex-posix
的注册.
¹ Specifically, I removed C:\sr\snapshots\14724cfd\lib\x86_64-windows-ghc-8.8.4\regex-posix-0.96.0.0-11M5Q2Uki3ACYikP2WXOuq
and C:\sr\snapshots\14724cfd\pkgdb\regex-posix-0.96.0.0-11M5Q2Uki3ACYikP2WXOuq.conf
, and did ghc-pkg unregister regex-posix
.
推荐答案
此原来是 regex-posix
中的问题,而不是 threepenny-gui
中的问题.可以通过启用Cabal标志 _regex-posix-clib
来解决此问题.要进行设置,我首先需要注销 regex-posix
的先前版本:
This turned out to be a problem in regex-posix
rather than threepenny-gui
. This issue could be fixed by enabling the Cabal flag _regex-posix-clib
. To set it, I first needed to unregister the previous version of regex-posix
:
> stack --resolver lts-16.23 exec -- ghc-pkg unregister regex-posix-0.96.0.0 --force
然后我需要使用正确的标志对其进行重建:
I then needed to rebuild it with the correct flag:
> stack build regex-posix-0.96.0.0 --flag regex-posix:_regex-posix-clib --resolver lts-16.23
此后, stack生成threepenny-gui --resolver lts-16.23
成功.(由于某些原因,我需要在这些命令中明确指定解析器.)
After which stack build threepenny-gui --resolver lts-16.23
was successful. (For some reason, I needed to specify the resolver explicitly in these commands.)
这篇关于“无法加载软件包"regex-posix"……未知符号"regerror""的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!