From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q3B7fMLb005650 for ; Wed, 11 Apr 2012 09:41:22 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqoCAOQ0hU/RVde0k2dsb2JhbABFuTwIIgEBAQEJCQsJFAQjggkBAQEEAQIPAiwBGx0BAwwGBQsNLiEBAQUMAQUBHAYTIoddAQMLC5tpCowggnKFOAoZJw1XiHYBBQuKGocaBI4GhTqCLIERiiiDHT2EDA X-IronPort-AV: E=Sophos;i="4.75,404,1330902000"; d="scan'208";a="139776775" Received: from mail-ey0-f180.google.com ([209.85.215.180]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 11 Apr 2012 09:41:18 +0200 Received: by eaal12 with SMTP id l12so154751eaa.39 for ; Wed, 11 Apr 2012 00:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=FCQIXbOy3Qm2//EbhbGQ8kIJfDxNWxqpKpixeZEezz0=; b=q4jLXRk260NI9BUr1UwRZors+zsXAnNKSW4A7Kpd/eEzUuHy8bzqFdW2TgifZAqcqp ZISoyuQm+YFopAzVg3Xyw+lIB68wXiGcZXr7+cVX2NTuXOw5+sKzNlxdMn8cM3v5cpCl cIAtC/4u3GPfZpcAsq8CLazh3zhiNwMoz8C07TIHZmCSHjqvPnR83BWUCuUt/0UQeB+C JCXwQUigE3jV9y/YkLob+HykeJCdiCuMJjwEISlC3TU4R+A1Wawl26Vc6iyQSE70lVqz QW6RoV997qinlQGqq18dWL5g+URZuMbwow88GMqzW0qLJ0eCFZa2mdzHijpotSzhLQOi MbHA== MIME-Version: 1.0 Received: by 10.213.27.194 with SMTP id j2mr872119ebc.269.1334130077514; Wed, 11 Apr 2012 00:41:17 -0700 (PDT) Received: by 10.213.19.138 with HTTP; Wed, 11 Apr 2012 00:41:17 -0700 (PDT) In-Reply-To: References: Date: Wed, 11 Apr 2012 09:41:17 +0200 Message-ID: From: Adrien To: Martin DeMello Cc: OCaml List Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] include path problem: -I +site-lib/lib not working Hi, On 11/04/2012, Martin DeMello 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