2011-06-16 89 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