[英]On Windows, packages installed with cabal seem to be unavailable in ghc/ghci
我在相当标准的 Windows 10 x64 系统上运行最新版本的 Haskell Platform 8.6.3。
现在我在我的智慧尽头从 Hackage 安装软件包以可靠地工作。 将我的问题归因于本地配置问题,我已经采取了所有步骤,而没有破坏我的 Windows 安装。 我已经卸载并重新安装了 Hackage,重新启动,在任何隐藏目录或其他方式中搜索了我能找到的每个最后一个配置文件,删除了显然与 Haskell 相关的每个注册表项,其中大多数都多次删除,但都无济于事:
使用 cabal 安装的软件包在 ghci、WinGHCI 下似乎不可用,要么在 ghci 下与 (:m) 交互加载,要么在 WinGHCI 下使用 ghc 编译时,无论我做什么。
下面是一些症状。 有什么建议?
#cabal new-update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
cabal new-update 'hackage.haskell.org,2019-04-02T19:24:19Z'
#cabal new-install --lib vector
Resolving dependencies...
Up to date
#ghci
Prelude> :m Data.Vector
<no location info>: error:
Could not find module ‘Data.Vector’
Perhaps you meant Data.Functor (from base-4.12.0.0)
#ghc -O -optc-O3 -funfolding-use-threshold=16 -fexcess-precision -Wall -Wno-type-defaults -Wno-unused-imports -Wno-unused-top-binds -rtsopts "P663.hs"
[1 of 1] Compiling Main ( P663.hs, P663.o )
P663.hs:54:1: error:
Could not find module ‘Data.Vector.Unboxed’
Use -v to see a list of the files searched for.
|
54 | import Data.Vector.Unboxed (Vector, (!)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#ghc-pkg list
C:\Program Files\Haskell Platform\8.6.3\lib\package.conf.d
Cabal-2.4.0.1
Win32-2.6.1.0
array-0.5.3.0
base-4.12.0.0
binary-0.8.6.0
bytestring-0.10.8.2
containers-0.6.0.1
deepseq-1.4.4.0
directory-1.3.3.0
filepath-1.4.2.1
(ghc-8.6.3)
ghc-boot-8.6.3
ghc-boot-th-8.6.3
ghc-compact-0.1.0.0
ghc-heap-8.6.3
ghc-prim-0.5.3
ghci-8.6.3
haskeline-0.7.4.3
hpc-0.6.0.3
hscolour-1.24.4
integer-gmp-1.0.2.0
libiserv-8.6.3
mtl-2.2.2
parsec-3.1.13.0
pretty-1.1.3.6
process-1.6.3.0
rts-1.0
stm-2.5.0.0
template-haskell-2.14.0.0
text-1.2.3.1
time-1.8.0.2
transformers-0.5.5.0
xhtml-3000.2.2.1
#ghc-pkg list --user-package-db=C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db
C:\Program Files\Haskell Platform\8.6.3\lib\package.conf.d
Cabal-2.4.0.1
Win32-2.6.1.0
array-0.5.3.0
base-4.12.0.0
binary-0.8.6.0
bytestring-0.10.8.2
containers-0.6.0.1
deepseq-1.4.4.0
directory-1.3.3.0
filepath-1.4.2.1
(ghc-8.6.3)
ghc-boot-8.6.3
ghc-boot-th-8.6.3
ghc-compact-0.1.0.0
ghc-heap-8.6.3
ghc-prim-0.5.3
ghci-8.6.3
haskeline-0.7.4.3
hpc-0.6.0.3
hscolour-1.24.4
integer-gmp-1.0.2.0
libiserv-8.6.3
mtl-2.2.2
parsec-3.1.13.0
pretty-1.1.3.6
process-1.6.3.0
rts-1.0
stm-2.5.0.0
template-haskell-2.14.0.0
text-1.2.3.1
time-1.8.0.2
transformers-0.5.5.0
xhtml-3000.2.2.1
C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db
primitive-0.6.4.0
vector-0.12.0.2
#set GHC_PACKAGE_PATH=C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db;
#ghc-pkg list
C:\Program Files\Haskell Platform\8.6.3\lib\package.conf.d
Cabal-2.4.0.1
Win32-2.6.1.0
array-0.5.3.0
base-4.12.0.0
binary-0.8.6.0
bytestring-0.10.8.2
containers-0.6.0.1
deepseq-1.4.4.0
directory-1.3.3.0
filepath-1.4.2.1
(ghc-8.6.3)
ghc-boot-8.6.3
ghc-boot-th-8.6.3
ghc-compact-0.1.0.0
ghc-heap-8.6.3
ghc-prim-0.5.3
ghci-8.6.3
haskeline-0.7.4.3
hpc-0.6.0.3
hscolour-1.24.4
integer-gmp-1.0.2.0
libiserv-8.6.3
mtl-2.2.2
parsec-3.1.13.0
pretty-1.1.3.6
process-1.6.3.0
rts-1.0
stm-2.5.0.0
template-haskell-2.14.0.0
text-1.2.3.1
time-1.8.0.2
transformers-0.5.5.0
xhtml-3000.2.2.1
C:\Users\Carl\AppData\Roaming\ghc\x86_64-mingw32-8.6.3\package.conf.d
(no packages)
C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db
primitive-0.6.4.0
vector-0.12.0.2
# ghci
GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help
Prelude> :m Data.Vector
Prelude Data.Vector> toList $ empty
Access violation in generated code when reading 0xffffffffffffffff
Attempting to reconstruct a stack trace...
Frame Code address
* 0x7e5dd90 0x3d7d618 C:\Program Files\Haskell Platform\8.6.3\bin\ghc.exe+0x397d618
所以看起来你通过设置GHC_PACKAGE_PATH
解决了你的问题,对吗? 您可能希望提交有关此的错误。
第二个问题,运行时“读取时生成的代码中的访问冲突”错误似乎记录在此处:
https://github.com/commercialhaskell/stack/issues/3765
https://gitlab.haskell.org/ghc/ghc/issues/13112
据说将-fexternal-interpreter
传递给 ghci 是一种解决方法。 您可能需要手动编辑ghc
/ ghci
shim 脚本,以确保在修复错误之前始终传递该标志。
感谢所有的回应。 我已经尝试过在 VirtualBox 下的某些版本的 UN*X 上运行 ghc 并卸载 Haskell Platform 并在 Windows 10 x64 下完全使用堆栈。
两者似乎都避免了我上面列出的许多问题,但 Windows 下的堆栈似乎更轻量级,并且与我喜欢的编辑器(Sublime Text 和 Visual Studio Code)更好地集成,所以这就是我现在要做的。
同时,非常感谢 Haskell 平台人员和 WinGHCI 的作者所做的所有伟大的免费工作,我不能敦促任何阅读本文的人远离它,尤其是 Windows 下的 8.6.3 版,至少在情况大为改善之前。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.