Pacman 更新后损坏的 XMonad(依赖项)(如何使用 Stack 编译它?)

Broken XMonad (Dependencies) after Pacman Update (How to compile it with Stack?)

This question is the distilled solution of what others have helped me solved. The discussion can be found on this issue and this r/xmonad post.

我主要使用 Artix 和 Pacman 作为包管理器。今天,大约一个星期后,我升级了很多包,最终破坏了 XMonad。

这是我从xmonad --recompile -v收到的消息:

XMonad is recompiling and replacing itself another XMonad process because the current process is called "xmonad" but the compiled configuration should be called "xmonad-x86_64-linux"
XMonad will use ghc to recompile, because "/home/philippe/.xmonad/build" does not exist.
XMonad skipping recompile because it is not forced (e.g. via --recompile), and neither xmonad.hs nor any *.hs / *.lhs / *.hsc files in lib/ have been changed.
/home/philippe/.xmonad/xmonad-x86_64-linux: error while loading shared libraries: libHSxmonad-contrib-0.16-KKfUmtIonstICqbgIKQKYh-ghc8.10.4.so: cannot open shared object file: No such file or directory

我已经尝试了很多人们在互联网上提到的解决方案 — 到目前为止,我已经花了 3 个多小时来调试它 — 其中,值得注意的是:

有没有人知道如何解决这个问题?我以前在升级 XMonad 时遇到过问题,但从来没有遇到过类似的问题——我喜欢 Haskell 作为一种语言,但它的包管理是我在我10多年的编程生涯。

如果我最终清理我的系统并通过 Stack 管理一切,我如何通过它编译 XMonad?仅使用 Stack 然后 xmonad --recompile 给我这个错误:

XMonad will use ghc to recompile, because "/home/philippe/.xmonad/build" does not exist.
xmonad: ghc: runProcess: runInteractiveProcess: exec: inappropriate type (Not a directory)

(顺便说一句,我有一个 ~/.xmonad/build/ 文件夹...)

我终于成功了。 XMonad 存储库中的人员确实提供了帮助,您可以在 this issue.

中查看他们的帮助

粗略地说,我所做的是:

  1. 从我的系统中删除所有 Haskell 相关的内容。
    • 认真做这个,用很多findhaskellstack , ghc, cabal, 等不要忘记使用 pacman -Rnspacman -Q 来卸载所有来自先到这里。
    • 正如其他一些用户所提到的,您绝对应该而不是管理同时包含Pacman/AUR和Stack/Cabal的Haskell包。选择一个系统并坚持下去。堆栈可能是推荐的。
  2. 直接使用 script on its documentation 安装 Stack。
  3. 通过 Stack 安装 GHC、XMonad 和 XMonad-Contrib。
  4. 创建一个 build script 用于使用 Stack 编译 XMonad:
    #!/bin/sh
    
    exec stack ghc --  \
      --make xmonad.hs \
      -i               \
      -ilib            \
      -fforce-recomp   \
      -main-is main    \
      -v0              \
      -o ""jk
    
  5. exec $HOME/.xmonad/xmonad-x86_64-linux 添加到 .xinitrc 以便它运行之前使用 Stack 编译的内容。