0

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.

I'm using Artix mainly with Pacman as a package manager. Today, after about a week, I've upgraded many packages and it ended up breaking XMonad.

This is the message I get from 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

I've tried a ton of solutions people mentioned on the internet — so far I've spent more than 3 hours trying to debug this —, among them, notably:

  • cabal install --lib xmonad-contrib, which had solved some issues I've had with XMonad in the past.
  • Removing and reinstalling Stack, GHC, Cabal, and XMonad itself.
  • Installing XMonad through Stack.
    • This ended up giving me the same error message, the difference is that I had to execute ~/.local/bin/xmonad --recompile -v instead.

Does anyone have an idea of how to solve this? I've had problems with upgrades of XMonad before, but never anything close to this — I love Haskell as a language, but its package management is one of the most disgusting, overcomplicated pieces of software I've ever experienced in my 10+ years of programming life.

If I end up cleaning up my system and managing everything through Stack, how do I compile XMonad through it? Using only Stack and then xmonad --recompile is giving me this error:

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

(I do have an ~/.xmonad/build/ folder by the way...)

Philippe Fanaro
  • 6,148
  • 6
  • 38
  • 76

1 Answers1

0

I've finally made it work. The guys from the XMonad repo really helped, you can check out their help in this issue.

Roughly, what I did was:

  1. Delete everything Haskell-related from my system.
    • Do this one carefully, use a lot of finds with the words haskell, stack, ghc, cabal, etc. Don't forget to use pacman -Rns and pacman -Q to uninstall everything that come from there first.
    • As some other users mentioned, you should absolutely not manage Haskell packages with both Pacman/AUR and Stack/Cabal. Choose one system and stick to it. Stack is probably the recommended one.
  2. Install Stack directly with the script on its documentation.
  3. Install GHC, XMonad, and XMonad-Contrib through Stack.
  4. Create a build script for compiling XMonad with Stack:
    #!/bin/sh
    
    exec stack ghc --  \
      --make xmonad.hs \
      -i               \
      -ilib            \
      -fforce-recomp   \
      -main-is main    \
      -v0              \
      -o "$1"jk
    
  5. Add exec $HOME/.xmonad/xmonad-x86_64-linux to .xinitrc so it runs what was compiled with Stack previously.
Philippe Fanaro
  • 6,148
  • 6
  • 38
  • 76