[opam-devel] A few questions debugging packages & opam

David Allsopp dra-news at metastack.com
Wed Nov 4 08:45:22 GMT 2015

Thank you (and Thomas, also!). It looks like --verbose/-vv is the main thing I missed - but I like the idea in https://github.com/ocaml/opam/issues/2133 - if I'm seeing it a lot, I may pick it up and do it :o)

> -----Original Message-----
> From: opam-devel [mailto:opam-devel-bounces at lists.ocaml.org] On Behalf Of
> Louis Gesbert
> Sent: 04 November 2015 01:47
> To: opam-devel at lists.ocaml.org
> Subject: Re: [opam-devel] A few questions debugging packages & opam
> > Some quick fire answers to these few questions from an opam expert or
> > two would be very much appreciated, please :o)
> Sure, thanks a lot for your efforts!
> > 1. Are there any circumstances in which opam (re)install -b deletes
> > the build directory?
> >
> > I'm fairly sure that while doing an opam reinstall which crashed (i.e.
> > opam suffered an exception) during the install bit that the handler
> > deleted the build directory, despite -b being specified.
> >
> > If opam really did delete the build directory in this instance, is
> > that a bug? (in which case I'll add it to my ToDo list)
> `--keep-build-dir` disables the removal of the build dir that normally
> takes place _after_ a build only. Currently, every new build will still
> start from a fresh dir, wiping any old one. This doesn't seem to be your
> case though, so, probably a bug -- I would say an exception handler that
> doesn't properly check keep_build. I'll have a look.
> > 2. What's the correct set of flags to keep and obtain as much
> > information as possible for debugging package building?
> >
> > -b gives me the build directory. Is the only way to get the
> > .{env,info,out,err} files kept to specify --debug?
> At the moment, yes -- granted, that's a bit weird. Feel free to suggest
> improvements on that, I debug opam itself a lot but am much less
> confronted with debugging packages, so the tools there might be a bit
> lacking.
> > 3. Is there a tool or better way to view the output of each command
> (i.e.
> > the aforementioned files) than going through the .info files to find
> > the right one and then looking at the appropriate other file?
> There are several ways, none of which may be perfect yet:
> * `--verbose` will display each command and its output (as it is run if
> there is only one running, when it finished when running in parallel). `--
> debug` is more focused on debugging opam's internals, but also triggers
> keeping of log files, which is weird.
> * in recent builds, the `--json` option will output a json file that
> includes the output of all failed commands. You may try the experimental
> script at [1] to make it into a browsable html page (sample output at
> [2]). The json doesn't, at the moment, include the output of commands that
> didn't fail, though, so when a sequence failed you will only get the last
> command.
> * see also the proposal at [3]
> > Would it be appreciated if opam were patched to give the files a
> > canonical order (i.e. so that ls displays the log files in the order
> > they were executed)?
> That definitely sounds like an improvement.
> > 4. When changing opam source files which are part of the .cmxa/.cma
> > libraries (e.g. opam-core, opam-format), I'm frequently forced to do
> > make clean; make all as otherwise I get "inconsistent assumption"
> > errors over .cmx implementation (I'm building with 4.02.2).
> >
> > Is that affecting anyone else, or is there something weird going on
> > with the Windows Makefile dependencies that I should look into?
> The OCamlMakefile build is the one maintained officially, but it is for
> compatibility and bootstrap, and it's awful at usage. I always build using
> `make fast` when developing, which relies on ocp-build. It's better for my
> nerves ;)
> Hope this helps, and thanks for the feedback!
> Louis
> [1]: https://github.com/OCamlPro/flambda-task-
> force/blob/master/scripts/opamjson2html.ml
> [2]: http://flambda.ocamlpro.com/bench/operf/2015-11-02-1100-b8eec032-
> 5e86a310/build.html
> [3]: https://github.com/ocaml/opam/issues/2133
> _______________________________________________
> opam-devel mailing list
> opam-devel at lists.ocaml.org
> http://lists.ocaml.org/listinfo/opam-devel

More information about the opam-devel mailing list