OcaIDE doesn't see JoCaml tools
I'm having a problem while using OcaIDE in ocamlbuild mode. I'm trying to compile my own JoCaml sources. According to the JoCaml manual (bottom of page), to use ocamlbuild with JoCaml, I just need to add the -use-jocaml
argument to ocamlbuild. Indeed, if I go to the root of my project and write
ocamlbuild -use-jocaml foo.native
it generates my executable just fine.
However, in OcaI开发者_如何转开发DE I get
/bin/sh: jocamldep: command not found
In OcaIDE, the -use-jocaml
flag is passed in the "Other Flags" box (in Project Properties). And that certainly is working, as the complaint is precisely that it doesn't find jocaml stuff. The puzzling thing is that jocaml is installed and can be accessed from any random terminal window. For example, running
jocamldep -modules foo.ml > foo.ml.depends
on my project does generate the desired dependency file.
So, it would seem I would have to configure OcaIDE and tell it where JoCaml executables are or something. This is done for OCaml, for example. But there is no place to do that for JoCaml. And it's really strange that, if jocamldep/jocamlc/etc are all accessible from anywhere, OcaIDE wouldn't be able to pick them.
Any ideas?
(I am aware I can do an ocamlbuild plugin and pass the flag in a "myocamlbuild.ml" file. I'll probably use that a latter stage after I get familiar with ocamlbuild plugins. But here the question is about OcaIDE. EDIT: Actually, ocamlbuild plugins don't seem to be a solution as, although there is an option -use-jocaml
in ocamlbuild to enforce jocaml use (and it works fine), the plugin system doesn't support it, i.e. use_jocaml (or something involving jocaml) is not in the list of options.)
When you start a build on an ocamlbuild project, OcaIDE calls:
ocaml.exec.ExecHelper#execMerge
which creates a new java.lang.ProcessBuilder
, and uses its default environment (ProcessBuilder#environment()
).
To help debug your problem, please run the following Java program in your Eclipse:
public static void main(String[] args) {
Map<String, String> environment = new ProcessBuilder().environment();
for (Entry<String, String> entry : environment.entrySet()) {
if ("path".equalsIgnoreCase(entry.getKey())) {
System.out.println("PATH = " + entry.getValue());
}
}
}
It should display the same path that is passed to OcamlBuild.
You could also import the OcaIDE plug-in source in your workspace and run it in debug mode, with a breakpoint in ocaml.exec.ExecHelper#execMerge
to see how ocamlbuild is called.
You could try to create a shell script to start Eclipse with the correct path:
Something like startEclipse.sh
(located in the same folder as the eclipse executable):
#!/bin/bash
export PATH=<your path to JoCaml>:$PATH
./eclipse
精彩评论