Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
`Pcre__substitute_477':
: undefined reference to `caml_tuplify2'
/usr/lib/ocaml/3.06/pcre/pcre.a(pcre.o)(.text+0x4212): In function
`Pcre__substitute_first_587':
: undefined reference to `caml_tuplify2'
/usr/lib/ocaml/3.06/pcre/pcre.a(pcre.o)(.data+0x10c): In function
`Pcre__3':
: 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