caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Building PCRE-OCaml on Win32
@ 2005-10-27 19:54 Roger Levy
  2005-10-27 19:58 ` [Caml-list] " Gerd Stolpmann
  2005-10-27 20:16 ` Peter Jolly
  0 siblings, 2 replies; 10+ messages in thread
From: Roger Levy @ 2005-10-27 19:54 UTC (permalink / raw)
  To: caml-list

I'm having difficulty installing PCRE-OCaml in my Cygwin OCaml 
installation.  I have the packages OCaml 3.08.1-1, libpcre 6.3-1, and 
pcre 6.3-1 all from a default recent Cygwin installation, so it seems to 
me that I should be able to install PCRE-OCaml (I'm getting the most 
recent version, 5.10.1) straight away.  Here is what I get, though:

=====

/tmp/pcre-ocaml-5.10.1 $ make
[everything succeeds, though there is one warning:
pcre_stubs.c:1: warning: -fPIC ignored for target (all code is position 
independent)
]

/tmp/pcre-ocaml-5.10.1 $ make install
make[1]: Entering directory `/tmp/pcre-ocaml-5.10.1/lib'

Installing library with ocamlfind
ocamlfind install  pcre META pcre.mli pcre.cmi pcre.cma pcre.cmxa pcre.a 
libpcre_stubs.a dllpcre_stubs.so
ocamlfind: Package pcre is already installed; please remove it first - 
(directory /usr/lib/ocaml/site-lib/pcre already exists)
make[1]: *** [libinstall] Error 2
make[1]: Leaving directory `/tmp/pcre-ocaml-5.10.1/lib'
make: *** [install] Error 2

=====

If I try to uninstall, however, I get the following problem:

=====

/tmp/pcre-ocaml-5.10.1 $ make uninstall
make[1]: Entering directory `/tmp/pcre-ocaml-5.10.1/lib'

Uninstalling library with ocamlfind
ocamlfind remove  pcre
ocamlfind: Package `pcre' not found
make[1]: *** [libuninstall] Error 2
make[1]: Leaving directory `/tmp/pcre-ocaml-5.10.1/lib'
make: *** [uninstall] Error 2

=====

Now, the directory /usr/lib/ocaml/site-lib/pcre is actually empty; if I 
delete it and try to install, the following happens:

=====

$ make install
make[1]: Entering directory `/tmp/pcre-ocaml-5.10.1/lib'

