Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Haskell] ghc-mod: No such file or directory #1718

Closed
zsparal opened this issue May 25, 2015 · 8 comments
Closed

[Haskell] ghc-mod: No such file or directory #1718

zsparal opened this issue May 25, 2015 · 8 comments

Comments

@zsparal
Copy link

zsparal commented May 25, 2015

After enabling contrib/lang/haskell it refuses to acknowledge that I have ghc-mod installed. ~/.cabal/bin is added to PATH:

$ env | grep PATH
PATH=/home/gustorn/.cabal/bin:/home/gustorn/.local/bin: [rest of PATH]

My .spacemacs file (.el extension added for syntax highlighting): .spacemacs (I already tried with flyspell not excluded)

The actual error:

Initializing...
"ghc-mod" not found
File mode specification error: (file-error "Searching for program" "no such file or directory" "ghc-mod")
Spacemacs is up to date.

:company-ghc-diagnose

* company-ghc backend found: company-ghc
* automatic scan module is enabled
* ghc-boot process has not been done

Module                                  Alias               Candidates
-------------------------------------------------------------------------------
Prelude   

Using :!ghc-mod inside emacs finds the executable just fine.

OS: Linux
Emacs: GNU Emacs 24.5.1

@codygman
Copy link

What does which ghc-mod give you inside of an eshell?

@zsparal
Copy link
Author

zsparal commented May 26, 2015

It doesn't find it:

which: no ghc-mod in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/share/java/gradle/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)

So I'm guessing this line: (add-to-list 'exec-path "~/.cabal/bin/") is either at the wrong place or is just plain wrong. I'm fairly new to emacs, so I apologize if the solution is really obvious for more experienced people.

@syl20bnr
Copy link
Owner

You can inspect the value of the variable with SPC h d exec-path RET.

@tuhdo
Copy link
Contributor

tuhdo commented May 26, 2015

It should be SPC h d v exec-path RET.

@zsparal
Copy link
Author

zsparal commented May 26, 2015

Alright, I solved the problem: exec-path was not picked up from the dotspacemacs/init function; adding the same line to dotspacemacs/config solved the problem, which means either something isn't quite working right in spacemacs, or if this is the intended behaviour, then the Haskell layer readme should be updated (or it's completely possible that the error is on my end, even though this is a completely fresh install).

@syl20bnr
Copy link
Owner

dotspacemacs/init is exectued before the initialization of the layers. Possibly somewhere in the layers exec-path is overwritten (could be also in a package but it less likely).
dotspacemacs/config is executed after the initialization of the layers.

@zsparal
Copy link
Author

zsparal commented May 27, 2015

I get that, but here's a quote from the Haskell layer readme:

"or [add this path] to the Emacs exec-path variable in the dotspacemacs/init function of your .spacemacs file:"

This doesn't work, while adding it to dotspacemacs/config works just fine.

@luhkevin
Copy link

Gustorn -- thank you for this fix! But not for the Haskell layer. I was setting up gtags as per the instructions here: https://github.com/syl20bnr/spacemacs/tree/master/contrib/gtags

When I tried to use helm-gtags, or invoke any of the installed programs such as gtags or global, spacemacs would say that there was "no such file or directory"

So I added "/usr/bin" -- where global is installed -- to the "exec-path" and helm-gtags worked.

I looked at the path with SPC h d v exec-path RET., and it is definitely not the same as the PATH variable in my shell....in fact it only includes:
("/usr/bin" "%s/" "/usr/lib/emacs/24.5/x86_64-unknown-linux-gnu/")

Is this supposed to happen? Or is spacemacs doing something funny?

d12frosted pushed a commit to d12frosted/spacemacs that referenced this issue Oct 7, 2015
- update section about setting up PATH by updating value of
  =exec-path= (previously it was saying to update it in =user-init=
  function, but looks like you need to do it in =user-config=) -
  following syl20bnr#1718
- add FAQ section
  - add note about setting up =stack-ghci= as =haskell-process= (as
  noted in syl20bnr#2142)
  - add note about fixing problems with =ghc-mod= and =stack=
  - add note about fixing stuck REPL (following syl20bnr#3271)
TheBB pushed a commit that referenced this issue Oct 7, 2015
- update section about setting up PATH by updating value of
  =exec-path= (previously it was saying to update it in =user-init=
  function, but looks like you need to do it in =user-config=) -
  following #1718
- add FAQ section
  - add note about setting up =stack-ghci= as =haskell-process= (as
  noted in #2142)
  - add note about fixing problems with =ghc-mod= and =stack=
  - add note about fixing stuck REPL (following #3271)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants