caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus@mail4.ai.univie.ac.at>
To: Johann Spies <jhspies@adept.co.za>
Cc: ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] How to use pcre (3)
Date: Thu, 6 Sep 2001 23:23:56 +0200	[thread overview]
Message-ID: <20010906232356.A31302@chopin.ai.univie.ac.at> (raw)
In-Reply-To: <87heug5c81.fsf_-_@adept.co.za>; from jhspies@adept.co.za on Thu, Sep 06, 2001 at 21:51:58 +0200

On Thu, 06 Sep 2001, Johann Spies wrote:
> After about another hour and a half I did not succeed in compiling the
> following program:
[snip]
> My latest effort was:
> 
> $ocamlfind ocamlopt -o rex -I /usr/lib/ocaml/contrib -ccopt
> -L/usr/lib/ocaml/contrib  -cclib -llibpcre.a -linkall /tmp/rex.ml

The problem is that you have to add pcre.cmxa (or pcre.cma for byte code)
before your /tmp/rex.ml. It's not enough to link against the C-library,
or better: you don't even have to do this.

This should suffice:

  ocamlopt -o rex -I /usr/lib/ocaml/contrib -ccopt \
    -L/usr/lib/ocaml/contrib pcre.cmxa /tmp/rex.ml

I don't know ocamlfind, because I usually use OcamlMakefile for just
about anything. If you want to try the latter, you'd write a Makefile
that might look like this:

---------------------------------------------------------------------------
SOURCES = rex.ml
RESULT = rex
LIBS = pcre
-include OcamlMakefile
---------------------------------------------------------------------------

You'd only have to set an environment variable (e.g. either in
the Makefile itself or globally in you .bashrc or similar) named
OCAML_DEFAULT_DIRS, which can be any number of paths that contain your
favourite OCaml-libraries.

I usually define a shell alias that just copies a suitable template of
such a Makefile into the current directory so that I can experiment fast.
OcamlMakefile is somewhere in my home directory and is automatically
loaded if you start make as "make -I {path to generic Makefiles}". The
latter can, again, be aliased.

Once I find a bit more time, I'll explain such small (but
useful!) development speedups on my upcoming OCaml hint page...

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-09-06 21:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-06 13:03 [Caml-list] How to use pcre Johann Spies
2001-09-06 13:29 ` Markus Mottl
2001-09-06 13:44   ` Johann Spies
2001-09-06 14:21   ` [Caml-list] How to use pcre (2) Johann Spies
2001-09-06 14:45     ` Markus Mottl
2001-09-06 19:51       ` [Caml-list] How to use pcre (3) Johann Spies
2001-09-06 21:12         ` Nicolas George
2001-09-06 21:23         ` Markus Mottl [this message]
2001-09-07  6:59           ` Johann Spies
2001-09-06 21:28         ` Gerd Stolpmann
2001-09-06 21:55           ` Markus Mottl
2001-09-06 22:14           ` Alain Frisch

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=20010906232356.A31302@chopin.ai.univie.ac.at \
    --to=markus@mail4.ai.univie.ac.at \
    --cc=caml-list@inria.fr \
    --cc=jhspies@adept.co.za \
    /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;
as well as URLs for NNTP newsgroup(s).