我正在尝试在Ubuntu20.04 (WSL1)上编译pandoc教程中的behead.hs脚本。我可以用以下命令成功编译它:
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
(最早的夜间功能是2020-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编译脚本。
发布于 2021-02-14 09:24:55
我也在WSL上遇到了同样的问题,通过升级Ubuntu发行版来使用WSL2解决了这个问题。https://docs.microsoft.com/en-us/windows/wsl/install-win10
https://stackoverflow.com/questions/65197507
复制相似问题