caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jan Kybic <kybic@fel.cvut.cz>
To: caml-list@yquem.inria.fr
Subject: Re: ocamlbuild documentation
Date: Tue, 10 Feb 2009 15:06:34 +0100	[thread overview]
Message-ID: <87vdriwfmd.fsf@fel.cvut.cz> (raw)
In-Reply-To: <49909F14.6010601@doomeer.com> (DooMeeR's message of "Mon, 09 Feb 2009 22:24:36 +0100")

>> Instead, I found that ocamlbuild replaces my current build option of choice:
>>   ocamlopt foo.ml -I +lablGL lablgl.cmxa lablglut.cmxa foo.ml -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
(http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild)
and created the following _tags file:

<*.ml> or <*.mli>: pkg_extlib, pkg_gsl, pkg_str, pkg_unix
<dList.ml>: ocaml, pp(ocaml+twt), debug
<utils.ml>: 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 myocamlbuild.ml, _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


-- 
-------------------------------------------------------------------------
Jan Kybic <kybic@fel.cvut.cz>                       tel. +420 2 2435 5721
http://cmp.felk.cvut.cz/~kybic                      ICQ 200569450


  reply	other threads:[~2009-02-10 14:06 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-06 16:11 [ANN] OCaml Batteries Included, alpha 3 David Rajchenbach-Teller
2009-02-07 14:21 ` [Caml-list] " Mikkel Fahnøe Jørgensen
2009-02-07 14:43   ` Sylvain Le Gall
2009-02-07 14:58     ` [Caml-list] " Jon Harrop
2009-02-07 15:13       ` Sylvain Le Gall
2009-02-07 16:13         ` [Caml-list] " Matthieu Dubuget
2009-02-07 19:30           ` David Rajchenbach-Teller
2009-02-07 21:13             ` Matthieu Dubuget
2009-02-09  9:36           ` Romain Bardou
2009-02-09 15:56             ` David Teller
2009-02-07 15:46       ` Paolo Donadeo
2009-02-09  9:32       ` Romain Bardou
2009-02-09 10:30         ` ocamlbuild documentation (was Re: [Caml-list] Re: [ANN] OCaml Batteries Included, alpha 3) Daniel Bünzli
2009-02-09 11:51           ` Romain Bardou
2009-02-09 12:30             ` Daniel Bünzli
2009-02-09 12:52               ` Romain Bardou
2009-02-09 13:07                 ` Daniel Bünzli
2009-02-09 13:22                   ` Romain Bardou
2009-02-09 13:36                     ` Daniel Bünzli
2009-02-09 13:59                       ` Romain Bardou
2009-02-09 14:04                         ` Romain Bardou
2009-02-09 14:37                           ` Daniel Bünzli
2009-02-09 17:26                             ` Kuba Ober
2009-02-09 18:28                         ` Jon Harrop
2009-02-09 21:24                           ` DooMeeR
2009-02-10 14:06                             ` Jan Kybic [this message]
2009-02-10 14:27                               ` [Caml-list] Re: ocamlbuild documentation Matthieu Dubuget
     [not found]                                 ` <87k57ywc0k.fsf@fel.cvut.cz>
2009-02-10 15:50                                   ` Matthieu Dubuget
2009-02-10 15:58                                     ` Daniel Bünzli
2009-02-09 18:38                     ` ocamlbuild documentation (was Re: [Caml-list] Re: [ANN] OCaml Batteries Included, alpha 3) David Teller
2009-02-09 22:02         ` [Caml-list] Re: [ANN] OCaml Batteries Included, alpha 3 Peter Hawkins
2009-02-09 22:45           ` Mikkel Fahnøe Jørgensen
2009-02-09 22:55             ` Mikkel Fahnøe Jørgensen
2009-02-10  7:48             ` Stefano Zacchiroli
2009-02-10 13:22               ` Mikkel Fahnøe Jørgensen
2009-02-07 20:04     ` Daniel Bünzli
2009-02-08 17:22   ` [Caml-list] " Richard Jones
2009-02-09  8:57     ` David Allsopp
2009-10-20 20:46 ocamlbuild documentation Sam Steingold
2009-10-21  8:47 ` [Caml-list] " Romain Bardou
2009-10-21 13:36   ` Erick Matsen
2009-10-21 14:24     ` Sylvain Le Gall

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=87vdriwfmd.fsf@fel.cvut.cz \
    --to=kybic@fel.cvut.cz \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).