由于 GHC 版本较新,无法重新编译 xmonad

由于 GHC 版本较新,无法重新编译 xmonad

我在运行时收到此消息xmonad --recompile

xmonad.hs:10:8:
    Could not find module ‘XMonad’
    Perhaps you meant
      Monad (needs flag -package haskell98-2.0.0.3)
      DsMonad (needs flag -package ghc-7.8.4)
    Use -v to see a list of the files searched for.

xmonad.hs:14:18:
    Could not find module ‘XMonad.StackSet’
    Use -v to see a list of the files searched for.

Please check the file for errors.

嗯,确实如此,当我运行 时ghc xmonad.hs~/.xmonad但消息是相同的,只是这个不会为某些字符提供奇怪的输出。现在我怀疑问题出在我当前的 GHC 版本上,我认为它与我上次运行 时不同xmonad --recompile

答案1

前段时间我通过源代码安装了 GHC 7.8.4 - 我需要比我能用 apt-get 获得的更新的版本。我还安装了 GHC 版本 7.4.3 或类似的版本,这似乎阴影我的较新的 GHC。所以我使用 apt-get 卸载了该版本。所以问题可能在于该命令xmonad --recompile试图使用该ghc命令,而现在它是较新的 GHC?我以前曾使用 GHC 重新编译我的配置文件,当时我可能使用了apt-get已安装的 GHC。

让我们尝试看看如果我安装 xmonad 会发生什么。

my-machine:~$ sudo apt-get remove xmonad
[...]
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 2,654 kB disk space will be freed.
Do you want to continue [Y/n]? y

仅需删除~2.5 MB。

现在让我们尝试重新安装。

my-machine:~$ sudo apt-get install xmonad
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
ghc ghc-doc ghc-haddock libghc-mtl-dev libghc-mtl-doc libghc-random-dev libghc-syb-dev libghc-transformers-dev libghc-transformers-doc libghc-utf8-string-dev libghc-x11-dev
libghc-x11-doc libghc-x11-xft-dev libghc-x11-xft-doc libghc-xmonad-contrib-dev libghc-xmonad-contrib-doc libghc-xmonad-dev libghc-xmonad-doc
Suggested packages:
ghc-prof haskell-doc llvm-3.0 libghc-mtl-prof libghc-random-doc libghc-random-prof libghc-syb-doc libghc-syb-prof libghc-transformers-prof libghc-utf8-string-doc
libghc-utf8-string-prof libghc-x11-prof libghc-x11-xft-prof libghc-xmonad-contrib-prof libghc-xmonad-prof
The following NEW packages will be installed:
ghc ghc-doc ghc-haddock libghc-mtl-dev libghc-mtl-doc libghc-random-dev libghc-syb-dev libghc-transformers-dev libghc-transformers-doc libghc-utf8-string-dev libghc-x11-dev
libghc-x11-doc libghc-x11-xft-dev libghc-x11-xft-doc libghc-xmonad-contrib-dev libghc-xmonad-contrib-doc libghc-xmonad-dev libghc-xmonad-doc xmonad
0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/66.2 MB of archives.
After this operation, 428 MB of additional disk space will be used.
Do you want to continue [Y/n]? y

有很多*ghc*依赖项,并且需要 428 MB,而卸载 xmonad 时仅释放约 2.5 MB。

现在ghc指向由 apt-get 安装的 ghc,如 runnnig 所示ghc --version

The Glorious Glasgow Haskell Compilation System, version 7.4.1

现在xmonad --recompile可以工作了。

相关内容