Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007080OCamlcompiler driverpublic2015-12-09 10:232018-07-05 07:37
Assigned To 
PlatformOSOS Version
Product Version4.02.3 
Target VersionFixed in Version 
Summary0007080: ocamlc/ocamlopt better support for precise builds
DescriptionIt would be nice to be able to specify cmi and cmx files directly on the command line when compiling with -c rather than using -I includes which can be too coarse and lead to subtle (non)rebuild errors in incremental build systems. This should go in pair with an option not to include the current directory in the search path.

TagsNo tags attached.
Attached Files

- Relationships
related to 0005624acknowledged Some dependencies cannot be detected by ocamldep 
has duplicate 0007475closed Allow to specify cmi files on the command line of ocamlc and ocamlopt 

-  Notes
frisch (developer)
2015-12-09 13:48

I think this is a good direction, but it will quickly illustrate that ocamldep does not return an over approximation of actual dependencies, so your build system will have trouble passing all the required .cmi files (or it needs to pass the full transitive closure of dependencies, but this can get big). This is documented in: [^]
dbuenzli (reporter)
2017-02-07 16:31

@frisch I was more thinking this for expressing dependencies over the files of packages whose usage is declared not discovered.

Note that an alternative/companion idea would be to record all the files that were actually accessed *and used* in the generated cmt[i] files. Though one might argue that the digests already somehow record this, except in cmo files if I'm not mistaken.

(sorry Xavier about the dupe)
lpw25 (developer)
2017-02-07 18:21

The cmo file should contain an accurate account of what was accessed in the digests (that's why I added support for listing imports without their digest).

As for the proposal: I hope to add something similar as part of my namespacing proposal. Although since the number of files passed via `-I` can easily be huge (beyond the number of allowed command-line params on some systems IIRC) it will use a text file listing the desired files (i.e. `-I dependencies.txt`). It will also give explicitly the mapping between names and files rather than relying on the basename of the cmi file, which helps when the namespace becomes hierarchical (as it does in my proposal).

Adding something before my proposal is ready might be a good idea, but I would ask that it try to be forwards compatible with what I have in mind.
dbuenzli (reporter)
2017-02-07 18:24
edited on: 2017-02-07 18:30

@lpw25 maybe there's something I'm missing but doesn't the cmo file contain digests of the interfaces (i.e. cmi file) of the cmo ? However cmos with different digests can implement the same cmi digest no ?

dbuenzli (reporter)
2017-02-07 18:36

Silly me there's no notion of imported implementation in cmo files.
shindere (manager)
2017-02-24 16:02

For .cmi files I think I can understand what you are looking for, but I don't understand why you mention .cmx files and not .cmo files.
Also, could you mention a concrete example where this feature would be helpful?
Finally, do you think the files to use should just be mentionned on the command-line or should they be preceeded by a flag?
frisch (developer)
2017-02-24 16:45

"ocamlc -c" will never load bar.cmo implicitly. "ocamlopt -c" might load "bar.cmx" and "bar.cmi". I think the idea here is to be fully explicit.
dbuenzli (reporter)
2017-02-24 17:28

Yes that's what Alain says.

The notion of include requires build system to record negative information (there was no `bar.cmi` in the `-I inc` directory.

Also when we actually do have the precise path information it is silly to unprecise it to a `-I` option so that the toolchain redoes the lookup itself.

- Issue History
Date Modified Username Field Change
2015-12-09 10:23 dbuenzli New Issue
2015-12-09 13:48 frisch Note Added: 0015077
2015-12-09 13:48 frisch Relationship added related to 0005624
2017-02-06 20:03 xleroy Relationship added has duplicate 0007475
2017-02-07 16:31 dbuenzli Note Added: 0017236
2017-02-07 18:21 lpw25 Note Added: 0017238
2017-02-07 18:24 dbuenzli Note Added: 0017240
2017-02-07 18:30 dbuenzli Note Edited: 0017240 View Revisions
2017-02-07 18:36 dbuenzli Note Added: 0017241
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-02-24 16:02 shindere Note Added: 0017450
2017-02-24 16:02 shindere Status new => feedback
2017-02-24 16:45 frisch Note Added: 0017465
2017-02-24 17:28 dbuenzli Note Added: 0017471
2017-02-24 17:28 dbuenzli Status feedback => new
2017-02-28 16:59 doligez Priority normal => high
2017-02-28 16:59 doligez Status new => acknowledged
2017-02-28 16:59 doligez Category -OCaml general => compiler driver

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker