From: Francois Berenger <berenger@riken.jp>
To: caml-list@inria.fr
Subject: Re: [Caml-list] building profile cmx libraries with ocamlbuild
Date: Fri, 15 Jun 2012 09:46:12 +0900 [thread overview]
Message-ID: <4FDA85D4.9070903@riken.jp> (raw)
In-Reply-To: <AE01DFE8-6814-4DC0-B4F0-D12119094DAB@recoil.org>
On 06/15/2012 12:47 AM, Anil Madhavapeddy wrote:
> Hi,
>
> I'm shifting our build system to produce profiling versions of libraries, and am using ocamlbuild's %.p.cmx target. It seems to interact oddly with cross-module inlining, and I wanted to check if this was a bug or a misunderstanding on my part.
>
> Consider two modules: foo.ml, bar.ml, and Bar has references to Foo. If I compile 'ocamlbuild bar.cmx', then foo.cmx will be built first and be available to ocamlopt when bar.cmx is being produced.
>
> However, if I compile 'ocamlbuild bar.p.cmx', the rule generates 'foo.p.cmx', which is not picked up as a valid CMX for the Foo module. This normally silently works, except in the case when Foo and Bar are being packed into a module, and the compiler then complains that bar.cmx was compiled without access to foo.cmx.
>
> So what is the best way to fix the rule? I could put in an artificial dependency on %.p.cmx->%.cmx to ensure that there is always something picked up. Alternatively, ocamlopt's compileenv could be modified to also look for %.<id>.cmx, depending on the current compilation unit's<id>. Or is there a third, correct way to build a profiled library that I'm missing?
>
> Incidentally, I've also had to add a custom build rule for %.d.cmx, which appears to be missing. %.d.cma exists, and %.p.cmx, but not %.p.cma (because ocamlcp is not supported by ocamlbuild, which is fine), but is the lack of a '-g' option for native code libraries an oversight, or unnecessary for some other reason?
>
> -Anil, from the darkest depths of myocamlbuild.ml
Sorry, this does not exactly answer your question but,
if you are using oasis, just turn
profile="false" to profile="true"
in setup.data to turn debugging on (using gprof).
Regards,
F.
prev parent reply other threads:[~2012-06-15 0:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-14 15:47 Anil Madhavapeddy
2012-06-15 0:46 ` Francois Berenger [this message]
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=4FDA85D4.9070903@riken.jp \
--to=berenger@riken.jp \
--cc=caml-list@inria.fr \
/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