有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

用Ocaml编写的Java编译器的“链接时出错”

我发现了一个用Ocaml编写的sourceJava编译器,它应该可以工作

但是当我执行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”文件。有人能帮忙吗?多谢各位


共 (1) 个答案

  1. # 1 楼答案

    caml_startup是OCaml运行时的一部分

    该项目的网站提到它使用OCAML3.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"