0

I have been working through the LLVM Kaleidoscope Tutorial for OCaml. On the second part of the tutorial, I have navigated to the example code in the folder

OCaml-Kaleidoscope\Chapter2

I am encountering an issue when compiling with

ocamlbuild toy.byte

on cygwin. This is the code given in the tutorial to compile.

The error I am getting is

''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

I am using version 3.8.0 of llvm and version 4.02.3 of OCaml from this link.

What do I need to do to fix this?

Makoto
  • 104,088
  • 27
  • 192
  • 230

1 Answers1

0

Usually this kind of error occurs when you have compiled a first time a project, then update an ocaml library (or Ocaml), and then you try to compile your program again. (Here, token.cmi should have been be compiled before, and now make some assumption about the library that has changed)

To avoid this error the simplest way to proceed is to clean your working directory with

ocamlbuild -clean

if you are using Ocaml, you can use

make clean

if you have a configured Makefile, or manually with something like

rm -rf _build/ *.cmo *.cmi *.cmx *.byte *.opt *.cma 
tobiasBora
  • 1,542
  • 14
  • 23