Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005185OCamlOCamlbuild (the tool)public2010-11-30 09:232013-06-17 15:59
Reporterygrek 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version3.12.0 
Target Version4.02.0+devFixed in Version 
Summary0005185: creates incomplete cma under some circumstances
DescriptionConsider the following mllib:
X Q Y
Create in the current directory empty files x.ml and y.ml AND q.mli
Under normal circumstances ocamlbuild will notice missing implementation of Q module and build fails.
But if the name of the mllib file matches the name of one of the modules inside it - build succeeds with incomplete cma - e.g. with y.mllib we get:

$ PATH=/opt/ocaml-3.12.0/bin:$PATH ocamlbuild -classic-display y.cma
/opt/ocaml-3.12.0/bin/ocamldep.opt -modules x.ml > x.ml.depends
/opt/ocaml-3.12.0/bin/ocamldep.opt -modules q.mli > q.mli.depends
/opt/ocaml-3.12.0/bin/ocamlc.opt -c -o q.cmi q.mli
/opt/ocaml-3.12.0/bin/ocamldep.opt -modules y.ml > y.ml.depends
/opt/ocaml-3.12.0/bin/ocamlc.opt -c -o x.cmo x.ml
/opt/ocaml-3.12.0/bin/ocamlc.opt -c -o y.cmo y.ml
/opt/ocaml-3.12.0/bin/ocamlc.opt -a y.cmo -o y.cma
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005722)
ertai (developer)
2010-11-30 09:32

Can you provide us with the dependencies between these modules?
(0005723)
ygrek (reporter)
2010-11-30 10:19

No dependencies (files can be simply empty) :
$ touch x.ml y.ml q.mli
$ echo X Q Y > y.mllib
$ ocamlbuild -classic-display y.cma
/usr/bin/ocamldep.opt -modules x.ml > x.ml.depends
/usr/bin/ocamldep.opt -modules q.mli > q.mli.depends
/usr/bin/ocamlc.opt -c -o q.cmi q.mli
/usr/bin/ocamldep.opt -modules y.ml > y.ml.depends
/usr/bin/ocamlc.opt -c -o x.cmo x.ml
/usr/bin/ocamlc.opt -c -o y.cmo y.ml
/usr/bin/ocamlc.opt -a y.cmo -o y.cma
(0005724)
ertai (developer)
2010-11-30 10:32

OK, got it I think it makes not much sense to call the library the same name as a module given the two rules:

  .mllib -> .cma
  .cmo (and its deps) -> .cma

I would suggest you to change one of the names.
(0005725)
ygrek (reporter)
2010-11-30 11:13

Hm, I have several libraries where cma name matches the name of one of source files. I don't think it is a good option to enforce such constrain, especially as it works ok usually. Moreover if ocamlbuild starts making arbitrary limitations on naming of modules it will become less and less useful. This bug itself is not critical at all - the problem gets noticed and missing implementation is added - but it leads to confusion. All in all I think this should be considered as a bug and not an incorrect usage - cause it is a common pattern in libraries (name of the module equal to the name of the library).

- Issue History
Date Modified Username Field Change
2010-11-30 09:23 ygrek New Issue
2010-11-30 09:32 ertai Note Added: 0005722
2010-11-30 10:19 ygrek Note Added: 0005723
2010-11-30 10:32 ertai Note Added: 0005724
2010-11-30 10:48 xclerc Status new => assigned
2010-11-30 10:48 xclerc Assigned To => xclerc
2010-11-30 11:13 ygrek Note Added: 0005725
2012-02-02 15:17 protz Category OCamlbuild => OCamlbuild (the tool)
2012-07-10 17:31 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-19 14:22 doligez Target Version 4.00.1+dev => 4.01.0+dev
2013-06-17 15:59 gasche Assigned To xclerc =>
2013-06-17 15:59 gasche Status assigned => acknowledged
2013-06-17 15:59 gasche Target Version 4.01.0+dev => 4.02.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker