From: "HENRIKSON, JEFFREY" <JEFHEN@SAFECO.com>
To: <lists@lophty.com>
Cc: <caml-list@inria.fr>
Subject: [Caml-list] Building PCRE-OCaml on Win32
Date: Thu, 13 May 2004 15:32:14 -0700 [thread overview]
Message-ID: <9410EC84C0872141B27A2726613EF45D02A534C9@psmrdcex01.psm.pin.safeco.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3347 bytes --]
This makefile currently builds pcre-ocaml on mingw for "dynlinked"
bytecode compilation. I could not get a working native code build. I
think there is an uncorrected problem in Ocaml in this direction. The
common failure is to get a compiled, linked executable that crashes
before running the first line of Ocaml code. I complained about this on
caml-list (not very well) and didn't get an answer. If I have some
time, I'll refine those complaints.
Yes, you must build pcre by yourself if you don't want to depend on the
cygwin runtime. You're on your own with depending on cygwin, as I have
heard mixing cygwin and mingw C runtimes can produce very hard to
diagnose bad problems.
I will also paste here a shell script for compiling pcre sans cygwin.
There's also a code generation command that you have to run, (to
generate maketables.c?) but it's easy enough to figure out.
Jeff Henrikson
Pcre-4.4:
gcc -mno-cygwin -DPOSIX_MALLOC_THRESHOLD=10 -c pcre.c
gcc -mno-cygwin -DPOSIX_MALLOC_THRESHOLD=10 -c maketables.c
gcc -mno-cygwin -DPOSIX_MALLOC_THRESHOLD=10 -c get.c
gcc -mno-cygwin -DPOSIX_MALLOC_THRESHOLD=10 -c study.c
gcc -shared -mno-cygwin pcre.o maketables.o get.o study.o -o
libpcre-mingw.dll -
Wl,--out-implib,libpcre-mingw.dll.a
-----Original Message-----
From: Jeff Henrikson [mailto:jehenrik@yahoo.com]
Sent: Wednesday, May 12, 2004 1:31 PM
To: brian donovan
Subject: Re: PCRE-OCaml for OCaml 3.0.7 (MinGW) on Win32
Hi,
Yes there are some issues with building pcre-ocaml on mingw. I didn't
know about them all when I submitted that patch. I actually believe
there are problems with ocaml itself on mingw, specifically with regard
to linking C code. I have had identical problems in my other C modules
too, unique to mingw.
Sorry but I am not at work today, where my pcre-ocaml build lives. I
can send you my current makefile tomorrow.
Not all the things one would like to do work in this ocaml release under
mingw. There are some super freaky things like building excutables that
crash before running a line of code and such. I asked some imprecise
questions about them on the list a while back, but didn't get answered.
This was all for ocaml-3.07. I have not taken the time to ask them more
precisely.
Right now I believe I limit myself to building a bytecode "dynlinked"
dll.
I think that first makefile I sent out didn't even have -mno-cygwin in
it. Use it.
Apologies.
Jeff Henrikson
+++ brian donovan [11/05/04 21:25 +0800]:
> Hello,
>
> I'm attempting to get PCRE-OCaml 5.0.8 working on a WinXP system on
> which I've installed Cygwin (all packages) and the MinGW port of OCaml
> 3.0.7 (precompiled w/installer). Findlib/OCamlfind 1.0.4 is already
> installed.
>
> I've encountered some difficulties in getting PCRE-OCaml 5.0.8 going
> and found your email in the header of a MinGW-based makefile included
> in the package. While I can see that it's been many months since
Markus
> Mottl included your makefile w/his work (predating the release of
OCaml
> 3.0.7 it seems), I'm emailing in the hope that you're still working
with
> OCaml on Win32 and can advise me on building PCRE-OCaml.
>
> I'd be grateful for any guidance thatyou can give.
>
> Thanks,
> brian donovan
--
[-- Attachment #2: Makefile.mingw --]
[-- Type: application/octet-stream, Size: 1789 bytes --]
#
# MinGW based makefile, adapted by Jeff Henrikson, jehenrik@yahoo.com,
# November 2003.
#
# usage:
# make -f Makefile.mingw
# make -f Makefile.mingw opt
#
# File is provided as is. Let the buyer beware!
#LIB_PATH=d:\ocaml\libs
#INC_PATH=d:/ocaml/lib d:/ocaml/includes
INC_PATH=$(shell ocamlc -where)
all: pcre.cma
opt: pcre.cmxa
pcre.cmo: pcre.cmi pcre.ml
ocamlc -c pcre.ml -o pcre.cmo
pcre.cmi: pcre.mli
ocamlc -c pcre.mli -o pcre.cmi
#These were the MS commands:
#cl /nologo /c /MT pcre_stubs.c /Fopcre_stubs.s.obj $(addprefix /I,$(INC_PATH))
#lib /nologo /debugtype:CV /OUT:dllpcre_stubs.dll.a pcre_stubs.s.obj
#echo $(INC_PATH)
#
# -D__MINGW32__
pcre_stubs.o: pcre_stubs.c
gcc -mno-cygwin -I $(INC_PATH) -I/usr/include -I /usr/include/w32api -c pcre_stubs.c
#libpcre_stubs.a: pcre_stubs.o
# ar cr libpcre_stubs.a pcre_stubs.o
# ranlib libpcre_stubs.a
libpcre_stubs.a: pcre_stubs.o
ar cr libpcre_stubs.a pcre_stubs.o
ranlib libpcre_stubs.a
dllpcre_stubs.dll: pcre_stubs.o
gcc -g -mno-cygwin -shared -L `ocamlc -where` -o dllpcre_stubs.dll pcre_stubs.o -L . -lpcre-mingw `ocamlc -where`/ocamlrun.a
chmod 777 dllpcre_stubs.dll
pcre.cmx: pcre.cmi pcre.ml
ocamlopt -c pcre.ml -o pcre.cmx
pcre.cmxa: pcre.cmx -g libpcre_stubs.a libpcre-mingw.dll
ocamlopt -verbose -a -o pcre.cmxa pcre.cmx \
-cclib -lpcre-mingw -cclib -lpcre_stubs
pcre.cma: pcre.cmo dllpcre_stubs.dll
ocamlc -a -o pcre.cma pcre.cmo \
-dllib -lpcre_stubs
# -cclib -lpcre_stubs -cclib libpcre-mingw.dll
# -cclib -lpcre_stubs -cclib -lpcre-mingw
#try: ocamlc -o test.exe pcre.cma test.ml
install:
ocamlfind install pcre META pcre.cma pcre.cmxa pcre.cmi pcre.mli \
pcre.lib
uninstall:
ocamlfind remove pcre
clean:
rm *.cm* *.o libpcre_stubs.dll dllpcre_stubs.dll
next reply other threads:[~2004-05-13 22:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-13 22:32 HENRIKSON, JEFFREY [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-10-27 19:54 Roger Levy
2005-10-27 19:58 ` [Caml-list] " Gerd Stolpmann
2005-10-27 20:06 ` Roger Levy
2005-10-27 20:16 ` Peter Jolly
2005-10-27 21:30 ` Roger Levy
2005-11-08 2:44 ` Igor Pechtchanski
2004-05-11 19:43 brian donovan
2004-05-12 17:25 ` Markus Mottl
2004-05-15 12:31 ` Eugene Kotlyarov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9410EC84C0872141B27A2726613EF45D02A534C9@psmrdcex01.psm.pin.safeco.com \
--to=jefhen@safeco.com \
--cc=caml-list@inria.fr \
--cc=lists@lophty.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox