2013-03-29 55 views
5

在我的cygwin機器上安裝了Ocaml,但編譯失敗。通過下面的交互可以看到權限沒有問題。 OCAMLLIB是對的;哪裏不對?爲什麼無法打開pervasives.cmi?

$ cat t.ml 

print_string "hi"; 

$ ocamlopt t.ml 
>> Fatal error: cannot open pervasives.cmi 
Fatal error: exception Misc.Fatal_error 

$ echo $OCAMLLIB 
/cygdrive/c/OCaml/lib 

$ ls -l /cygdrive/c/OCaml/lib/pervasives.cmi 
-rwxrwxrwx+ 1 Lyn None 15094 Oct 8 01:30 /cygdrive/c/OCaml/lib/pervasives.cmi 

回答

6

一個可能的解決方案是在Cygwin中運行以下命令:

export OCAMLLIB=C:\\OCaml\\lib 

線索從這個message thread來了。

+0

yes確實在cmd shell下運行正常,但是這裏是來自這裏的ocaml的cygwin版本:http://protz.github.com/ocaml-installer/ –

+0

我發現這個[message thread](http:/ /lists.gforge.inria.fr/pipermail/frama-c-discuss/2009-December/001653.html),可能會提供關於如何設置OCAMLLIB環境變量的有用提示。 –

+0

輝煌!把它放在你的答案中,我會接受:export OCAMLLIB = C:\\ OCaml \\ lib –

相關問題