2011-06-16 88 views
2

我發現在Ocaml中編寫的Java編譯器的source應該工作。「在鏈接過程中出現錯誤」,用Ocaml編寫的Java編譯器

但是當我做make,它完成了一個錯誤:

unzip.o: In function `camlUnzip__59': 
(.data+0x540): undefined reference to `camlzip_deflateEnd' 
unzip.o: In function `camlUnzip__59': 
(.data+0x544): undefined reference to `camlzip_deflate' 
unzip.o: In function `camlUnzip__59': 
(.data+0x548): undefined reference to `camlzip_deflateInit' 
collect2: ld returned 1 exit status 
File "caml_startup", line 1, characters 0-1: 
Error: Error during linking 
make: *** [javacx] Error 2 

奇怪的是,該文件「caml_startup」甚至沒有在文件夾中存在。誰能幫忙?非常感謝你。

+0

爲什麼不聯繫作者? – 2011-06-16 22:18:16

+0

我想首先確定它是否直接,我不能說因爲我不是Ocaml或編譯器的專家... – SoftTimur 2011-06-16 22:20:22

回答

4

caml_startup是OCaml運行時的一部分。

該項目的網站提到,它與OCaml 3.09,這是相當古老的作品。它適用於3.10(它仍然很舊,最新版本是3.12) - 也許它不適用於更新的版本。

不過,作爲第一個猜測,我會嘗試只是從unzip.ml刪除這些定義 - 他們從來不叫,並聲明這是不實際執行(而在unzip.ml其他external例程zlib.c實現)外部例程:

external deflate_init: int -> bool -> stream = "camlzip_deflateInit" 
external deflate: 
    stream -> string -> int -> int -> string -> int -> int -> flush_command 
     -> bool * int * int 
    = "camlzip_deflate_bytecode" "camlzip_deflate" 
external deflate_end: stream -> unit = "camlzip_deflateEnd" 
+0

事實上,'deflate'和朋友被聲明,但既沒有定義也沒有被使用。這可以直到3.10(鏈接器從來沒有找過它們,因爲它們沒有被使用),但3.11堅持鏈接它們,我認爲是因爲它們可能被動態加載的模塊使用。只需刪除聲明就足以用3.11構建'javajx'。 – Gilles 2011-06-18 22:29:46