Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Adrien <camaradetux@gmail.com>
To: Martin DeMello <martindemello@gmail.com>
Cc: OCaml List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] include path problem: -I +site-lib/lib not working
Date: Wed, 11 Apr 2012 09:41:17 +0200	[thread overview]
Message-ID: <CAP5QFJkZzbTQfbTSKt7N=m3wT+aNmRMLTubJnKToSoUOnbzQ5Q@mail.gmail.com> (raw)
In-Reply-To: <CAFrFfuE3OM8wep8vfjSXTBeJzuJaV=sx5a57C3RE-bZBePtnwg@mail.gmail.com>

Hi,

On 11/04/2012, Martin DeMello <martindemello@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

  reply	other threads:[~2012-04-11  7:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11  3:52 Martin DeMello
2012-04-11  7:41 ` Adrien [this message]
2012-04-16  6:04   ` Martin DeMello

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='CAP5QFJkZzbTQfbTSKt7N=m3wT+aNmRMLTubJnKToSoUOnbzQ5Q@mail.gmail.com' \
    --to=camaradetux@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=martindemello@gmail.com \
    /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