Stream: Coq devs & plugin devs

Topic: structure of opam 'lib' dir


view this post on Zulip Gregg Reynolds (Apr 16 2021 at 19:27):

I'm working on a build tool that analyzes the opam lib dir (e.g. ~/.opam/4.09/0/lib). Most of the subdirs there contain (mostly) compiled code - cmx, cma, etc. But some of them contain source code; for example, zarith contains an .mli file for each cm file, pluszarith.h. The ocaml subdir contains a lot of source code.

My understanding is that the .mli files are needed because they play a role in resolution of module refs. But what about the .ml files? Why are they there? Can I safely ignore them?

view this post on Zulip Gregg Reynolds (Apr 16 2021 at 19:32):

A followup question. Some of the subdirs contain .cmt and/or .cmti files. The tool I'm developing is only for compiling/linking. My understanding is that such files play no role in compile/link, so I can safely ignore them. Is that correct?

view this post on Zulip Guillaume Claret (Apr 16 2021 at 20:02):

Gregg Reynolds said:

A followup question. Some of the subdirs contain .cmt and/or .cmti files. The tool I'm developing is only for compiling/linking. My understanding is that such files play no role in compile/link, so I can safely ignore them. Is that correct?

This answer seems to agree with you: https://stackoverflow.com/questions/53218683/whats-use-of-cmt-file-in-ocaml

view this post on Zulip Gregg Reynolds (Apr 16 2021 at 22:25):

great, thanks.

view this post on Zulip Emilio Jesús Gallego Arias (Apr 17 2021 at 15:36):

Hi @Gregg Reynolds , indeed I think that .ml and .cmt files are meant for developing, so for example jump-to-definition works correctly from editors, etc... Dune-based projects for example will install them, but this is not true of other build systems.

I am not sure what the current "official" policy is regarding installing these files, I guess people over https://discuss.ocaml.org/ may know more than us.


Last updated: Oct 13 2024 at 01:02 UTC