[opam-devel] conf- libraries and stub cmas: time for ocaml-discover?

Sylvain Le Gall gildor at ocamlcore.org
Mon Aug 26 21:40:37 BST 2013

I was thinking to add build information to the variable you can
substitute in .ab files. These files already allow the embed
$(version) but we can add $(build_information) as well. We just need
to define the right format.

We can also add all this information directly in the META (findlib)
file with a specific key to make it easily accessible through findlib
query API.

Also, on a more general topics, you know that most of these
information are already available in the .cma file ?

$ ocamlobjinfo /usr/lib/ocaml/pcre/pcre.cma
Force custom: no
Extra C object files: -lpcre_stubs -L/usr/lib/x86_64-linux-gnu -lpcre
Extra C options:
Extra dynamically-loaded libraries: dllpcre_stubs.so
Unit name: Pcre
Force link: no

2013/8/26 Christophe TROESTLER <Christophe.Troestler at umons.ac.be>:
> On Mon, 26 Aug 2013 11:57:40 +0100, Anil Madhavapeddy wrote:
>> [...] Ideally, we would be able to query three types of information
>> from a conf package installation:
>> - an ML file that has values exposing cflags/lflags as OCaml values.
>>   This can be used by discover.ml scripts (as used in Core or Lwt)
>> - a CMA file that embeds the dynamic linking flags via cclib, including
>>   adding -Wl,--no-as-needed on newer systems like Ubuntu.  This lets a
>>   Ctypes using dynamic linking (Ctypes.Foreign) just add a CMA to the
>>   link line and have the correct gcc/clang libraries work.
>> - The final thing is some way to pass the right CFLAGS/LDFLAGS to
>>   compile up generated C stubs with the right include/library paths to
>>   gcc (either from Ctypes, or via the traditional camlidl/swig outputs).
>>   Presumably this would be a raw shell fragment in a file, as usually
>>   output by autoconf.
> Sounds good to me.  For the last point, it is also important that
> these flags are available in a way that makes adding ocamlbuild rules
> using these flags easy.  Maybe, the C compiler and CFLAGS/LDFLAGS can
> be duplicated in the first ML file (and then the configure phase — say
> in oasis — may generate the proper rules).
> Best,
> C.

More information about the opam-devel mailing list