Reputation: 426
$ dune build ./src/main.exe --profile=release
ocamlc src/.main.eobjs/byte/ast.{cmi,cmo,cmt} (exit 2)
(cd _build/default && /usr/bin/ocamlc.opt -w -40 -O3 -g -bin-annot -I src/.main.eobjs/byte -I /home/jackprograms/.opam/default/lib/cairo2 -I /home/jackprograms/.opam/default/lib/lablgtk3 -I /usr/lib/ocaml/threads -no-alias-deps -o src/.main.eobjs/byte/ast.cmo -c -impl src/ast.ml)
/usr/bin/ocamlc.opt: unknown option '-O3'.
I ran this, and dune is using ocamlc bytecode... I am using exe
which means native, as I saw on the dune documentation. Why is it running ocamlc when it should be running ocamlopt?
(executable
(name main)
(libraries lablgtk3)
(modes exe))
(ocamllex
(modules lexer))
(ocamlyacc
(modules parser))
(env
(dev
(flags (:standard -w +42)))
(release
(flags (:standard -O3))))
^ In src
directory
Upvotes: 0
Views: 577
Reputation: 426
It will still use ocamlc
to compile .cmi
files.
Instead of using flags
(e.g. (flags (:standard -O3))
), use ocamlopt_flags
.
(executable
(name main)
(libraries lablgtk3)
(modes exe))
(ocamllex
(modules lexer))
(ocamlyacc
(modules parser))
(env
(dev
(flags (:standard -w +42)))
(release
(ocamlopt_flags (:standard -O3))))
Upvotes: 1