Two remarks:

1. You should use "ocamlfind" to provide you with machine-portable path information on OCaml libraries (this only works with libraries that have ocamlfind support, but that's essentially all libraries worth using, and otherwise it's a packaging bug that you should report to the library author or distributor). So instead of the machine-dependent LIB variable, you could just set:
  LIB=-I,$(shell ocamlfind query lacaml)

2. You don't actually need this include-handling logic as ocamlfind can deal with that for you. To use it from ocamlbuild, the magic option is "-use-ocamlfind", and then using "-pkg(s)" instead of "-lib(s)" option. I was able to reproduce your problem on a test file, and fixed it with the following Makefile:

all:
    ocamlbuild -use-ocamlfind -pkgs bigarray,lacaml,str,unix -verbose 2 molexc.native

clean:
    ocamlbuild -clean

doc:
    ocamlbuild -use-ocamlfind -pkgs bigarray,lacaml,str,unix molexc.docdir/index.html

(To see a list of available ocamlfind package, use "ocamlfind list"; see _build/_log for the actual compilation lines that ocamlbuild uses, if you want to reproduce them by hand.)

On Thu, Feb 21, 2013 at 2:25 PM, Elisa Rebolini <erebolini@gmail.com> wrote:
I've installed lacaml 7.0.3 by following the installation procedure
        'ocaml setup.ml -configure'
        'ocaml setup.ml -build'
        'ocaml setup.ml -install'
The path to the lacaml package is /usr/local/lib/ocaml/site-lib/lacaml
and my Makefile is

hostname := $(shell uname -n)

# Default
LIB=-I,+site-lib/lacaml

ifeq ($(hostname),clastos)
LIB=-I,+site-lib/lacaml
endif

ifeq ($(hostname),bulle)
LIB=-I,/usr/local/lib/ocaml/3.12.1/lacaml
endif

all:
        ocamlbuild -libs bigarray,lacaml,str,unix -verbose 2 -cflags $(LIB)
-lflags $(LIB) molexc.native

clean:
        ocamlbuild -clean

doc:
        ocamlbuild -libs bigarray,lacaml,str,unix -verbose 2 -cflags $(LIB)
-lflags $(LIB) molexc.docdir/index.html

thanks
--
Elisa

Le 21/02/2013 14:11, Gabriel Scherer a écrit :
> It would help to have more precise information about your setup. Could you
> detail how you installed lacaml on your system, and provide a directory
> tarball for a simple project allowing to reproduce your problem (with the
> _tags file etc.)?
>
> On Thu, Feb 21, 2013 at 2:07 PM, Elisa Rebolini <erebolini@gmail.com> wrote:
>
> Hello list,
> I'm developping a quantum chemistry software with ocaml and use lacaml
> as a binding to the LAPACK and BLAS libraries.
> I have a warning at the compilation with ocamlbuild
>         Warning: Failed to build the module Lacaml requested by ocamldep
>         mid rule ocaml: ml -> cmo & cmi (%=parser_epsilon ): cache hit
> but the compilation is still successful and the program works as
> expected but when I try to compile the documentation I have an error
>         Error: Unbound module Lacaml
> I'm not very skilled (yet?) with caml so any help would be very much
> appreciated.
> Thanks a lot
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>
>