Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ANN] OCaml Batteries Included, alpha 3
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jan Kybic <kybic@f...>
Subject: Re: ocamlbuild documentation
>> Instead, I found that ocamlbuild replaces my current build option of choice:
>>   ocamlopt -I +lablGL lablgl.cmxa lablglut.cmxa -o foo
>> with lots of incidental complexity:

I agree with the previous posters that ocamlbuild is a great project
but the documentation is not yet sufficient for a beginner. Let me
recall my recent experience:

Yesterday, out of curiosity, I have tried to use Ocaml for my current
project. It is not complicated, just a few Ocaml source files with a
few libraries. In Ocamlmake, I only had to list the SOURCES and set

PACKS = lacaml unix extlib str gsl

In ocamlbuild, I spent a long time finding out how to tell Ocaml to
use the required libraries.  I took the ocamlfind plugin from
the Ocamlbuild wiki
and created the following _tags file:

<*.ml> or <*.mli>: pkg_extlib, pkg_gsl, pkg_str, pkg_unix
<>: ocaml, pp(ocaml+twt), debug
<>: ocaml, pp(camlp4o), debug

Now, all files compiled correctly. However, the linking failed with
message "No implementations provided for the following modules". I could
eliminate some of the messages by invoking ocamlbuild as

  ocamlbuild -libs str,unix,bigarray,gsl matvflss.native

but this did not help with gsl and extlib libraries.  Finally, after
many frustrating attempts I could link everything using:

ocamlbuild -lflags -I,/usr/lib/ocaml/site-packages/gsl -lflags -I,/usr/lib/ocaml/site-packages/extlib -libs str,unix,bigarray,gsl,extLib   matvflss.native

So finally yes, ocamlbuild works. But for a beginner, it is currently more
complicated to use than Ocamlmake. Instead of a few lines in a
Makefile, you need to write, _tags, and a script
automating the command line.  I found the command line more or less by
trial and error and by looking at the examples. It is admittedly my
fault since there is one relevant sentence in the manual ("You may
need to add options such as...") but it is easy to miss.

Why do I have to manually set all the paths and library names
if I have already said "pkg_..." in _tags? Why does not ocamlbuild
uses ocamlfind to find out automatically? I thought the plugin was
supposed to do exactly this.

By the way, how am I supposed to use the caml-types-show-type feature
in Emacs Tuareg mode, if ocamlbuild forces all the annot files into
the _build subdirectory?

I am sure Ocamlbuild will mature with time and become a very useful
tool. Keep up the good work.


Jan Kybic <>                       tel. +420 2 2435 5721                      ICQ 200569450