DanielG / ghc-mod

Happy Haskell Hacking for editors. DEPRECATED
Other
677 stars 175 forks source link

emacs hangs with "initializing" when opening haskell file for first time #923

Closed thkoch2001 closed 6 years ago

thkoch2001 commented 6 years ago

I evaluated (setq ghc-debug t). After load a haskell file and interrupting with CTRL-g the GHC Debug buffer says:

% ghc-mod root
/home/thk/git/hspgtest
% boot
ghc-mod: Could not find $libexecdir/cabal-helper-wrapper

If you are a developer set the environment variable
`cabal_helper_libexecdir' to override $libexecdir[1]. The following will
work in the cabal-helper source tree:

    $ export cabal_helper_libexecdir=$PWD/dist/build/cabal-helper-wrapper

[1]: /usr/lib/x86_64-linux-ghc-8.0.2/cabal-helper-0.7.3.0

If you don't know what I'm talking about something went wrong with your
installation. Please report this problem here:

    https://github.com/DanielG/cabal-helper/issues
ghc-mod: thread blocked indefinitely in an MVar operation
% check /home/thk/git/hspgtest/src/Main.hs
ghc-mod: Could not find $libexecdir/cabal-helper-wrapper

If you are a developer set the environment variable
`cabal_helper_libexecdir' to override $libexecdir[1]. The following will
work in the cabal-helper source tree:

    $ export cabal_helper_libexecdir=$PWD/dist/build/cabal-helper-wrapper

[1]: /usr/lib/x86_64-linux-ghc-8.0.2/cabal-helper-0.7.3.0

If you don't know what I'm talking about something went wrong with your
installation. Please report this problem here:

    https://github.com/DanielG/cabal-helper/issues
ghc-mod: thread blocked indefinitely in an MVar operation

ghc-mod and ghc-mod-el are debian version 5.8.0.0-1.

DanielG commented 6 years ago

How did you install ghc-mod? Looks like a distribution installation since the paths point to /usr/lib but I can't say for certain.

thkoch2001 commented 6 years ago

It is the Debian packet ghc-mod together with ghc-mod-el, version 5.8.0.0-1.

DanielG commented 6 years ago

This appears to be a Debian packaging specific issue, I've submitted a patch to fix this there: https://anonscm.debian.org/cgit/pkg-haskell/DHG_packages.git/commit/?id=6e863e89f74cca1087bad96869efe5f4e7155c4f. You can subscribe to the corresponding debian bug (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=878112) to be notified when the fixed version is uploaded.

thkoch2001 commented 6 years ago

Thank you Daniel. However, even after updating to cabal-helper 0.7.3.0-3, which includes the linked patch, I still have the exact same output from ghc-debug.

thkoch2001 commented 6 years ago

I've done export cabal_helper_libexecdir=/usr/lib now before starting emacs and it works. So I have a workaround.

DanielG commented 6 years ago

Fixed in Debian in haskell-cabal-helper 0.7.3.0-3

skalyan91 commented 6 years ago

This is still an issue in Ubuntu 18.04. Adding (shell-command "export cabal_helper_libexecdir=/usr/lib") to the Emacs init file makes it go away, though.

DanielG commented 6 years ago

@skalyan91 I suggest you contact the Ubuntu package maintainer and link them to the patch which fixes this. https://bugs.launchpad.net/ubuntu/+source/cabal-helper/+filebug

Scratch that, looks to me like they pulled in the relevant cabal-helper version already: Ubuntu changelog. Are you sure you have cabal-helper version 0.7.3.0-3 installed?

salva commented 5 years ago

Running Ubuntu 18.04.1 here. Emacs is still hanging at the "Initializing" stage.

$ zcat /usr/share/doc/cabal-helper/changelog.Debian.gz |head
haskell-cabal-helper (0.7.3.0-3) unstable; urgency=medium

  [ Ilias Tsitsimpis ]
  * Change Priority to optional. Since Debian Policy version 4.0.1,
    priority extra has been deprecated.
  * Use the HTTPS form of the copyright-format URL
  * Modify d/watch and Source field in d/copyright to use HTTPS

  [ Daniel Gröber ]
  * Add patch to disable $libexec hacks.  closes: #878112.

Under the hood, ghc-mod is looking for cabal-helper-wrapper in the wrong place, at /usr/lib/x86_64-linux-ghc-8.0.2/cabal-helper-0.7.3.0/cabal-helper-wrapper when actually, it is located at /usr/lib/cabal-helper-wrapper.

DanielG commented 5 years ago

@salva I just did a fresh 18.04 install and cabal-helper itself works just fine (in GHCi). Indeed ghc-mod itself does fail like you describe. Looks like the binary package never got rebuilt after cabal-helper was updated. This is certainly an issue for the Ubuntu package maintainers, please report it: https://launchpad.net/ubuntu/+source/ghc-mod/+bugs.

salva commented 5 years ago

Reported!

https://bugs.launchpad.net/ubuntu/+source/ghc-mod/+bug/1803128