0

我一直在研究 OCaml 的 LLVM Kaleidoscope 教程。在教程的第三部分,我已经导航到文件夹中的示例代码

OCaml-Kaleidoscope\Chapter3

编译时遇到问题

ocamlbuild toy.byte

在cygwin上。这是教程中给出的编译代码。

我得到的错误是

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

我从这个链接使用 llvm 3.8.0 版和 OCaml 4.02.3 版。

我需要做什么来解决这个问题?

4

1 回答 1

1

仔细阅读错误信息。它说:

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

所以你不要安装x86_64-w64-mingw32-as一个用于 MinGW64 的 Cygwin 交叉汇编器。

如果你不熟悉自己解决这类问题,我强烈反对使用 Cygwin OCaml 或 MinGW OCaml,因为你会遇到很多。使用 Linux(可能在 VirtualBox 或 Vmware 等虚拟环境上)是使用 OCaml+LLVM 最流畅的方式。

于 2016-05-05T01:55:35.553 回答