Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004943OCamlOCamlbuild (the tool)public2009-12-17 15:372017-02-20 10:56
Assigned Toxclerc 
PlatformOSOS Version
Product Version3.11.1 
Target VersionFixed in Version 
Summary0004943: ocaml_lib is not specific enough with tags, leading to highly confusing error message
DescriptionConsider this ocaml_lib code (in :

    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" ?
Additional Information$ cat _tags
true: use_str

$ cat
let x = Str.regexp "a"

$ cat q.mllib

$ 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.
Attached Files

- Relationships
related to 0004958acknowledgedxclerc negative flags 

-  Notes
ygrek (reporter)
2009-12-17 15:43

Looks like more link targets should be considered : "output_obj" and "toplevel"
xleroy (administrator)
2017-02-20 10:56

Un-assigning from xclerc

- Issue History
Date Modified Username Field Change
2009-12-17 15:37 ygrek New Issue
2009-12-17 15:43 ygrek Note Added: 0005196
2010-01-07 16:25 doligez Status new => acknowledged
2010-04-18 14:40 xleroy Relationship added related to 0004958
2010-04-18 14:40 xleroy Status acknowledged => assigned
2010-04-18 14:40 xleroy Assigned To => ertai
2010-07-22 11:43 ertai Assigned To ertai => xclerc
2012-02-02 15:17 protz Category OCamlbuild => OCamlbuild (the tool)
2013-07-28 22:26 gasche Tag Attached: junior_job
2017-02-20 10:56 xleroy Status assigned => acknowledged
2017-02-20 10:56 xleroy Note Added: 0017371

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker