<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/12/01a1eed0f61a6659ca18888d61bdb359"
  from="jehenrik &lt;jehenrik@y...&gt;"
  author="jehenrik"
  date="2002-12-14T07:00:39"
  subject="[Caml-list] darwin link suckage eg: pcre"
  prev="2002/12/6d731c14475e72121d97ee43a298c377"
  next="2002/12/2faab84465df3069538d9c2cb827287f"
  next-in-thread="2002/12/2faab84465df3069538d9c2cb827287f"
  prev-thread="2002/12/91fe95b70649b64d0cb16758a0b17044"
  next-thread="2002/12/9fa6c225f20604b6a6e0a6ac9afcb2c0"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] darwin link suckage eg: pcre">
<msg 
  url="2002/12/01a1eed0f61a6659ca18888d61bdb359"
  from="jehenrik &lt;jehenrik@y...&gt;"
  author="jehenrik"
  date="2002-12-14T07:00:39"
  subject="[Caml-list] darwin link suckage eg: pcre">
<msg 
  url="2002/12/2faab84465df3069538d9c2cb827287f"
  from="Markus Mottl &lt;markus@o...&gt;"
  author="Markus Mottl"
  date="2002-12-14T11:32:17"
  subject="Re: [Caml-list] darwin link suckage eg: pcre">
</msg>
</msg>
</thread>

<contents>
Can somebody who understands Darwin linking tell me why my ocaml pcre 
does not work like I think it should?  I build pcre 3.9.  Install.  
Fine.  I build pcre-ocaml 4.28.  It installs in 
/usr/local/lib/ocaml/contrib.  Good enough.  After the install, I have 
to manually ranlib libpcre_stubs.a because the directory has changed.  
Fine.  The example programs, pcregrep et al, link fine against the 
install.  Now I try to build a toplevel:

&gt; bash2.05 jehenrik@localhost ~/src/pcre-ocaml-4.28.3 % ocamlmktop -ccopt 
&gt; -L/usr/local/lib/ocaml/contrib -o ocaml_pcre pcre.cma
&gt; bash2.05 jehenrik@localhost ~/src/pcre-ocaml-4.28.3 % ocaml_pcre
&gt;         Objective Caml version 3.06
&gt;
&gt; # open Pcre;;
&gt; Unbound module Pcre
&gt; # Pcre.regexp;;
&gt; Unbound value Pcre.regexp

The toplevel executable does contain the C stubs:


&gt; bash2.05 jehenrik@localhost ~/src/pcre-ocaml-4.28.3 % nm ocaml_pcre
&gt; .
&gt; .
&gt; .
&gt; 00002438 T _pcre_isspace_wrapper

OTOH, I can't seem to see them even if I load pcre.cmo:

&gt; # #load "lib/pcre.cmo";;
&gt; # Pcre;;
&gt; Unbound constructor Pcre
&gt; # Pcre.regexp;;
&gt; Unbound value Pcre.regexp
&gt; # regexp;;
&gt; Unbound value regexp

I can see them if I ignore the .mli file and load all the symbols into 
the top namespace:

&gt; # #use "lib/pcre.ml";;
&gt; exception BadPattern of string * int
&gt; exception InternalError of string
&gt; .
&gt; .
&gt; .
&gt; # regexp "[a-z]";;
&gt; - : regexp = &lt;abstr&gt;
&gt; #

Of course this isn't what I want, it's just duct tape.  Now I have a fix 
which I don't understand either.  I change

&gt; ifndef OCAML_LIB_INSTALL
&gt;   OCAML_LIB_INSTALL := $(OCAMLLIBPATH)
&gt; JH was $(OCAMLLIBPATH)/contrib

in OcamlMakefile, reinstall, and everything works perfect:

&gt; bash2.05 jehenrik@localhost ~/src/pcre-ocaml-4.28.3 % ocamlmktop 
&gt; pcre.cma -o ocaml_pcre
&gt; bash2.05 jehenrik@localhost ~/src/pcre-ocaml-4.28.3 % ocaml_pcre
&gt;         Objective Caml version 3.06
&gt;
&gt; # open Pcre;;
&gt; #

So I have a workaround, but I would like to know what the problem is so 
that I don't repeat whatever error is here with my own code.  Thanks.


Jeff Henrikson


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

</contents>

</message>

