Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] include path problem: -I +site-lib/lib not working
@ 2012-04-11  3:52 Martin DeMello
  2012-04-11  7:41 ` Adrien
  0 siblings, 1 reply; 3+ messages in thread
From: Martin DeMello @ 2012-04-11  3:52 UTC (permalink / raw)
  To: OCaml List

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.

# 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.

martin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] include path problem: -I +site-lib/lib not working
  2012-04-11  3:52 [Caml-list] include path problem: -I +site-lib/lib not working Martin DeMello
@ 2012-04-11  7:41 ` Adrien
  2012-04-16  6:04   ` Martin DeMello
  0 siblings, 1 reply; 3+ messages in thread
From: Adrien @ 2012-04-11  7:41 UTC (permalink / raw)
  To: Martin DeMello; +Cc: OCaml List

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] include path problem: -I +site-lib/lib not working
  2012-04-11  7:41 ` Adrien
@ 2012-04-16  6:04   ` Martin DeMello
  0 siblings, 0 replies; 3+ messages in thread
From: Martin DeMello @ 2012-04-16  6:04 UTC (permalink / raw)
  To: Adrien; +Cc: OCaml List

On Wed, Apr 11, 2012 at 12:41 AM, Adrien <camaradetux@gmail.com> wrote:
>
> 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 ;-) ).

Thanks, I realise I hadn't properly understood what -I +... was doing.
I can't use the cryptokit from godi because opa depends on
cryptokit-1.5 and godi ships 1.3.

> 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 ...

Wish I could! It's a pretty big open source project that I'm merely
trying to get compiled so I can use it. I don't have the time to sit
and hack at their build system :( But thanks for the detailed
explanation of why ocamlfind is the way to go; I'll definitely be
using it for all my personal projects.

martin


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-16  6:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11  3:52 [Caml-list] include path problem: -I +site-lib/lib not working Martin DeMello
2012-04-11  7:41 ` Adrien
2012-04-16  6:04   ` Martin DeMello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox