English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
help with ocaml makefiles
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-11-19 (15:13)
From: Anil Madhavapeddy <anil@r...>
Subject: Re: [Caml-list] help with ocaml makefiles
On 18 Nov 2010, at 07:43, rixed@happyleptic.org wrote:

> Each time I need more debug information for the ocaml runtime itself
> (which hopefully is not often) I recompile Ocaml adding various "-g"
> and "-O0" here and there in some makefiles.
> But I've noticed there are some special targets and rules, specifically in
> byterun/Makefile, that seams to be there for that very purpose (the suffix
> rules for .d.c extention). So I suppose there is a standard way to
> compile ocaml in debugging mode.
> Do someone have some knowledge to share about this ?

The C files in byterun/ are compiled with and without debug/profiling, and the following files are created:
- libasmrun.a  (normal)
- libasmrunp.a (profiling)
- libasmrund.a (debug)

Only the normal and profiling ones are installed by default. You can grab the debug version from your ocaml build tree and link against it manually, with something like:

$ ocamlopt -output-obj -i foo.o foo.ml 
$ cc -lasmrund -lm -o foo foo.o

It'd be convenient to have a compiler option to select libasmrund without having to go via -output-obj (as "-p" does for profiling); the code for this is in asmcomp/asmlink.ml:runtime_lib().