Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005208OCamlOCamlbuild (the tool)public2011-01-20 17:362013-08-13 17:25
Reporterdbuenzli 
Assigned Toxclerc 
PrioritynormalSeverityminorReproducibilityalways
StatusfeedbackResolutionopen 
PlatformOSOS Version
Product Version3.12.0 
Target VersionlaterFixed in Version 
Summary0005208: cmo -> cma rule brings too much dependencies in
DescriptionWhen ocamlbuild builds a cma from a cmo it brings too much deps in the cma. For example :

> cd /tmp
> echo "let f x = x + 1" > a.ml
> echo "let f x = A.f x" > b.ml
> ocamlbuild -classic-display b.cma
/usr/local/bin/ocamldep.opt -modules b.ml > b.ml.depends
/usr/local/bin/ocamldep.opt -modules a.ml > a.ml.depends
/usr/local/bin/ocamlc.opt -c -o a.cmo a.ml
/usr/local/bin/ocamlc.opt -c -o b.cmo b.ml
/usr/local/bin/ocamlc.opt -a a.cmo b.cmo -o b.cma

However I expected only b.cmo in that cma for the following reason :

> ocamlbuild -classic-display b.cmxs
/usr/local/bin/ocamlopt.opt -shared b.cmx -o b.cmxs

Since cma are the pendant of cmxs for dynamically loaded plugins I expect them to build the same way w.r.t. dependencies. And for plugins you don't want automatically these dependencies since it's likely to be the plugin api itself which will be in the program loading the plugin.

Best,

Daniel
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005787)
ertai (developer)
2011-01-20 20:32

If you want to manually choose the list of modules which goes into the library then I suggest you the use of .mllib files.

The rule from .cmo to .cma takes the transitive closure of its dependencies by default.

HTH
(0005788)
dbuenzli (reporter)
2011-01-20 20:40

I understand that but I think that's not what you want in practice and it's inconsistant with the rule for .cmx -> .cmxs.
(0008115)
doligez (administrator)
2012-09-19 15:00

But it's consistent for the rule for .cmx -> .cmxa.

The problem is that .cma is the pendant of both .cmxa and .cmxs and ocamlbuild cannot know whether you are going to dynlink that .cma or link it normally.
(0010173)
gasche (developer)
2013-08-13 17:25

We could consider adding a .shared.cma target that would use the same semantics as .cmxs. (For symmetry it would make sense to name it .cms, but the OCaml compiler will not accept archive files with that extension.)

- Issue History
Date Modified Username Field Change
2011-01-20 17:36 dbuenzli New Issue
2011-01-20 20:32 ertai Note Added: 0005787
2011-01-20 20:40 dbuenzli Note Added: 0005788
2011-01-21 14:25 doligez Status new => acknowledged
2011-06-06 13:01 xclerc Status acknowledged => assigned
2011-06-06 13:01 xclerc Assigned To => xclerc
2012-02-02 15:17 protz Category OCamlbuild => OCamlbuild (the tool)
2012-07-10 17:16 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 15:00 doligez Note Added: 0008115
2012-09-19 15:00 doligez Status assigned => feedback
2012-09-19 15:00 doligez Target Version 4.00.1+dev => later
2013-08-13 17:25 gasche Note Added: 0010173


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker