可能只是 PICNIC 的一个大问题,但当我尝试安装 Xmonad 时,出现错误提示
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.)
Locations searched:
XMonad.hs
XMonad.lhs
XMonad.hsig
XMonad.lhsig
我该如何消除这些错误?我是否忘记了任何步骤?等等。
我通过以下方式安装了 Haskell 和 Xmonad:
ghcup install
ghcup set
ghcup install-cabal
cabal new-update
cabal new-install cabal-install
cabal new-install xmonad
cabal new-install xmonad-contrib --lib
# Other possibly relevant info
ghc-pkg list # does not show xmonad or -contrib
ghc --version # 8.6.3
cabal --version # 2.4.1.0
xmonad --version # 0.15
答案1
不确定这是否会对您有所帮助,但是当我尝试在 OS X 上重新编译 xmonad 时,我收到了类似的错误:
$ xmonad --recompile
XMonad will use ghc to recompile, because "/Users/scifisamurai/.xmonad/build" does not exist.
Error detected while loading xmonad configuration file: /Users/scifisamurai/.xmonad/xmonad.hs
Loaded package environment from /Users/scifisamurai/.ghc/x86_64-darwin-8.6.5/environments/default
xmonad.hs:10: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 to see a list of the files searched for.
|
10 | import XMonad
| ^^^^^^^^^^^^^
xmonad.hs:20:1: error:
Could not load module ‘XMonad.StackSet’
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 to see a list of the files searched for.
|
20 | import qualified XMonad.StackSet as W
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Please check the file for errors.
我运行的是 cabal 3.0.0 版本。不过,我也在使用 new-install。
对我来说,解决方法是在安装命令中添加 --lib ,如此处所述(尽管他们只是使用cabal install
而不是cabal new-install
):
https://github.com/xmonad/xmonad/issues/199#issue-490757289
LIBRARY_PATH=/opt/X11/lib:$LIBRARY_PATH cabal new-install --lib xmonad xmonad-contrib
然后尝试再次重新编译:
$ xmonad --recompile
XMonad will use ghc to recompile, because "/Users/scifisamurai/.xmonad/build" does not exist.
XMonad recompilation process exited with success!
希望这对某人有帮助。
附注:
- 我也没有在 的输出中看到 xmonad 或 xmonad-contrib
ghc-pkg list
。这里有一些有用的信息:https://github.com/haskell/cabal/issues/6262#issuecomment-541124411这解释了为什么会发生这种情况,并在 package.db 中寻找对我有用的库:
$ ghc-pkg list -f ~/.cabal/store/ghc-8.6.5/package.db|egrep 'X11|xmonad'
X11-1.9.1
xmonad-0.15
xmonad-contrib-0.16
- 我在上面命令中设置了 LIBRARY_PATH,因为当我前一段时间尝试构建 xmonad 时,X11 无法在 OS X 上构建,并且这是按照以下步骤修复的:https://github.com/xmonad/X11/issues/24#issuecomment-47996753
它可能不再需要了。
在我的 Arch Linux VM 中,我使用 pacman 安装 xmonad,这样就不会出现上述问题。如果您使用的是 Linux,我认为可以使用包管理器以类似的方式安装它。话虽如此,cabal 应该可以工作...