New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.cmo files are generated even for native compilation #5282
Comments
Comment author: ertai We acknowledge this is a limitation. However this is not a bug, it is a design choice with a simple and recommendable workaround. Indeed you observe this behavior only because you have no .mli for this file. There is technical reasons to not accept .cmi to be generated by both ocamlc and ocamlopt. So we impose them to be always generated by ocamlc. If you have a .mli then you see no drawbacks of this method. In short we recommend you the good practice of having .mli files. |
Comment author: goswin "There is technical reasons to not accept .cmi to be generated by both ocamlc and ocamlopt." So for the sake of documenting this what are those reasons? |
Comment author: @glondu What about having a command (or command-line option to an existing one) generating only the .cmi (and not .cmo) for a .ml file? |
Comment author: @xavierleroy Un-assigning from xclerc |
Comment author: @damiendoligez This PR was marked "no change required" by @Ertai in 2011... |
Original bug ID: 5282
Reporter: Camarade_Tux
Status: resolved (set by @damiendoligez on 2017-02-27T13:03:56Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 3.12.0
Target version: later
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Duplicate of: #4613
Related to: #4991
Monitored by: mehdi @ygrek @glondu @jberdine @hcarty @Chris00
Bug description
When compiling native targets, ocamlbuild also compiles .cmo files.
Example on an empty folder:
% touch a.ml
% ocamlbuild -classic-display a.native
/opt/ocaml/bin/ocamldep.opt -modules a.ml > a.ml.depends
/opt/ocaml/bin/ocamlc.opt -c -o a.cmo a.ml # calls ocamlc.opt
/opt/ocaml/bin/ocamlopt.opt -c -o a.cmx a.ml
/opt/ocaml/bin/ocamlopt.opt a.cmx -o a.native
With many more complex files, this can lead to a substantial slow-down.
The text was updated successfully, but these errors were encountered: