From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 8F636BBC4 for ; Fri, 20 Feb 2009 20:05:53 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjICACOOnknU4366lGdsb2JhbACBboseh0wBAQEBCQsICREDv2oBhA4G X-IronPort-AV: E=Sophos;i="4.38,242,1233529200"; d="scan'208";a="24451994" Received: from moutng.kundenserver.de ([212.227.126.186]) by mail1-smtp-roc.national.inria.fr with ESMTP; 20 Feb 2009 20:05:53 +0100 Received: from gate.lan.gerd-stolpmann.de (dslb-084-059-117-089.pools.arcor-ip.net [84.59.117.89]) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis) id 0MKxQS-1Laagy0j7Y-0002E7; Fri, 20 Feb 2009 20:05:44 +0100 Received: from [192.168.0.32] (fw.lan.gerd-stolpmann.de [192.168.1.1]) by gate.lan.gerd-stolpmann.de (Postfix) with ESMTP id E4F8CC12A; Fri, 20 Feb 2009 20:05:43 +0100 (CET) Subject: Re: [Caml-list] Building pcre-ocaml on OCaml 3.11.0 on MinGW From: Gerd Stolpmann To: David Allsopp Cc: OCaml List In-Reply-To: <001801c99367$7a56e740$6f04b5c0$@com> References: <001801c99367$7a56e740$6f04b5c0$@com> Content-Type: text/plain Date: Fri, 20 Feb 2009 20:07:37 +0100 Message-Id: <1235156857.10617.8.camel@flake.lan.gerd-stolpmann.de> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX19JyDrkdqUiP3lfXHN8i05uQqZ3nPzuPetuyL0 TMeW1TDRhVUj6oFfYFvPwN/Lo3mtZOt92RPxFVDjU1bGO828R4 l139G8DzO4kxEdiS/tBEMDmBJlH+PiZ X-Spam: no; 0.00; pcre-ocaml:01 ocaml:01 mingw:01 gerd:01 stolpmann:01 mingw:01 pcre:01 bug:01 gerd:01 pcre-ocaml:01 pcre:01 ocaml:01 cduce:01 libpcre:01 libpcre:01 GODI includes now MinGW support, and pcre is among the actually working packages. Just take it, or look there for how the build is done. Note that you should take GODI for 3.10 because there is still a bug in the 3.11 version. Gerd Am Freitag, den 20.02.2009, 14:28 +0000 schrieb David Allsopp: > I've just had an enlightening few hours getting pcre-ocaml to compile under > Windows (I tried a few years ago and, very lazily, just gave up). I've > managed to get it to work but I'm wondering whether anyone else has done > this and, if so, whether they can explain/confirm/correct a couple of the > steps involved. I'm very much indebted to Alain Frisch's instructions for > building PCRE under OCaml 3.10.0 which are part of the CDuce distribution or > I would've been completely at sea with this! > > The main thing that's got me puzzled is the renaming of libpcre.dll.a and > libpcre.a that I have to do to get the thing to link. > > Note that I'm building the "official" way - so MinGW running within Cygwin. > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++ > Building pcre for MinGW > (Ensure that Cygwin's PCRE libraries are *not* installed) > Unpacked PCRE 7.8 > ./configure --prefix="C:/Dev/OCaml" \ # set to install PCRE > --includedir="C:/Dev/OCaml/lib" \ # to my OCaml tree. > --disable-cpp \ # from Alain's > instructions. > --enable-utf8 \ # Similarly. > --build=mingw32 \ # MinGW, not Cygwin build > CC="gcc -mno-cygwin" # Necessary to ensure that > # autoconf detects the > correct > # library and include dirs > # when querying gcc (CFLAGS > # won't work here) > make > make install > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++ > Building pcre-ocaml > (Note that with older (< 0.14) versions of flexlink, the linker errors > noted doesn't show up and the resulting library is broken) > Unpacked pcre-ocaml 5.15.1 > Edit pcre-ocaml-release-5.15.1/Makefile.conf to contain: > export LIBDIRS := C:/Dev/OCaml/lib # Location of PCRE > export MINGW=1 # MinGW build > export CC=gcc # Or you get lots of errors! > patch -p0 -i pcre-ocaml-release-5.15.1.patch # (attached) > > The patch "fixes" two things in OCamlMakefile > a) It causes the ocamlc -where check to pass the result through cygpath. > My OCAMLLIB variable is correctly set (for Windows) as C:\Dev\OCaml\lib and > Cygwin configure scripts should generally respect that (build in Cygwin, run > in Windows so OCAMLLIB is a Windows environment variable...). I've been lazy > though and not done the same thing for the camlp4 -where test... > b) It adds a simple check for OCaml 3.11 (it would be better if it did a > >= 3.11 check but I haven't bothered to bring up the GNU make info pages to > check the syntax for doing that!) and uses ocamlmklib instead of manually > building the stub libraries if OCaml 3.11 is found - the manual build > instructions included in OCamlMakefile are for 3.10 and earlier and so don't > work (i.e. non-flexlink linking) > > OK, so at this stage it looks as though we should be ready to build. But > if I run make (with flexlink 0.14 or later) then I get the following errors > (compiling with flexlink 0.13 works, but the resulting library is broken): > > ocamlmklib -LC:/Dev/OCaml/lib -o pcre_stubs pcre_stubs.o -lpcre > c:\Users\DRA\AppData\Local\Temp\dyndll8e6a10.o:pcre_stubs.c:(.text+0x205): > undefined reference to `__imp__pcre_callout' > [and several more missing __imp__pcre_... messages] > > The problem is in C:\Dev\OCaml\lib, it appears. In there are libpcre.a, > libpcre.dll.a and libpcre.la. If I rename libpcre.a to libpcre.old.a and > then libpcre.dll.a to libpcre.a then the build works and the resulting > library builds. As far as I can tell, this is something to do with libtool > but I know very little about this - is the inability of the library to link > without renaming these files something to do with using flexlink as the > linker? If I link a test program in C using -lpcre then it works - but is > that because gcc knows how to read .la files and looks for the libpcre.dll.a > file correctly? > > However, once this is followed through, the library does correctly build > and install - and the examples all seem to be working. So, finally, it's > cheerio to the Str module for me :o) > > Any pointers appreciated! > > > David > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------