compiler-errors - LLVM教程OCaml编译错误

标签 compiler-errors ocaml llvm ocamlbuild

我一直在研究OCaml的LLVM万花筒教程。在second part of the tutorial上,我已导航至文件夹中的示例代码

OCaml-Kaleidoscope\Chapter2

我在编译时遇到问题
ocamlbuild toy.byte
在cygwin上。这是本教程中要编译的代码。

我得到的错误是
''ocamlc.opt -c -I +camlp4 -pp camlp4of -o parser.cmo parser.ml
File "parser.ml", line 1:
Error: The files C:\OCaml\lib\pervasives.cmi and token.cmi
   make inconsistent assumptions over interface Pervasives
Exit code 2 while executing this command:
  ''ocamlc.opt -c -I +camlp4 -pp camlp4of -o parser.cmo parser.ml

我正在使用this link的llvm版本3.8.0和OCaml的版本4.02.3。

我需要怎么做才能解决此问题?

最佳答案

通常,当您第一次编译项目,然后更新ocaml库(或Ocaml),然后尝试再次编译程序时,会发生这种错误。 (在这里,token.cmi应该之前已经编译过,现在对已更改的库进行一些假设)

为避免此错误,最简单的方法是使用以下命令清理您的工作目录

ocamlbuild -clean

如果您使用的是Ocaml,则可以使用
make clean

如果您有配置的Makefile,或者手动使用类似
rm -rf _build/ *.cmo *.cmi *.cmx *.byte *.opt *.cma 

关于compiler-errors - LLVM教程OCaml编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36991472/

相关文章:

ocaml - 如何在 ppx_deriving 中使用 jbuild 和 ppx_driver

ocaml - Ocaml中的socket onread、onready、onclose事件处理函数

llvm - 如何在LLVM中找到基本 block 的后继ID?

LLVM OPT 不提供优化文件作为输出。

linux - Gnu fortran 编译器写入选项

c++ - 为什么不编译

Windows 支持 Jane Street OCaml Core?

c++ - 带有 clang 的 OpenMP

c++ - 编译和工作的错误静态常量初始化

python-3.x - 示例 Pyspark 程序返回 [WinError 2] 系统找不到文件