caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ocamlbuild: build-only dependencies on syntax extensions
@ 2011-06-23 13:05 Michael Ekstrand
  2011-06-23 19:50 ` Michael Ekstrand
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ekstrand @ 2011-06-23 13:05 UTC (permalink / raw)
  To: caml-list

In my source tree, I build a few syntax extensions which are then used
to compile other modules.  I do this as follows:

      flag_and_dep ["ocaml"; "ocamldep"; "use_lll"] &
        S[A"-ppopt"; P"pa_lll.cma"];
      flag_and_dep ["ocaml"; "compile"; "use_lll"] &
        S[A"-ppopt"; P"pa_lll.cma"];

Now, when I try to build the bytecode version of the program, it tries
to link the syntax extension into the final program.  When I use the
syntax extensions as '.cma' files, the linker doesn't actually include
anything from them since their modules are not depended on by anything. 
However, if I use them as '.cmo' files, it does fail because the linker
attempts to unconditionally include them.

Ideally, the linker would not even try to include them because they are
only a compile-time dependency, not a runtime dependency.

Is there something I can do in my ocamlbuild plugin to exclude the
syntax extensions from being link-time dependencies, short of building
them out-of-tree and using ocamlfind to bring them back in?  Is this a
bug (or missing feature) in ocamlbuild?

I've played with non_dependency a bit, but if it's what I need I haven't
found the magic incantation it requires to accomplish the purpose.

Thanks,
- Michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] ocamlbuild: build-only dependencies on syntax extensions
  2011-06-23 13:05 [Caml-list] ocamlbuild: build-only dependencies on syntax extensions Michael Ekstrand
@ 2011-06-23 19:50 ` Michael Ekstrand
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ekstrand @ 2011-06-23 19:50 UTC (permalink / raw)
  To: caml-list

On 06/23/2011 08:05 AM, Michael Ekstrand wrote:
> In my source tree, I build a few syntax extensions which are then used
> to compile other modules.  I do this as follows:
>
>       flag_and_dep ["ocaml"; "ocamldep"; "use_lll"] &
>         S[A"-ppopt"; P"pa_lll.cma"];
>       flag_and_dep ["ocaml"; "compile"; "use_lll"] &
>         S[A"-ppopt"; P"pa_lll.cma"]

Found a fix: by using 'flag' for the second, rather than 'flag_and_dep',
the dependency gets forced at ocamldep time but ignored at compile time,
so it doesn't get found as a transitive dependency and linked.

- Michael


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-23 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-23 13:05 [Caml-list] ocamlbuild: build-only dependencies on syntax extensions Michael Ekstrand
2011-06-23 19:50 ` Michael Ekstrand

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).