caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] problem with -pack, native code, and PCRE
@ 2003-02-17  2:02 Eric C. Cooper
  2003-02-17 10:37 ` Xavier Leroy
  0 siblings, 1 reply; 3+ messages in thread
From: Eric C. Cooper @ 2003-02-17  2:02 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] problem with -pack, native code, and PCRE
  2003-02-17  2:02 [Caml-list] problem with -pack, native code, and PCRE Eric C. Cooper
@ 2003-02-17 10:37 ` Xavier Leroy
  2003-02-17 20:04   ` Eric C. Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Xavier Leroy @ 2003-02-17 10:37 UTC (permalink / raw)
  To: caml-list

> 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.

I think it's an instance of PR#1480.  Your test script works fine with
the development version of OCaml.  I don't think there is an easy
workaround for OCaml 3.06.

- Xavier Leroy
-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] problem with -pack, native code, and PCRE
  2003-02-17 10:37 ` Xavier Leroy
@ 2003-02-17 20:04   ` Eric C. Cooper
  0 siblings, 0 replies; 3+ messages in thread
From: Eric C. Cooper @ 2003-02-17 20:04 UTC (permalink / raw)
  To: caml-list

On Mon, Feb 17, 2003 at 11:37:13AM +0100, Xavier Leroy wrote:
> > 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.
> 
> I think it's an instance of PR#1480.  Your test script works fine with
> the development version of OCaml.  I don't think there is an easy
> workaround for OCaml 3.06.

I ended up working around this by doing the packing "manually".
Continuing my earlier example, I have "foo.ml" containing
	   module A = A
Of course, I have to explicitly link with all the sub-modules, and
they are present in the top-level namespace, but that's acceptable for
now.

-- 
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-02-17 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-17  2:02 [Caml-list] problem with -pack, native code, and PCRE Eric C. Cooper
2003-02-17 10:37 ` Xavier Leroy
2003-02-17 20:04   ` Eric C. Cooper

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).