简体   繁体   中英

Ocamlbuild can't find Ocamlbuild_js_of_ocaml cmx file

I'm starting an web development project and was hoping to use Js_of_ocaml. However, when attempting to use OCamlbuild as my build tool, I've encountered the following error:

Warning 58: no cmx file was found in path for module Ocamlbuild_js_of_ocaml, and its interface was not compiled with -opaque

My Makefile is as follows:

.SUFFIXES: .ml .mli .byte .js
OFLAGS= -use-ocamlfind \
        -plugin-tag 'package(js_of_ocaml.ocamlbuild)'
%.js:
    ocamlbuild $(OFLAGS) $<

clean:
    ocamlbuild -clean
    find . -iname *.js -delete
    rm -rf build

My myocamlplugin.ml file contains the text from the documentation:

let _ = Ocamlbuild_plugin.dispatch Ocamlbuild_js_of_ocaml.dispatcher

Finally, I'm trying to compile a minimal test file:

open Js;;
let rec fact = function
  | 0 -> 1
  | n -> n * (fact (n - 1));;

print_int (fact 10);;

If it helps, I'm on Arch Linux running OCaml 4.03.0 and ocamlbuild 0.9.3 .
Thanks in advance!

This is a warning, not an error, and you can safely ignore it.

It is here to tell you that the compiler might miss optimizations (since it needs .cmx to do inlining) ... but you really don't care about optimizations for the ocamlbuild plugin, so it's fine.

You can put a bug report on js_of_ocaml's bugtracker, though. .cmx files should be installed for everything. ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM