Browse thread
[Caml-list] How to use pcre
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Markus Mottl <markus@m...> |
| Subject: | Re: [Caml-list] How to use pcre (3) |
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