You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.
The dependency of b.cmi is listed as a.cmo, which is true if you're byte compiling. However, what if you only want to compile to native code, this introduces a wrong dependency, and surely ocamlopt would only expect a.cmx to previously be compiled.
Now we see that it does produce a.cmx correctly. (Strangely it still prints out lines for .cmos even though the documentation for -native says specifically "(no .cmo files)".)
The logically correct dependency for b.cmi is "a.cmo or a.cmx".
The text was updated successfully, but these errors were encountered:
If I follow your last remark, it means there is no correct way to handle the problem: you don't want the -native option when you're byte-compiling only, right? Also, it seems to me that while the dependency is indeed wrong, it still permits a correct (only suboptimal) compilation.
it still permits a correct (only suboptimal) compilation
Right. I guess the .cmi gets regenerated when it is not strictly necessary to do so. I haven't tested the affect on total compilation time, which isn't much concern to me since during development I almost always do byte compilation only.
If I follow your last remark, it means there is no correct way to handle the problem
I can think of a couple of solutions (which are probably not worth implementing):
Provide a way to specify if byte and/or native compilation are being requested, e.g. by defining an environment variable. Inspect these variables and adjust the rules that get registered accordingly:
If either byte or native mode are requested, but not both, then add a rule to build the .cmi.
If both byte and native are requested, be sure to add this rule only once.
Maybe a dynamic rule would work. The action that is registered could itself check if the .cmi already exists and is out of date, build the .cmi only if necessary.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Now, run ocamldep:
The dependency of
b.cmi
is listed asa.cmo
, which is true if you're byte compiling. However, what if you only want to compile to native code, this introduces a wrong dependency, and surely ocamlopt would only expecta.cmx
to previously be compiled.So could use the
-native
option:Now we see that it does produce
a.cmx
correctly. (Strangely it still prints out lines for.cmo
s even though the documentation for-native
says specifically "(no .cmo files)".)The logically correct dependency for
b.cmi
is "a.cmo or a.cmx".The text was updated successfully, but these errors were encountered: