caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: "Armaël Guéneau" <armael.gueneau@ens-lyon.fr>
Cc: caml users <caml-list@inria.fr>, Gerd Stolpmann <info@gerd-stolpmann.de>
Subject: Re: [Caml-list] OCamldoc plugins & ocamlbuild
Date: Fri, 18 Dec 2015 18:06:37 +0100	[thread overview]
Message-ID: <CAPFanBFoZrMj-HhmQmQPXaVgPzX8wM-mF2xpJ7B5ZDW=uBBYDA@mail.gmail.com> (raw)
In-Reply-To: <567430DC.6020009@ens-lyon.fr>

[-- Attachment #1: Type: text/plain, Size: 2830 bytes --]

So I just tried¹, and the failure is as follows:

$ ocamlbuild -tag use_ocamldoc test.cmxs
+ /home/gasche/.opam/4.02.3/bin/ocamlopt.opt -shared -I +ocamldoc
ocamldoc.cmxa test.cmx -o test.cmxs
File "_none_", line 1:
Error: Cannot find file ocamldoc.cmxa

It looks like the tag use_ocamldoc expects a file ocamldoc.cmxa to exist,
providing library support for ocamldoc plugins, and it does not seem to
exist -- it seems that the preferred way to use ocamldoc plugins is to use
"ocamldoc.opt -g foo.cmxs", with ocamldoc libraries already linked inside
ocamldoc.opt. So just using

  ocamlbuild -cflags -I,+ocamldoc test.cmxs

works and seems to do what you expect.

It goes without saying that this is not a perfect long-term solution, as it
assumes that ocamldoc libraries are distributed with the stdlib. It would
be cleaner to have an ocamldoc package for them (just like ocamlbuild has a
dummy ocamlfind package indicating the location of its library files), but
it seems that this is not currently the case. It would be nice (but not
super-high priority) to have such a dummy package in ocamlfind in the
future, so that you can just do

  ocamlbuild -use-ocamlfind -package ocamldoc test.cmxs

¹: The most time-consuming part was finding the code of a ocamldoc plugin
to compile, as the documentation examples are incomplete. Next time, feel
free to provide a tarball with a minimal example to reproduce.

On Fri, Dec 18, 2015 at 5:14 PM, Armaël Guéneau <armael.gueneau@ens-lyon.fr>
wrote:

> Hi list,
>
> I'm wondering how one should compile ocamldoc custom generators
> <http://caml.inria.fr/pub/docs/manual-ocaml/ocamldoc.html#sec333> using
> ocamlbuild.
>
> First, the ocamlbuild manual
> (
> <https://github.com/gasche/manual-ocamlbuild/blob/master/manual.md#basic-tags->
> https://github.com/gasche/manual-ocamlbuild/blob/master/manual.md#basic-tags
> -)
> says that the [use_ocamldoc] tag is deprecated; and that a corresponding
> ocamlfind package should be used instead. Is there such a package for
> ocamldoc?
> I did not found one.
>
> Then, I did not manage to build the plugin into .cma/.cmxs files directly
> using
> ocamlbuild. My command line was something along these lines:
>
>    ocamlbuild -use-ocamlfind -tag use_ocamldoc -package compiler-libs
> plugin.cmxs
>
> When trying to build plugin.cma/plugin.cmxs, ocamlbuild complained that
> "Cannot
> find file ocamldoc.cma/ocamldoc.cmxa" (respectively). However, I can build
> plugin.cmo/plugin.cmx using the same command line, then create the
> .cma/.cmxs
> manually using ocamlc/ocamlopt - which I ended up doing.
>
> Is there a better way to do so? If the whole process can be improved
> (how?), I
> would be happy to write the required patches/documentation.
>
> — Armaël
>
>

[-- Attachment #2: Type: text/html, Size: 3787 bytes --]

  reply	other threads:[~2015-12-18 17:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 16:14 Armaël Guéneau
2015-12-18 17:06 ` Gabriel Scherer [this message]
2015-12-18 19:14   ` Armaël Guéneau
2015-12-18 21:43     ` Gabriel Scherer
2015-12-20 15:33       ` Armaël Guéneau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPFanBFoZrMj-HhmQmQPXaVgPzX8wM-mF2xpJ7B5ZDW=uBBYDA@mail.gmail.com' \
    --to=gabriel.scherer@gmail.com \
    --cc=armael.gueneau@ens-lyon.fr \
    --cc=caml-list@inria.fr \
    --cc=info@gerd-stolpmann.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).