atsky / haskell-idea-plugin

IntelliJ IDEA plugin for Haskell
Apache License 2.0
201 stars 21 forks source link

"ghc not found in PATH. It can cause issues." during start, but ghc is really in PATH #50

Closed oshyshko closed 10 years ago

oshyshko commented 10 years ago

I see "ghc not found in PATH. It can cause issues. [OK]" message when IntelliJ starts.

The thing is that I do have ghc in path, as well as cabal, ghc-mod and ghc-modi.

To check that it's really there, I run Bash inside IntelliJ (Tools > Add new Bash console):

> set | grep PATH
PATH=<it's there>
> ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.3
> ghc-mod
ghc-mod version 4.1.5 compiled by GHC 7.8.3
Usage: ...
> ghc-modi
NG quit
> uname -a
Darwin mars 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

All commands were executed inside INtelliJ via Bash plugin (not in Terminal app)

Also, I am seeing this error message in IntelliJ log:

04:56:05 IOException: Broken pipe: Broken pipe
04:56:06 ghc-modi failed
         NG ghc: readProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

Any idea how to make it work?

talios commented 10 years ago

Generally this sort of error occurs on OSX when you're launching IntelliJ via an icon on the desktop etc. with launches via the system process launcher, which doesn't include your user shell path from you're .profile or '.bashrc` etc.

Launching Idea from the shell usually gets around this, via open /Applications/IntelliJ.app" or via theidea` command line util.

I had similar issues when experimenting with the go-lang plugin not finding the GO_PATH variable.

oshyshko commented 10 years ago

Thanks @talios. Your workaround works perfectly.

talios commented 10 years ago

It would be good if one didn't need to do this 'work around', but at least you can.

psfblair commented 9 years ago

I am still having trouble with this, even with the workaround as described. I am on OS X (10.10 Yosemite), and my ghc is in /Applications/Developer/ghc-7.8.3.app/Contents/bin . The path to this directory is in /etc/launchd.conf, and I've also exported it at the top of a shell script that then calls "open /Applications/Developer/IntelliJ\ IDEA\ 13.app" but to no avail. I have compiled and run a Java class from within the IDE that indicates that at least when running a class the right directory is in the PATH.

I can see from the code that all it's doing is using System.getenv("PATH") and creating a File with that path and with ghc + OS.getExe() which for OS X is an empty string. I've verified that ghc is at that location and that it runs.

I also have the module's SDK set with a home path of /Applications/Developer/ghc-7.8.3.app/Contents/lib/ghc-7.8.3 , which IntelliJ seems to be happy with and which results in no errors.

I can't figure out what to try next.

psfblair commented 9 years ago

It appears that Apple has turned off the reading of the PATH from /etc/launchd.conf and that the setting of the PATH does not propagate through launcher commands like "open".

I made this work on Yosemite with the following shell script:

PATH=/Applications/Developer/ghc-7.8.3.app/Contents/bin::$PATH export PATH /Applications/Developer/IntelliJ\ IDEA\ 13.app/Contents/MacOS/idea

Note this doesn't call "open".

atsky commented 9 years ago

@psfblair, as you can see when you open application it is don't get normal PATH variable. So plugin tries to find ghc in /usr/local/bin. As workound you can create symlink.

atsky commented 9 years ago

@psfblair I've created issue #62 to fix this.