无法在 Voidlinux 上正确运行 XMonad

无法在 Voidlinux 上正确运行 XMonad

它可以运行,但是每次我都会收到这个错误

$ cabal install xmonad xmonad-contrib
Resolving dependencies...
Up to date
Symlinking 'xmonad'

$ cat ~/.xinitrc
exec ~/.cabal/bin/xmonad

$ cat ~/.xmonad/xmonad.hs 
import XMonad

main = do
  xmonad $ defaultConfig

$ ~/.cabal/bin/xmonad 
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/d/.xmonad/build" does not exist.
XMonad doing recompile because some files have changed.
Error detected while loading xmonad configuration file: /home/d/.xmonad/xmonad.hs
Loaded package environment from /home/d/.ghc/x86_64-linux-8.8.3/environments/default

xmonad.hs:1:1: error:
    Could not load module ‘XMonad’
    It is a member of the hidden package ‘xmonad-0.15’.
    You can run ‘:set -package xmonad’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
1 | import XMonad
  | ^^^^^^^^^^^^^

Please check the file for errors.

/home/d/.xmonad/xmonad-x86_64-linux: executeFile: does not exist (No such file or directory)
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  2 (X_ChangeWindowAttributes)
  Serial number of failed request:  7
  Current serial number in output stream:  8

答案1

我遇到了同样的问题,偶然发现了一个有效的解决方案。希望它能有所帮助。

“我们可以手动为 ghc-pkg 指定一个包数据库,这样它就能找到我们的 cabal 模块:

$ ghc-pkg --package-db ~/.cabal/store/ghc-8.8.3/package.db 列表... xmonad-0.15 xmonad-contrib-0.16...

为了使其永久生效,我们可以将 package.db 文件符号链接为 ghc 配置:

$ mkdir -p ~/.ghc/x86_64-linux-8.8.3/ $ ln -s ~/.cabal/store/ghc-8.8.3/package.db ~/.ghc/x86_64-linux-8.8.3/package.conf.d

文件夹 x86_64-linux-8.8.3 的名称可能不同,这个对我有用。

现在 ghc-pkg 列表应该可以找到 xmonad,而使用 ghc 进行编译应该可以找到我们丢失的 cabal 模块。”

相关内容