0

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

OCaml-Kaleidoscope\Chapter3

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

mkdir 'C:\Users\setup\Compiler\llvm\examples\OCaml-Kaleidoscope\Chapter3\_build'
''ocamlopt.opt unix.cmxa -I 'C:\OCaml\lib\ocamlbuild' 'C:\OCaml\lib\ocamlbuild/ocamlbuildlib.cmxa' myocamlbuild.ml 'C:\OCaml\lib\ocamlbuild/ocamlbuild.cmx' -o myocamlbuild.exe
'x86_64-w64-mingw32-as' is not recognized as an internal or external command,
operable program or batch file.
File "myocamlbuild.ml", line 1:
Error: Assembler error, input left in file C:\cygwin64\tmp\camlasmc2c035.s
Exit code 2 while executing this command:
''ocamlopt.opt unix.cmxa -I 'C:\OCaml\lib\ocamlbuild' 'C:\OCaml\lib\ocamlbuild/ocamlbuildlib.cmxa' myocamlbuild.ml 'C:\OCaml\lib\ocamlbuild/ocamlbuild.cmx' -o myocamlbuild.exe

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

1

Read the error message carefully. It says:

'x86_64-w64-mingw32-as' is not recognized as an internal or external command, operable program or batch file.

So you do not install x86_64-w64-mingw32-as, a Cygwin cross assembler for MinGW64.

If you are not familiar with resolving this kind of problems by yourself, I strongly discourage using Cygwin OCaml nor MinGW OCaml, since you will face a lot of them. Using Linux (probably on a virtual environment like VirtualBox or Vmware) is the smoothest way to play with OCaml+LLVM.

camlspotter
  • 8,990
  • 23
  • 27