I tried the latest Haskell plugin for Eclipse 3.2.2 on Windows.
I correctly set the path to GHC in the preferences. Running GHCI works. But I can't run GHC. I get the error "Could not locate the project's executable". The "details..." button is disabled, so I can't provide a stack trace. Also if I navigate to the Preferences/Haskell/Compiler page, it says "no compiler", but when going deeper to the GHC compiler page, where I entered the path, it says: "The Glorious Glasgow Haskell Compilation System, version 6.6".
So for some reason, it can't find GHC.
I tried this on 3 different systems, with GHC installed in a different location (path with and without spaces)
from what you describe, it looks as if there is perhaps a misunderstanding of how GHC is used by the plugin. Here's a few words of background:
When you have a Haskell project, the plugin locates the source folder and automatically runs GHC over that source folder whenever you change and save a source file. (This is the typical way Eclipse's Java IDE works too.) That produces three effects:
- if there are compile errors in a source file, problem markers occur in the Problems View and in the editor (as squiggly lines)
- if you have the Compiler Output View visible during that compiling, the GHC output text is shown there
- if the project has a Main module and everything compiles and links, an executable (the 'project executable') is put in the bin/ folder of the project. When you do 'Run as > Haskell application', that project executable is run from the IDE.
In case you are working on a Haskell application (i.e. something with a Main module with an executable as output), that's the typical way to work (at least for me, that's why I implemented it that way :-). If on the other hand you are writing Haskell scripts (i.e. no main function and you run it in GHCi), then the typical procedure usually is something like: edit your source files and then run GHCi over them. Because of the limitations of the Eclipse console that's not really fun, so what I do when working like this is: I edit the file in Eclipse and then do an 'Open with System editor'. .hs files are associated with ghci on my system, so this means that a console window appears and GHCi is run on that file.
That's how it _should_ work ;-) From what you write, I gather that GHC is found correctly by the plugin on your system, because it is found on the preference page, and because GHCi runs ok. (The plugin runs GHCi by invoking ghc --interactive, i.e. it uses the ghc command, not the ghci command.)
>Also if I navigate to the Preferences/Haskell/Compiler page, it says "no compiler",
That's misleading (my fault). The philosophy of Eclipse is that different plugins may contribute different functionality. In this case, I have written a general preference page where plugins with support for different compilers can hook in. Currently there is only one plugin with support for GHC, but one can imagine there will be more, for yhc, nhc etc. In that case, they will all show up there and you can select from the list. 'No compiler' is the option where you choose not to run any compiler from within the plugin.
>I get the error "Could not locate the project's executable".
>The "details..." button is disabled, so I can't provide a stack trace.
To see what happens here, I'd need some more info. What exactly are you trying to do?
Perhaps you have a bunch of sources and try to 'Run > Haskell application'? If so, then the plugin can't find the compiled executable, perhaps because you have no Main module with a main function in it? Or perhaps the source files don't all compile? Or it may of course be a bug. In that case: could you check the file <your-workspace-location>/.metadata/.log if there are any stacktraces in there?
Hope this helps :-)
Thanks && ciao,
Thanks for the great reply.
Indeed, when I save, in my output view I get the text:
[1 of 1] Compiling Main ( Main.hs, L:\Eclipse\HaskellApp1\out/Main.o )
Linking L:\Eclipse\HaskellApp1\bin\theResult.exe ...
So that looks okay. Typing theResult.exe at the command prompt runs my program.
However, I have no "Run As -> Haskell application" menu. In the Run As menu, I do have a GHCI and Hugs.
Unfortunately, the only entry in the .log file is
!ENTRY net.sf.eclipsefp.haskell.core 4 0 2007-06-27 17:17:41.312
!MESSAGE Could not locate the project's executable.
I created a completely new project, performing the same steps, and then the .log file contains
!ENTRY org.eclipse.core.resources 4 2 2007-06-27 17:19:15.312
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
So the NullPointerException might cause the troubles afterwards?
Where do I find the steps to compile Eclipse itself (maybe using IntelliJ or Eclipse itself?). I could then trace into the problem.
(answering in chunks ;-)
>Where do I find the steps to compile Eclipse itself (maybe using IntelliJ or Eclipse itself?). I could then trace into the problem.
There is a source tarball download on the Eclipse download page; or you could check out the sources directly from dev.eclipse.org (I believe the cvs root is /cvs/eclipse). However, I don't think it would be necessary to compile Eclipse itself, it should be enough to debug the EclipseFP plugins. To do that, you can simply open the 'Plugins' view, then right-click all the plugins that start with net.sf.eclipsefp.*, and click 'Import as source project'. If you haven't been developing Eclipse plugins so far, there might be a few concepts to learn, a quick overview is http://www.eclipse.org/articles/Article-PDE-does-plugins/PDE-intro.html
Still better, of course, would be if you check out the latest sources from our Darcs repo, so you could send us a patch in case you find the problem ;-)
>However, I have no "Run As -> Haskell application" menu. In the Run As menu, I do have a GHCI and Hugs.
Well, there should be one on the executable itself, at least in the 'Module Browser' view. (The Module Browser should also show the project executable as a separate tree node.)
I think I remember there was a problem some time ago with these Run as... menu entries, which is fixed meanwhile. Which build were you running? The last release (0.10) or the last nightly build? In case it was the former one, could you try a nightly build from http://eclipsefp.sourceforge.net/download/
Thanks again for the info! Great support
I'm completely new to Eclipse, I do all my regular development using Visual Studio 2005. But I'm looking for a good IDE for Haskell, and tried Visual Haskell for Visual Studio, and I'm now trying the Eclipse FP solution. I mainly miss good completion, good navigation (goto function/constructor definition, find function/constructor references, goto type class, find instances, etc...), good wizards (like "implement instance"), and refactoring support (integrated HARE or more). Currently I use Emacs but I can't get used to it... too...weird.
I'm using EclipseFP 0.10. I will perform a completely new installation of Eclipse, and use the nightly build, to try again.
And you just provided a workaround for my problem: I switched to the module browser, which showed "theResult.exe", and which had a "Run As->Haskell Application". After executing that, the toolbar "Run As" icon now works!!!
I tried the latest nightly build on a clean installation of Eclipse using the links approach, and deleted my old project in the workspace, and created a new project, but still got the same problem. Tthe error log complains about not finding the path to an executable that is from an older deleted project). However, if I delete the old configuration, and then select "theResult.exe" in the bin folder, then the Run button works fine.
It seems that word completion (CTRL+SPACE) only works for Haskell keywords and my own functions, not for functions in the Prelude or other imported modules? Is this correct? Any way to fix this?
java.io.IOException: Cannot run program "L:\Eclipse\HaskellApp2\bin\theResult.exe": CreateProcess error=3, The system cannot find the path specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=3, The system cannot find the path specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 12 more
>It seems that word completion (CTRL+SPACE) only works
>for Haskell keywords and my own functions, not for
>functions in the Prelude or other imported modules?
>Is this correct? Any way to fix this?
It's not so much a question of fixing, but implementing it in the first place ;-)
I think Thiago is working exactly on this, so the best thing would be to ask on the eclipsefp mailing list what the progress is. (I am myself the previous maintainer and the work on current stuff is on Thiago's plate :-)
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.