Installing library with ocamlfind
ocamlfind install  pcre META pcre.mli pcre.cmi pcre.cma pcre.cmxa pcre.a 
libpcre_stubs.a dllpcre_stubs.so
ocamlfind: dllpcre_stubs.so: No such file or directory
make[1]: *** [libinstall] Error 2
make[1]: Leaving directory `/tmp/pcre-ocaml-5.10.1/lib'
make: *** [install] Error 2

=====

Any suggestions? I really hate using the str library for regular 
expressions, since it has global state.

I notice that Brian Donovan asked the same thing (though he was trying 
to install it using the MSVC and Win32 makefiles, both of which failed) 
about 18 months ago, and didn't seem to get a satisfactory reply!

http://caml.inria.fr/pub/ml-archives/caml-list/2004/05/55a1a6ea9c641248fdc4da86e52f58b9.en.html

Many thanks in advance for any help!

Best,

Roger


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [Caml-list] Building PCRE-OCaml on Win32
@ 2004-05-13 22:32 HENRIKSON, JEFFREY
  0 siblings, 0 replies; 10+ messages in thread
From: HENRIKSON, JEFFREY @ 2004-05-13 22:32 UTC (permalink / raw)
  To: lists; +Cc: caml-list

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




^ permalink raw reply	[flat|nested] 10+ messages in thread
* [Caml-list] Building PCRE-OCaml on Win32
@ 2004-05-11 19:43 brian donovan
  2004-05-12 17:25 ` Markus Mottl
  2004-05-15 12:31 ` Eugene Kotlyarov
  0 siblings, 2 replies; 10+ messages in thread
From: brian donovan @ 2004-05-11 19:43 UTC (permalink / raw)
  To: caml-list

With findlib/OCamlfind now working, I'm one step closer to getting OCaml 
HTTP going.

OCaml HTTP also requires OCamlnet (>= 0.94) and PCRE-OCaml (>= 4.28.2) 
and OCamlnet depends on Markus Mottl's PCRE-OCaml, so that's next up.    
As a newbie, I would normally post my questions to ocaml_beginners 
first, but a previous question in the same vein didn't elicit any 
responses there and though I emailed the author of the MinGW makefile 
(mentioned further on), I haven't yet received a reply.  I am using the 
MinGW port of OCaml 3.07 on WinXP for learning purposes and have a 
complete (all packages) Cygwin install.

If anyone has gotten PCRE-OCaml working on Win32 w/the MinGW port of 
OCaml 3.0.7 w/out MSVC installed, please skip the rest of my email 
(describing what I tried and what happened) and tell me what I need to do. 

The PCRE-OCaml 5.0.8 package (which you can browse here : 
<http://www.oefai.at/~markus/ocaml_sources/pcre-ocaml-5.08.0/> ... 
download here : 
<http://www.ai.univie.ac.at/~markus/home/ocaml_sources.html>), dated in 
the README file as having been prepared in January 2003, contains a 
README.win32 file with instructions divided into two sections : "Install 
libpcre" and "Install ocaml-pcre" and advises at the top "Need Cygwin, 
MSVC, findlib.".  I do not have access to MSVC at present, but I was 
encouraged by the presence of a Makefile.mingw (itself dated November 
2003)  in the pcre_make.win32 folder alongside the Makefile.win32 
referenced in the "Install libpcre" portion of the win32 readme.

First, it occurred to me to wonder whether I did in fact need to install 
libpcre, as I have a full Cygwin install and I see pcre in the package 
list (<http://www.cygwin.com/packages/>).  So my first question is : if 
I already have pcre through Cygwin, do I still need this libpcre?

Assuming that I did need it, I tried following the instructions in the 
win32 readme for installing libpcre.

Unfortunately, there's an oddity in the win32 readme (aside from it not 
mentioning the presence of the Makefile.mingw).  The 4th step in the 
instructions for installing libpcre is "Read 'non-unix-use' and make 
changes [...]", but I've checked every file and  README.win32 contains 
the only instance of the phrase "non-unix-use" within any of the files 
in the package.

Skipping that step, I proceeded to : make -f Makefile.win32

Doing this, I knew that it probably would not work (because of skipping 
step 4 and also because I didn't have MSVC on my system).  Make stopped 
immediately with the message :

*** No rule to make target 'maketables.c', needed by 
'maketables.s.obj'.  Stop.

Then, I tried the MinGW makefile : make -f Makefile.mingw

Result :

*** No rule to make target 'pcre.mli', needed by 'pcre.cmi'.  Stop.

I then chanced the 2nd set of instructions ("Install ocaml-pcre"), 
hoping that maybe I didn't need libpcre but rather only ocaml-pcre.  The 
lib directory has its own Makefile.win32 and I followed the instructions :

make -f Makefile.win32 all

Make chugged for a second and produced the following lines (note : my 
OCaml install lives in C:/ocaml3.0.7) :

echo C:/ocaml3.0.7/lib
cl /nologo /c /MT pcre_stubs.c /Fopcre_stubs.s.obj /IC:/ocaml3.0.7/lib
make: cl: Command not found
make: *** [pcre_stubs.lib] Error 127

Checking the makefile, I saw the use of cl and Googled my problem.  It 
turns out that cl is MVC's compiler. 

Thanks for any advice.

-------------------
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] 10+ messages in thread

end of thread, other threads:[~2005-11-08  2:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-27 19:54 Building PCRE-OCaml on Win32 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
  -- strict thread matches above, loose matches on Subject: below --
2004-05-13 22:32 HENRIKSON, JEFFREY
2004-05-11 19:43 brian donovan
2004-05-12 17:25 ` Markus Mottl
2004-05-15 12:31 ` Eugene Kotlyarov

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