English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] problem with -pack, native code, and PCRE
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-02-17 (02:02)
From: Eric C. Cooper <ecc@c...>
Subject: [Caml-list] problem with -pack, native code, and PCRE
If I use "-pack" on a native-code module that uses Pcre, I get link
errors when I try to use it.  It works fine with bytecode.

Suppose "a.ml" contains:
    let re = Pcre.regexp ".*"
    let str = "foo"

and I do the following:

% ocamlopt -I +pcre -c a.ml
% ocamlopt -I +pcre -pack -o foo.cmx a.cmx

Now suppose "test.ml" contains:
    let _ = print_endline Foo.A.str

This command fails with lots of undefined references:

% ocamlopt -I +pcre pcre.cmxa foo.cmx test.ml

/usr/lib/ocaml/3.06/pcre/pcre.a(pcre.o)(.text+0x3a42): In function
: undefined reference to `caml_tuplify2'
/usr/lib/ocaml/3.06/pcre/pcre.a(pcre.o)(.text+0x4212): In function
: undefined reference to `caml_tuplify2'
/usr/lib/ocaml/3.06/pcre/pcre.a(pcre.o)(.data+0x10c): In function
: undefined reference to `caml_curry7'
[... many more omitted ...]

If I use ocamlc and .cmo/.cma files, it works fine.  Any help or
workarounds would be appreciated.

Eric C. Cooper          e c c @ c m u . e d u
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners