Search code examples
haskellghchaskell-platformeclipse-fp

EclipseFP is searching for GHC and cannot find it


I have working Eclipse (Kepler Service Release 2) + EclipseFP (2.6.0) + Haskell Platform under Windows 8.1 x64. In one moment after some cabal install, EclipseFP stopped working and showing me:

The program ghc version >=6.4 is required but it could not be found.

I have:

  1. Uninstalled Haskell Platform
  2. Deleted C:\Users\myuser\AppData\Roaming\cabal*
  3. Deleted C:\Program Files (x86)\Haskell*
  4. Install Haskell Platform 2013.2
  5. Run Eclipse with my Haskell workspace
  6. Try to build my project
  7. It gave me this error about ghc and cannot build it.

EclipseFP configuration found all Haskell Helper executables. It found Cabal 1.16.0.2 and GHC 7.6.3 already. From command-line GHC and cabal are found and are working. "cabal build" is working on the project from command-line, too.

This message doesn't say almost anything! If I could see the path it is searching for GHC or where it get this path from...

EDIT: Message from buildwrapper:

"C:\Users\home\AppData\Roaming\cabal\bin\buildwrapper.exe synchronize --force=false --tempfolder=.dist-buildwrapper --cabalpath=C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe --cabalfile=D:\Project\haskell2\SomeGL\SomeGL.cabal --cabalflags= --logcabal=true
configuring because setup_config not present
"C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe" "configure" "--verbose=1" "--user" "--enable-tests" "--enable-benchmarks" "--builddir=D:\Project\haskell2\SomeGL.dist-buildwrapper\dist" cabal.exe: The program ghc version >=6.4 is required but it could not be found."

Calling exactly the last line from cmd.exe (as normal non-admin user) everything is working fine:

"C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe" "configure" "--verbose=1" "--user" "--enable-tests" "--enable-benchmarks" "--builddir=D:\Project\haskell2\SomeGL\.dist-buildwrapper\dist"

EDIT: To find the potential path environement that is used I tried to run GHCi console inside Eclipse and tried:

import System.Environment
x <- getEnvironment
filter (\ (a,_) -> a == "Path") x

and got something that is starting with:

[("Path","C:\Program Files (x86)\Haskell\bin;C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin;C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin;...")]

First folder is invalid, but Haskell Platform is valid and working. Another thing I found. One of times I have run "Build All" command there was run Process in Eclipse with GHC and the path was:

Running executable C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin\ghc.exe

I went to see this process details and it is run from the same user that is currently Eclipse run with. And the path is correct, but I still got the error:

The program ghc version >=6.4 is required but it could not be found.

Running from command-line still it is working. The program has errors, but only in command-line I see them.

Could someone help with finding this problem?

EDIT: I found some interesting issue. Running "Build All" command is executing this command:

C:\Users\myuser\AppData\Roaming\cabal\bin\buildwrapper.exe synchronize --force=false --tempfolder=.dist-buildwrapper --cabalpath=C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe --cabalfile=D:\haskell\SomeGL\SomeGL.cabal --cabalflags= --logcabal=true

Which run from command-line gives an error. The problem is that there are no quotes around cabalpath, because it has spaces in it. When I run it that way from command-line it works:

C:\Users\myuser\AppData\Roaming\cabal\bin\buildwrapper.exe synchronize --force=false --tempfolder=.dist-buildwrapper --cabalpath="C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe" --cabalfile=D:\haskell\SomeGL\SomeGL.cabal --cabalflags= --logcabal=true

I think that all "--cabalfile" parameters should have quotes, because paths could have spaces in them. I still don't know if this is the problem under Eclipse.


Solution

  • I found the problem!

    It is that EclipseFP 2.6.0 is using upper case "PATH" variable, but my Windows 8.1 use "Path" and programatically some kind it is possible to have valid two variables "PATH" and "Path" when executing BuildWrapper and Cabal. So something is messing up.

    Workaround for this problem is if you rename from Control Panel | System | Environment variables for both User and System from "Path" to "PATH".

    I hope this could be fixed in EclipseFP so it could in future work in any case.