haskell - ghc-pkg:无法打开数据库进行修改:hLock:无效参数

标签 haskell windows-subsystem-for-linux pandoc haskell-stack ghc-pkg

我正在尝试编译 behead.hs Ubuntu 20.04 (WSL1) 上 pandoc 教程中的脚本。
我可以成功地编译它stack exec -- ghc behead.hs或者stack --resolver lts-16.25 exec -- ghc behead.hs但使用 pandoc-types-1.20我需要pandoc-types-1.22所以我尝试stack --resolver nightly-2020-12-07 exec -- ghc behead.hs(最早的夜间功能 pandoc-types-1.222020-09-20 ,失败并出现与以下相同的错误)
这产生:

Preparing to install GHC (tinfo6) to an isolated location.
This will not interfere with any system-level installation.
Already downloaded.
ghc-pkg: Couldn't open database /home/me/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2/lib/ghc-8.10.2/package.conf.d for modification: {handle: /home/me/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2/lib/ghc-8.10.2/package.conf.d/package.cache.lock}: hLock: invalid argument (Invalid argument)
make[1]: *** [ghc.mk:973: install_packages] Error 1
make: *** [Makefile:51: install] Error 2
Received ExitFailure 2 when running
Raw command: /usr/bin/make install
Run from: /home/me/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2.temp/ghc-8.10.2/


Error: Error encountered while installing GHC with
         make install
         run in /home/me/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2.temp/ghc-8.10.2/

       The following directories may now contain files, but won't be used by stack:
         - /home/me/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2.temp/
         - /home/me/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2/

       For more information consider rerunning with --verbose flag

Installing GHC ...
--verbose我在这里粘贴太多了,但我很高兴提供 grep 结果。可能相关的摘录:
#the WSL doesn't seem to get recognized as ubuntu
[debug] checking build system type... x86_64-pc-linux-gnu
2020-12-08 11:40:58.363496: [debug] checking host system type... x86_64-pc-linux-gnu
2020-12-08 11:40:58.363926: [debug] checking target system type... x86_64-pc-linux-gnu
2020-12-08 11:40:58.364331: [debug] Build platform inferred as: x86_64-unknown-linux
2020-12-08 11:40:58.412992: [debug] Host platform inferred as: x86_64-unknown-linux
2020-12-08 11:40:58.463758: [debug] Target platform inferred as: x86_64-unknown-linux
2020-12-08 11:40:58.715901: [debug] GHC build  : x86_64-unknown-linux
2020-12-08 11:40:58.716483: [debug] GHC host   : x86_64-unknown-linux
2020-12-08 11:40:58.717018: [debug] GHC target : x86_64-unknown-linux
2020-12-08 11:40:58.717558: [debug] LLVM target: x86_64-unknown-linux
#the last lines before the error:
[debug] Installing library in /home/me/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2/lib/ghc-8.10.2/ghc-8.10.2
[debug] "/home/me/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2/lib/ghc-8.10.2/bin/ghc-pkg" --force --global-package-db "/home/me/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.2/lib/ghc-8.10.2/package.conf.d" update rts/dist/package.conf.install
我目前无法在实际的 linux 机器上重现它,以查看我使用 WSL 的事实是否与问题相关。我可以在〜6小时内尝试。
复制文件:
#!/usr/bin/env runhaskell
-- behead.hs
import Text.Pandoc.JSON

main :: IO ()
main = toJSONFilter behead

behead :: Block -> Block
behead (Header n _ xs) | n >= 2 = Para [Emph xs]
我想了解为什么会发生这种情况,但更重要的是如何使用 pandoc-types-1.22 编译脚本.

最佳答案

我在 WSL 上也遇到了同样的问题,并通过升级 Ubuntu 发行版以使用 WSL2 解决了这个问题。 https://docs.microsoft.com/en-us/windows/wsl/install-win10

关于haskell - ghc-pkg:无法打开数据库进行修改:hLock:无效参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65197507/

相关文章:

css - 如何转换 Markdown + CSS -> PDF?

pandoc - 更改 pandoc 中的 markdown 强调符号?

r - R 中类似 Tableau 的 Markdown 分组表

Haskell 非二叉树

haskell - 类型类实例的可发现性 - 如何搜索?

haskell - 如何设置使用 Stack 构建的 Haskell 项目的可执行输出位置?

windows-subsystem-for-linux - 从 WSL2 恢复到 WSL1

haskell - 每个重复嵌套的单子(monad)有用吗?

windows - Powershell 获取 Windows 中显示的区分大小写的路径

python - WSL 2 : Pycharm debugger connection time out