Version française
Home     About     Download     Resources     Contact us    
Browse thread
findlib help: how to extract all compilation/linking flags ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Guillaume Rousse <Guillaume.Rousse@i...>
Subject: findlib help: how to extract all compilation/linking flags ?
I'm trying to use findlib query mode to extract all flags needed for
compiling and linking a program with dependency against a
findlib-enabled package.

I know I could use findlib as a transparent wrapper for ocamlc, but I'm
relunctant to do it. Mostly because in mixed dependencies scenarios
(both findlib-aware and findlib-unaware), I'd like to have all
dependencies handled consistantly, not some through wrapper and some
other through explicit flags. Second, because I'd prefer to mimic the
pkgconfig usage, which is to extract information only.

So far, I found than the only flags needed for compilation seems to be
available trough
ocamlfind query -i-format -separator ' ' -recursive <package>

I'm less sure for linking flags. It seems I need to combine the result
of -i-format, -l-format, -o-format and -a-format, thus requesting the
use of -format option, with additional target predicates (byte or native).

However, I'm not sure it is safe to mix all of them in a single command:
ocamlfind query -format '-I %d -ccopt -L%d %O %A' -separator ' '
-recursive -predicates native <package>
As it will intermix -I, -L options, other linking options and packages
names. Maybe it would be safer to split them in two different set of

So, basically, how much different variables do I need, and should I
combine them, both for compiling and for linking ?

Yes, I know I could read ocamlfind code to understand what the wrapper
does, but I'm not really an ocaml guru...
Guillaume Rousse
Projet Estime, INRIA
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay Cedex - France