繁体   English   中英

对ocaml编译器的代码进行修改后链接时出错

[英]Error while linking after modifications on ocaml compiler's code

我正在调整OCaml(当前trunk分支)的源代码,以将一些类型信息转储到json 我需要做的第一件事是获取type_expr的内存类型数据结构。 与OCaml的官方顶级Printtyp.tree_of_type_scheme exp.exp_type ,它使用Printtyp.tree_of_type_scheme exp.exp_type来获取文件toplevel/toploop.mlhttps://github.com/ocaml/ocaml/blob/ trunk / toplevel / toploop.ml#L252 )。

当我尝试以最简单的形式在typing/printtyped.ml中使用Printtyp

let tree_of_type_expr (typ : Types.type_expr) =
  Printtyp.tree_of_type_scheme typ
;;

该构建失败说它找不到Printtyp 这是日志:

boot/ocamlrun boot/ocamlc -nostdlib -I boot  -compat-32 -o ocamlc \
   compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma driver/main.cmo
File "_none_", line 1:
Error: Error while linking compilerlibs/ocamlcommon.cma(Printtyped):
Reference to undefined global `Printtyp'

所以我想知道我是否错过了一些使用Printtyp东西。 谢谢。

也许您忘记更新.depend文件,以便在订购要编译的文件时考虑到新的依赖关系。 对模块进行任何修改后,都必须进行make depend

编辑:
链接顺序直接在makefile中定义,仅取决于确保文件以正确的顺序编译。

因此,您需要挖掘Makefile并重新排列两个文件之间的顺序,在github上当前主干中,这将是第57和58行(对于以后的人,在TYPING的定义中)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM