Hi,

On 11/04/2012, Martin DeMello <martindeme...@gmail.com> wrote:
> I'm trying to get Opa compiled, and following the patch here:
> http://lists.owasp.org/pipermail/opa/2012-March/000955.html
>
> However, it doesn't appear to work unless I include the complete path
> to cryptolib; +site-lib/cryptolib fails.

Here's the issue: using the -I +... syntax while ocamlfind should be
used. Of course, that requires cryptokit to have been installed through
ocamlfind (which I believe yours has).

> # this dies
> $ /home/martin/opt/godi/bin/ocamlopt.opt -I +qmltop -I ../libtools -I
> ../libsecurity -I ../libqmlcompil -I ../libnet -I ../libbsl -I
> ../libbase -I ../database -I +cryptokit -I ../appruntime -I
> +site-lib/cryptokit  -I /lib/opa/static  -c cryptoMLRuntime.ml
> File "plugins/crypto/bslCrypto.ml", line 27, characters 2-28:
> Error: Unbound module Cryptokit
>
> # this works
> $ /home/martin/opt/godi/bin/ocamlopt.opt -I +qmltop -I ../libtools -I
> ../libsecurity -I ../libqmlcompil -I ../libnet -I ../libbsl -I
> ../libbase -I ../database -I +cryptokit -I ../appruntime -I
> /home/martin/opt/godi/lib/ocaml/site-lib/cryptokit  -I /lib/opa/static
>  -c cryptoMLRuntime.ml
>
> Is something wrong with my installation? It's a pretty standard godi
> install.

Nothing is wrong with it. As far as I remember, the "-I +..." syntax is
relative to the location of the compiler. On my godi install, I get:
  % ocamlc -where
  /opt/ocaml/lib/ocaml/std-lib

As you can see, "std-lib" <> "site-lib" (and same for "pkg-lib"). By the
way, if I'm not mistaken, on godi, std-lib is for the base ocaml,
pkg-lib is for what has been installed through godi and site-lib is for
user-installed packages (and godi has a cryptokit package ;-) ).

The right way to do it is to compile with ocamlfind which will always
know the right location.
  % ocamlfind query cryptokit
  /opt/ocaml/lib/ocaml/pkg-lib/cryptokit

  % ocamlfind ocamlopt -package cryptokit -c ...

Some more reasons to use ocamlfind are:
- -I +... is brittle and too annoying to change
- maybe cross-compilation (it's easy to set which compiler to use with
  environment variables)
- ocamlfind ocamlc -package lablgtk2,lablgtk2.glade,lablwebkit,cryptokit
  is definitely much more readable than the equivalent with -I +
- almost everything is using ocamlfind
- (linux) distributions add ocamlfind support anyway
- oasis uses
- it works, even on windows
- it nicely solves a nightmare

I wish all ocaml libraries installed with ocamlfind and I wish all ocaml
code compiled with ocamlfind.

-- 
Adrien Nader

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to