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
Consider this ocaml_lib code (in ocaml_utils.ml) :
if byte then
flag_and_dep ["ocaml"; tag_name; "link"; "byte"] (libpath^".cma");
if native then
flag_and_dep ["ocaml"; tag_name; "link"; "native"] (libpath^".cmxa");
When the final linking target is a program - everything is ok. If it is a library - ocamlc will work, but ocamlopt will refuse to link cmxa into another cmxa, producing highly confusing error message : ...cmxa is not a compilation unit description. Of course, this situation can be avoided by carefully specifying tags like true and not <*.cmxa>: use_lib but this quickly becomes cumbersome in non-trivial projects. So the suggestion is for ocaml_lib to be more specific with tags :
if byte then
flag_and_dep ["ocaml"; tag_name; "link"; "program"; "byte"] (libpath^".cma");
if native then
flag_and_dep ["ocaml"; tag_name; "link"; "program"; "native"] (libpath^".cmxa");
Are those the only link targets : library and program ?
$ cat _tags
true: use_str
$ cat q.ml
let x = Str.regexp "a"
$ cat q.mllib
Q
$ ocamlbuild q.cma
Finished, 3 targets (0 cached) in 00:00:00.
$ ocamlbuild q.cmxa
+ /usr/bin/ocamlopt.opt -a str.cmxa q.cmx -o q.cmxa
File "_none_", line 1, characters 0-1:
Error: /usr/lib/ocaml/str.cmxa
is not a compilation unit description.
Command exited with code 2.
The text was updated successfully, but these errors were encountered:
PR transferred from https://caml.inria.fr/mantis/view.php?id=4943
[original reporter: @ygrek]
Consider this ocaml_lib code (in ocaml_utils.ml) :
When the final linking target is a program - everything is ok. If it is a library - ocamlc will work, but ocamlopt will refuse to link cmxa into another cmxa, producing highly confusing error message :
...cmxa is not a compilation unit description
. Of course, this situation can be avoided by carefully specifying tags liketrue and not <*.cmxa>: use_lib
but this quickly becomes cumbersome in non-trivial projects. So the suggestion is for ocaml_lib to be more specific with tags :Are those the only link targets :
library
andprogram
?The text was updated successfully, but these errors were encountered: