LLVM tutorial OCaml Compilation Assembler Error

断了今生、忘了曾经 提交于 2019-12-25 07:22:04

问题


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?


回答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.



来源:https://stackoverflow.com/questions/37038709/llvm-tutorial-ocaml-compilation-assembler-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!