caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Building findlib/OCamlfind on Win32 system
@ 2004-05-10  5:59 brian donovan
  2004-05-10  8:21 ` Yutaka OIWA
  2004-05-10 11:22 ` Eugene Kotlyarov
  0 siblings, 2 replies; 6+ messages in thread
From: brian donovan @ 2004-05-10  5:59 UTC (permalink / raw)
  To: caml-list

Hello,

I posted this query to ocaml_beginners a few days ago and have received 
no replies as of yet.  Likewise my email to Yutaka Oiwa, the creator of 
the patch mentioned below.  I haven't approached findlib's author as he 
stated in the INSTALL file accompanying the findlib package that he does 
not have access to Windows systems or tools.  I'm reposting here in the 
hopes that there may be other Win32 OCaml users on Caml-list who've 
installed findlib ....

I'm an OCaml newbie (actually, I'm new to functional languages 
altogether and, for all intents and purposes, to compiled languages as 
well).  I've installed the standalone MinGW port of OCaml 3.0.7 on a 
WinXP system for learning purposes.

Aside from some probably to-be-expected problems (compiling a program 
that used Unix's fork, for example, prompted the compiler to complain 
that fork was not implemented, which I guess it may not have been in the 
MinGW 3.0.7 port), everything with the core seems fine.  I've been 
having some difficulties, probably due to my own ignorance more than 
anything else, today, however.  I don't know how many others on this 
list may have gone through the same process (or even how many of you are 
using OCaml on Win32, if any), so I'll spill my guts here and hope that 
I've done something obviously wrong that another member can point out.

I want to try to use "Zack's OCaml Http Daemon" module 
(<http://www.bononia.it/~zack/ocaml-http.en.html>), which relies on some 
libraries that aren't included with the default OCaml system :  findlib 
(>= 0.8), ocamlnet (>= 0.94), and pcre-ocaml (>= 4.28.2).  I began with 
findlib (available here : <http://www.ocaml-programming.de/packages/>).  
The current version is 1.0.4.  Findlib's author points out that for 
MinGW users, someone has prepared a patch to make findlib v0.8.1 work 
with MinGW port of OCaml.  I downloaded findlib 0.8.1 and the patch 
(from here : 
<http://www.ocaml-programming.de/packages/index-alt.html>).  I extracted 
the tarball, pasted the patch file into the top findlib directory and 
applied the patch (I've got the Cygwin toolchain installed).  Patch 
complained about an error when I applied it initially and suggested that 
I try using strip n when applying, so I started from scratch and used 
strip 1 :

patch -b -strip 1 -i patchfilename

This time, no error messages.  Great.

The rest of the build went fine : ./configure, make all, make opt, make 
install, and make clean (as recommended in the INSTALL file bundled with 
findlib).  I tried using findlib.  Nothing seemed to work except the 
command findlib ocamlbrowser, which launched a little 4 pane gui that 
listed most (but not all?) of the modules/libraries in the lib directory 
of my OCaml install (stublibs, labltk, findlib itself, forex were not 
visible - shouldn't they be?).  Trying other commands, like "ocamlfind 
query Unix" or "ocamlfind query Array" or "ocamlfind list" gave me nada 
- just a fresh prompt.

It occurred to me that perhaps my mistake was in building findlib 
outside of the file hierarchy of my OCaml install, so I re-extracted the 
contents of the findlib tarball, copied the extracted findlib folder 
into the lib directory, applied the patch, yadda yadda.  Same result.  
[Side question : when building libraries for OCaml on WIndows, does the 
location in relation to the OCaml install matter?]

Can anyone give me any tips on getting findlib/OCamlfind up and running 
properly on Win32?  I'd be very grateful.

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

* Re: [Caml-list] Building findlib/OCamlfind on Win32 system
  2004-05-10  5:59 [Caml-list] Building findlib/OCamlfind on Win32 system brian donovan
@ 2004-05-10  8:21 ` Yutaka OIWA
  2004-05-10 17:42   ` Solved! ... " brian donovan
  2004-05-10 11:22 ` Eugene Kotlyarov
  1 sibling, 1 reply; 6+ messages in thread
From: Yutaka OIWA @ 2004-05-10  8:21 UTC (permalink / raw)
  To: caml-list

Hello brian,

>> On Mon, 10 May 2004 13:59:28 +0800, brian donovan <lists@lophty.com> said:

brian> Hello,
brian> I posted this query to ocaml_beginners a few days ago and have received 
brian> no replies as of yet.  Likewise my email to Yutaka Oiwa, the creator of 
brian> the patch mentioned below.  I haven't approached findlib's author as he 
brian> stated in the INSTALL file accompanying the findlib package that he does 
brian> not have access to Windows systems or tools.  I'm reposting here in the 
brian> hopes that there may be other Win32 OCaml users on Caml-list who've 
brian> installed findlib ....

I'm sorry I have missed your direct inquery.
I have just drown in the sea of spams these days...

brian> I'm an OCaml newbie (actually, I'm new to functional languages 
brian> altogether and, for all intents and purposes, to compiled languages as 
brian> well).  I've installed the standalone MinGW port of OCaml 3.0.7 on a 
brian> WinXP system for learning purposes.

...

brian> with MinGW port of OCaml.  I downloaded findlib 0.8.1 and the patch 
brian> (from here : 
brian> <http://www.ocaml-programming.de/packages/index-alt.html>).  I extracted 
brian> the tarball, pasted the patch file into the top findlib directory and 
brian> applied the patch (I've got the Cygwin toolchain installed).  Patch 
brian> complained about an error when I applied it initially and suggested that 
...

brian> The rest of the build went fine : ./configure, make all, make opt, make 
brian> install, and make clean (as recommended in the INSTALL file bundled with 
brian> findlib).  I tried using findlib.  Nothing seemed to work except the 
brian> command findlib ocamlbrowser, which launched a little 4 pane gui that 
brian> listed most (but not all?) of the modules/libraries in the lib directory 
brian> of my OCaml install (stublibs, labltk, findlib itself, forex were not 
brian> visible - shouldn't they be?).  Trying other commands, like "ocamlfind 
brian> query Unix" or "ocamlfind query Array" or "ocamlfind list" gave me nada 
brian> - just a fresh prompt.

One possibility is simply that the findlib 0.8.1 does not work properly
with OCaml 3.0.7. This is due to the changed (maybe undocumented)
semantics of the Arg module from OCaml core library.
This problem is already fixed in the newer versions of the original findlib.

I had written an ad-hoc patch to findlib 0.8.1 before new official
findlib was released. That is obsoleted but left as-is at
http://www.yl.is.s.u-tokyo.ac.jp/~oiwa/pub/caml/frontend.ml.ocaml307.patch .
This patch was written with CVS versions of OCaml between 3.0.6 and 3.0.7,
so it may work or may not work with current 3.0.7, but you can try anyway.
Possibly the better way is to backport the corresponding portion of
code from current findlib, or to port my patch into newer findlib.

Unfortunately, I am currently not using OCaml/mingw deeply,
so the patch mentioned above is not maintained heavily.
If you succeed to fix the problem, please tell me.

-- 
Yutaka Oiwa              Yonezawa Lab., Dept. of Computer Science,
      Graduate School of Information Sci. & Tech., Univ. of Tokyo.
                    <oiwa@yl.is.s.u-tokyo.ac.jp>, <yutaka@oiwa.jp>
PGP fingerprint = C9 8D 5C B8 86 ED D8 07  EA 59 34 D8 F4 65 53 61

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

* Re: [Caml-list] Building findlib/OCamlfind on Win32 system
  2004-05-10  5:59 [Caml-list] Building findlib/OCamlfind on Win32 system brian donovan
  2004-05-10  8:21 ` Yutaka OIWA
@ 2004-05-10 11:22 ` Eugene Kotlyarov
       [not found]   ` <409F825B.4050006@lophty.com>
  1 sibling, 1 reply; 6+ messages in thread
From: Eugene Kotlyarov @ 2004-05-10 11:22 UTC (permalink / raw)
  To: brian donovan, caml-list

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

brian donovan wrote:

> Can anyone give me any tips on getting findlib/OCamlfind up and running 
> properly on Win32?  I'd be very grateful.
> 
There is always the same problems with Unix-oriented soft on Win32.
1. Make sure that your ocaml install path contains no spaces e.g. 
c:\ocamlmgw
2. in your OCAMLLIB variable use forward slashes e.g. c:/ocamlmgw/lib
3. apply following patch to findlib configure script
   patch <configure.diff
4. run it with -mspath option
   ./configure -mspath
after it make everything else e.g. make, make opt, make install, make clean.

This should work fine for both MSVC and MingW OCaml ports.

And you should not build findlib in OCaml file hierarchy, you should 
build it some temporary directory, 'make install' will copy everything
to the right places.


[-- Attachment #2: configure.diff --]
[-- Type: text/plain, Size: 1605 bytes --]

--- configure.orig	2004-04-04 15:42:39.000000000 +0400
+++ configure	2004-05-10 12:52:36.453125000 +0400
@@ -103,6 +103,12 @@
     eval "$v=\"$p\""
 }
 
+apply_mspath () {
+    v=$1
+    eval "p=\"\$$v\""
+    p="`cygpath -m -l \"$p\"`"
+    eval "$v=\"$p\""
+}
 
 ######################################################################
 # Here the main program begins:
@@ -115,6 +121,7 @@
 ocaml_sitelib=""
 ocamlfind_config=""
 use_cygpath=0
+use_mspath=0
 with_toolbox=0
 with_topfind=1
 
@@ -135,6 +142,9 @@
 	-cygpath) use_cygpath=1
 	         shift
 		 ;;
+  	-mspath) use_mspath=1
+  	         shift
+ 		 ;;
 	-with-toolbox) with_toolbox=1
 	         shift
 		 ;;
@@ -151,6 +161,7 @@
 		  echo "  -sitelib path        set the location of the site-specific packages" 1>&2
                   echo "  -config path         set the location of the configuration file" 1>&2
 		  echo "  -cygpath             fix paths for cygwin environment" 1>&2
+ 		  echo "  -mspath              fix paths for MSVC environment" 1>&2
 		  echo "  -with-toolbox        also build the toolbox" 1>&2
 		  echo "  -no-topfind          don't install topfind script into stdlib directory" 1>&2
 		  exit
@@ -380,6 +391,13 @@
     parts="$parts findlib-toolbox"
 fi
 
+if [ ${use_mspath} -gt 0 ]; then
+    echo "Applying mspath..."
+    apply_mspath ocaml_core_bin
+    apply_mspath ocamlfind_bin
+    apply_mspath ocamlfind_config
+fi
+
 echo "# Makefile.config written by configure" >Makefile.config
 echo "OCAML_CORE_STDLIB=${ocaml_core_stdlib}" >>Makefile.config
 echo "OCAML_CORE_BIN=${ocaml_core_bin}" >>Makefile.config

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

* Solved ! ... Re: [Caml-list] Building findlib/OCamlfind on Win32 system
       [not found]     ` <409FA788.2000106@narod.ru>
@ 2004-05-10 17:27       ` brian donovan
  0 siblings, 0 replies; 6+ messages in thread
From: brian donovan @ 2004-05-10 17:27 UTC (permalink / raw)
  To: ekot, caml-list

[-- Attachment #1: Type: text/plain, Size: 3559 bytes --]

Thank you !

     I apologize - I had stupidly forgotten to start a new console 
window after changing the value of $OCAMLLIB (through 
Start>Settings>Control Panel> System>Advanced : Environment Variables; 
System Variables), so it was still using the path with the 
wrong-direction slashes.  Following your advice (my OCaml install is in 
C:\ocaml3.0.7 and echoing $OCAMLLIB at a bash prompt now gives me 
C:/ocaml3.0.7/lib), findlib 1.0.7 works (afaict) perfectly - ocamlfind 
list gives output, ocamlfind query <packagename> does as well, etc.

     Although it's now clear that your patch + advice worked, I'm 
including the patched configure script (attached) and my $PATH var value 
(below) just in case you can use the data.  May I suggest that you share 
your patch and instructions with Gerd Stolpmann of 
<http://www.ocaml-programming.de> (email <gerd(at)gerd-stolpmann.de>)?  
I think he'd be grateful, as would any other poor souls who want to get 
findlib working on Win32*.

* The MinGW installer, by default (at least on my system), tries to 
place OCaml under the Program Files hierarchy and uses \'s in the value 
for $OCAMLLIB.   Because many, but not all, other Win32 ports of Unix 
tools advise users to avoid spaces in file paths, I went ahead and 
placed OCaml at a location with a space-free path, but I wouldn't have 
otherwise known to change the slashes in $OCAMLLIB's value.

$PATH : 
C:\cygwin\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program 
Files\Common Files\Adaptec 
Shared\System;c:\matlab6p5\bin\win32;C:\Program 
Files\cvsnt;C:\ocaml3.0.7\bin

Thanks again


Eugene Kotlyarov wrote:

> brian donovan wrote:
>
>>     Thanks for your help.  The patch that you attached to your email 
>> works on the configure script for findlib 1.0.4 (current version), 
>> but not on the configure script for findlib 0.8.1 - is it intended as 
>> a patch for 1.0.4?  If, so that's great.  :)  In your advice, I have #1 
>
> Yes this patch is only for 1.0.4
>
>> and #2 covered, the patch, as I said, is applied to v1.0.4's 
>> configure script with no problems, but I hit a snag when I try to 
>> configure.  ./configure and ./configure -mspath both generate an 
>> endless scroll of "dirname : too few arguments" error messages that 
>> only stops when I quit the console window.
>
> This is very strange.
> Can you send me resulting configure script and output of the
> echo $PATH
> command
>
> Also one thing you may try is to find following functions in configure
> script and change comments like shown below. This also requires you to 
> have 'which' command, there is package with such name in cygwin
>
> in_path () {
> #    # Does $1 exist in $PATH?
> #    IFS=":"
> #    for d in $PATH; do
> #    if test -x "$d/$1"; then
> #        IFS="$oldifs"
> #        return 0
> #    fi
> #    done
> #    IFS="$oldifs"
> #    return 1
> #--- The following is not portable enough:
>     if test -x `type -p ls`; then
>     # type -p works!
>         type -p $1 >/dev/null
>     else
>         # use 'which' instead
>         p=`which $1`
>     test -x "$p"
>     fi
> }
>
> get_path () {
> #    IFS=":"
> #    for d in $PATH; do
> #    if test -x "$d/$1"; then
> #        IFS="$oldifs"
> #        echo "$d/$1"
> #        return
> #    fi
> #    done
> #    IFS="$oldifs"
> #--- The following is not portable enough:
>     if test -x `type -p ls`; then
>     # type -p works!
>         type -p $1
>     else
>         # use 'which' instead
>         p=`which $1`
>     test -x "$p" && echo $p
>     fi
> }
>
>
>


[-- Attachment #2: configure --]
[-- Type: text/plain, Size: 10526 bytes --]

#! /bin/sh
# $Id: configure 70 2004-04-04 10:48:18Z gerd $
# ----------------------------------------------------------------------
#

# Some functions

#set -x

version="1.0.4"

# Remember the old IFS value:
oldifs="$IFS"


in_path () {
    # Does $1 exist in $PATH?
    IFS=":"
    for d in $PATH; do
	if test -x "$d/$1"; then
	    IFS="$oldifs"
	    return 0
	fi
    done
    IFS="$oldifs"
    return 1
#--- The following is not portable enough:
#    if test -x `type -p ls`; then
#	# type -p works!
#        type -p $1 >/dev/null
#    else
#        # use 'which' instead
#        p=`which $1`
#	test -x "$p"
#    fi
}


get_path () {
    IFS=":"
    for d in $PATH; do
	if test -x "$d/$1"; then
	    IFS="$oldifs"
	    echo "$d/$1"
	    return
	fi
    done
    IFS="$oldifs"
#--- The following is not portable enough:
#    if test -x `type -p ls`; then
#	# type -p works!
#        type -p $1
#    else
#        # use 'which' instead
#        p=`which $1`
#	test -x "$p" && echo $p
#    fi
}


get_stdlib () {
    # Older versions of ocamlc do not accept -where, so there is a fallback
    # method:
    ocamlc -where 2>/dev/null || {
	ocamlc -v | sed -n -e "/Standard library directory/s/.*: \(.*\)/\1/p"; }
}


get_lib () {
    # $1: name of a library to search for
    # $2...: places to test
    libname="$1"
    while [ "$#" != "0" ]; do
	if [ -f "$1/lib${libname}.so" -o -f "$1/lib${libname}.a" ]; then
	    echo "$1"
	    return 0
	fi
	shift
    done
    return 1
}


get_lib_file () {
    # $1: name of library without "lib" and suffix
    # $2: directory
    # returns full path of library
    if [ -f "$2/lib$1.so" ]; then
	echo "$2/lib$1.so"
    elif [ -f "$2/lib$1.a" ]; then
	echo "$2/lib$1.a"
    else
	echo ""
    fi
}


apply_cygpath () {
    v=$1
    eval "p=\"\$$v\""
    p="`cygpath -w -s \"$p\"`"
    p="`cygpath -u \"$p\"`"
    eval "$v=\"$p\""
}

apply_mspath () {
    v=$1
    eval "p=\"\$$v\""
    p="`cygpath -m -l \"$p\"`"
    eval "$v=\"$p\""
}

######################################################################
# Here the main program begins:

######################################################################
# Interpret the command line

ocamlfind_bin=""
ocamlfind_man=""
ocaml_sitelib=""
ocamlfind_config=""
use_cygpath=0
use_mspath=0
with_toolbox=0
with_topfind=1

while [ "$#" != "0" ]; do
    case "$1" in
        -bindir) ocamlfind_bin=$2
	         shift 2
		 ;;
        -mandir) ocamlfind_man=$2
	         shift 2
		 ;;
        -sitelib) ocaml_sitelib=$2
	          shift 2
		  ;;
        -config) ocamlfind_config=$2
	         shift 2
		 ;;
	-cygpath) use_cygpath=1
	         shift
		 ;;
  	-mspath) use_mspath=1
  	         shift
 		 ;;
	-with-toolbox) with_toolbox=1
	         shift
		 ;;
	-no-topfind) with_topfind=0
	         shift
		 ;;
	-version)
	         echo "$version"
		 exit 0
		 ;;
        -h|-help|--help) echo "usage: configure [options]" 1>&2
		  echo "  -bindir path         where binaries are installed" 1>&2
		  echo "  -mandir path         where manual pages are installed" 1>&2
		  echo "  -sitelib path        set the location of the site-specific packages" 1>&2
                  echo "  -config path         set the location of the configuration file" 1>&2
		  echo "  -cygpath             fix paths for cygwin environment" 1>&2
 		  echo "  -mspath              fix paths for MSVC environment" 1>&2
		  echo "  -with-toolbox        also build the toolbox" 1>&2
		  echo "  -no-topfind          don't install topfind script into stdlib directory" 1>&2
		  exit
		  ;;
         *)       echo "configure: run 'configure -h' to get help" 1>&2
		  exit 1
		  ;;
    esac
done

echo "Welcome to findlib version $version"
echo "Configuring core..."


#######################################################################
# inspect the system

# Some standard Unix tools must be available:

for tool in sed awk ocamlc uname rm make cat m4 dirname basename; do
    if in_path $tool; then true; else
	echo "configure: $tool not in PATH; this is required" 1>&2
	exit 1
    fi
done

# Find out standard library location

ocaml_core_stdlib=`get_stdlib`
if [ ! -d "$ocaml_core_stdlib" ]; then
   echo "configure: cannot determine ocaml's standard library directory" 1>&2
    exit 1
fi

if [ ${use_cygpath} -gt 0 ]; then
    echo "Applying cygpath..."
    apply_cygpath ocaml_core_stdlib
fi

# Set site-lib directory:

if [ -z "$ocaml_sitelib" ]; then
    case "$ocaml_core_stdlib" in
	/opt/*)		ocaml_sitelib=`dirname ${ocaml_core_stdlib}`/site-lib
			;;
	*)		ocaml_sitelib="${ocaml_core_stdlib}/site-lib"
			;;
    esac
fi

# Find out the directory where ocamlc is:

ocamlc=`get_path ocamlc`
ocaml_core_bin=`dirname ${ocamlc}`

# Set the directory of ocamlfind:

test -n "$ocamlfind_bin" || ocamlfind_bin="$ocaml_core_bin"

# Find the directory for the manual:

# Fallback:
ocaml_core_man=/usr/local/man

d="$ocaml_core_bin"
while [ "$d" != '/' ]; do
    f=0
    if [ -d "$d/man/man1" ]; then
	if [ -f "$d/man/man1/ocamlc.1" -o \
	     -f "$d/man/man1/ocamlc.1.gz" -o \
	     -f "$d/man/man1/ocamlc.1.Z" ]; then
	     f=1
	fi
    else
	if [ -d "$d/man/mann" ]; then
	    if [ -f "$d/man/mann/ocamlc.n" -o \
		 -f "$d/man/mann/ocamlc.n.gz" -o \
		 -f "$d/man/mann/ocamlc.n.Z" ]; then
		f=1
	    fi
	fi
    fi
    if [ "$f" = "1" ]; then
	ocaml_core_man="$d/man"
	d="/"
    else
	d=`dirname $d`
    fi
done

# Set the directory for ocamlfind's manuals:

test -n "$ocamlfind_man" || ocamlfind_man="$ocaml_core_man"

# Guess the right directory for the configuration file:

if [ -z "${ocamlfind_config}" ]; then
    d="$ocaml_core_bin"
    case "$d" in
        */bin)
	    ocamlfind_config=`dirname $d`/etc/findlib.conf
	    ;;
	*)
	    ocamlfind_config=/usr/local/etc/findlib.conf
	    # Fallback value
	    ;;
    esac
fi


######################################################################
# Test the threading model

echo "Testing threading model..."

if ocamlc -vmthread >/dev/null 2>/dev/null; then
    :
else
    echo "The -vmthread switch is not supported: Your ocaml version is too old!"
    exit 1
fi

rm -f itest-aux/simple
ocamlc -custom -thread -o itest-aux/simple unix.cma threads.cma itest-aux/simple_threads.ml \
    >itest-aux/err.out 2>&1
output=`cat itest-aux/err.out`

if [ -z "$output" ]; then
    ocaml_threads="posix"
else
    ocaml_threads="vm"
fi

######################################################################
# Does this version of OCaml support autolinking?

# Works for O'Caml >= 3.00 on. Because findlib can only be compiled
# with these O'Caml versions, we can safely assume that autolinking
# is enabled.

ocaml_autolink="true"

######################################################################
# Configure libraries

echo "Configuring libraries..."

# Check whether Bigarray is present.

lbigarray=bigarray
# always

# Check whether labltk is present.

if [ -f "${ocaml_core_stdlib}/labltk/labltk.cma" ]; then
    llabltk=labltk
    echo "labltk: found"
else
    llabltk=''
    echo "labltk: not present"
    if [ $with_toolbox -gt 0 ]; then
	echo "Sorry, toolbox requires labltk - omitting toolbox."
    fi
    with_toolbox=0
fi

# Check on camlp4:

if in_path camlp4; then
    lcamlp4=camlp4
    camlp4_dir=`camlp4 -where`
    camlp4_version=`camlp4 -v 2>&1`
    echo "camlp4: found"
else
    lcamlp4=''
    echo "camlp4: not present"
fi

# Generate the META files now.

l="dbm dynlink graphics num num-top str threads unix stdlib bigarray $llabltk $lcamlp4"

for dir in site-lib-src/*; do
    # We do not really know if $dir is a directory.
    rm -f $dir/META
done

for lib in $l; do
    if=""
    if [ -f site-lib-src/$lib/interfaces.out ]; then
	if=`cat site-lib-src/$lib/interfaces.out`
    fi
    m4 -Dos=$os \
	"-Dtype_of_threads=${ocaml_threads}" \
	"-Dcamlp4_dir=${camlp4_dir}" \
	"-Dcamlp4_version=${camlp4_version}" \
	"-Dinterfaces=${if}" \
	"-Dfindlib_version=${version}" \
	site-lib-src/$lib/META.in >site-lib-src/$lib/META
    echo "Configuration for $lib written to site-lib-src/$lib/META"
done

for part in `cd src; echo *`; do
    if [ -f "src/$part/META.in" ]; then
	sed -e "s/@VERSION@/$version/g" src/$part/META.in >src/$part/META
    fi
done

# Finally a check for Cygwin:

exec_suffix=
case `uname` in
  CYGWIN*)
    exec_suffix=.exe
    echo "Cygwin found; using .exe as suffix for binaries"
    ;;
  *)
    true ;;
esac


######################################################################
# Write Makefile.config

parts="findlib"
if [ $with_toolbox -gt 0 ]; then
    parts="$parts findlib-toolbox"
fi

if [ ${use_mspath} -gt 0 ]; then
    echo "Applying mspath..."
    apply_mspath ocaml_core_bin
    apply_mspath ocamlfind_bin
    apply_mspath ocamlfind_config
fi

echo "# Makefile.config written by configure" >Makefile.config
echo "OCAML_CORE_STDLIB=${ocaml_core_stdlib}" >>Makefile.config
echo "OCAML_CORE_BIN=${ocaml_core_bin}" >>Makefile.config
echo "OCAML_CORE_MAN=${ocaml_core_man}" >>Makefile.config
echo "OCAML_SITELIB=${ocaml_sitelib}" >>Makefile.config
echo "OCAML_THREADS=${ocaml_threads}" >>Makefile.config
echo "OCAMLFIND_BIN=${ocamlfind_bin}" >>Makefile.config
echo "OCAMLFIND_MAN=${ocamlfind_man}" >>Makefile.config
echo "OCAMLFIND_CONF=${ocamlfind_config}" >>Makefile.config
echo "OCAML_AUTOLINK=${ocaml_autolink}" >>Makefile.config
echo "EXEC_SUFFIX=${exec_suffix}" >>Makefile.config
echo "PARTS=${parts}" >>Makefile.config
echo "INSTALL_TOPFIND=${with_topfind}" >>Makefile.config

# All OK

echo
echo "About the OCAML core installation:"
echo "    Standard library:      ${ocaml_core_stdlib}"
echo "    Binaries:              ${ocaml_core_bin}"
echo "    Manual pages:          ${ocaml_core_man}"
echo "    Multi-threading type:  ${ocaml_threads}"
echo "The directory of site-specific packages will be"
echo "    site-lib:              ${ocaml_sitelib}"
echo "The configuration file is written to:"
echo "    findlib config file:   ${ocamlfind_config}"
echo "Software will be installed:"
echo "    Libraries:             in <site-lib>/findlib"
echo "    Binaries:              ${ocamlfind_bin}"
echo "    Manual pages:          ${ocamlfind_man}"
if [ $with_topfind -gt 0 ]; then
    echo "    topfind script:        ${ocaml_core_stdlib}"
else
    echo "    topfind script:        omitted"
fi

if [ $with_toolbox -gt 0 ]; then
    echo "Toolbox:                   yes"
else
    echo "Toolbox:                   no"
fi

echo
echo "Configuration has been written to Makefile.config"
echo
echo "You can now do 'make all', and optionally 'make opt', to build ocamlfind."

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

* Solved!  ... Re: [Caml-list] Building findlib/OCamlfind on Win32 system
  2004-05-10  8:21 ` Yutaka OIWA
@ 2004-05-10 17:42   ` brian donovan
  2004-05-10 18:17     ` Yutaka OIWA
  0 siblings, 1 reply; 6+ messages in thread
From: brian donovan @ 2004-05-10 17:42 UTC (permalink / raw)
  To: caml-list, oiwa

Yutaka OIWA wrote:

>Hello brian,
>
>  
>
>>>On Mon, 10 May 2004 13:59:28 +0800, brian donovan <lists@lophty.com> said:
>>>      
>>>
>
>brian> Hello,
>brian> I posted this query to ocaml_beginners a few days ago and have received 
>brian> no replies as of yet.  Likewise my email to Yutaka Oiwa, the creator of 
>brian> the patch mentioned below.  I haven't approached findlib's author as he 
>brian> stated in the INSTALL file accompanying the findlib package that he does 
>brian> not have access to Windows systems or tools.  I'm reposting here in the 
>brian> hopes that there may be other Win32 OCaml users on Caml-list who've 
>brian> installed findlib ....
>
>I'm sorry I have missed your direct inquery.
>I have just drown in the sea of spams these days...
>  
>
I sympathize completely.  Although the junk mail controls in Mozilla 
Mail are great, I still have to wade through the suspected spam 
periodically to look for false positives and it's something that I admit 
that I don't get around to nearly as often as I should.

>brian> I'm an OCaml newbie (actually, I'm new to functional languages 
>brian> altogether and, for all intents and purposes, to compiled languages as 
>brian> well).  I've installed the standalone MinGW port of OCaml 3.0.7 on a 
>brian> WinXP system for learning purposes.
>
>...
>
>brian> with MinGW port of OCaml.  I downloaded findlib 0.8.1 and the patch 
>brian> (from here : 
>brian> <http://www.ocaml-programming.de/packages/index-alt.html>).  I extracted 
>brian> the tarball, pasted the patch file into the top findlib directory and 
>brian> applied the patch (I've got the Cygwin toolchain installed).  Patch 
>brian> complained about an error when I applied it initially and suggested that 
>...
>
>brian> The rest of the build went fine : ./configure, make all, make opt, make 
>brian> install, and make clean (as recommended in the INSTALL file bundled with 
>brian> findlib).  I tried using findlib.  Nothing seemed to work except the 
>brian> command findlib ocamlbrowser, which launched a little 4 pane gui that 
>brian> listed most (but not all?) of the modules/libraries in the lib directory 
>brian> of my OCaml install (stublibs, labltk, findlib itself, forex were not 
>brian> visible - shouldn't they be?).  Trying other commands, like "ocamlfind 
>brian> query Unix" or "ocamlfind query Array" or "ocamlfind list" gave me nada 
>brian> - just a fresh prompt.
>
>One possibility is simply that the findlib 0.8.1 does not work properly
>with OCaml 3.0.7. This is due to the changed (maybe undocumented)
>semantics of the Arg module from OCaml core library.
>This problem is already fixed in the newer versions of the original findlib.
>  
>
Although I am far out of my depth, I think that you may be correct.

>I had written an ad-hoc patch to findlib 0.8.1 before new official
>findlib was released. That is obsoleted but left as-is at
>http://www.yl.is.s.u-tokyo.ac.jp/~oiwa/pub/caml/frontend.ml.ocaml307.patch .
>This patch was written with CVS versions of OCaml between 3.0.6 and 3.0.7,
>so it may work or may not work with current 3.0.7, but you can try anyway.
>Possibly the better way is to backport the corresponding portion of
>code from current findlib, or to port my patch into newer findlib.
>
>Unfortunately, I am currently not using OCaml/mingw deeply,
>so the patch mentioned above is not maintained heavily.
>If you succeed to fix the problem, please tell me.
>  
>
Thank you for sharing this patch.  I tried applying it directly, but 
received some error messages.  When I applied it after first applying 
the patched linked from the ocaml-programming.de site, it went fine.  I 
was able to build findlib 0.8.1 w/no error msgs.  Unfortunately, findlib 
was functioning as before (only the browser worked and only partly, 
other commands did nothing, etc.).  This leads me to suspect that OCaml 
3.0.7 + findlib 0.8.1 just don't work together.

With the patch from Eugene Kotlyarov and following his advice, I was 
able to get the most recent version of findlib working with OCaml 
3.0.7.  That's solved my problems for now, but I urge you to share the 
frontend.ml.ocaml307.patch with Gerd Stolpmann (email 
<gerd(at)gerd-stolpmann.de>).  Undoubtedly, there will be someone at 
some point who's trying to get OCaml 3.0.6 working with findlib 0.8.1 
and your work may be a lifeline for them.  If I hadn't seen on Gerd's 
site that someone (you) had gotten a version of findlib working on 
Win32, I might not have pursued the matter as far as I did and may never 
have gotten this sorted out.

Thanks again

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

* Re: Solved!  ... Re: [Caml-list] Building findlib/OCamlfind on Win32 system
  2004-05-10 17:42   ` Solved! ... " brian donovan
@ 2004-05-10 18:17     ` Yutaka OIWA
  0 siblings, 0 replies; 6+ messages in thread
From: Yutaka OIWA @ 2004-05-10 18:17 UTC (permalink / raw)
  To: caml-list

>> On Tue, 11 May 2004 01:42:09 +0800, brian donovan <lists@lophty.com> said:

brian> With the patch from Eugene Kotlyarov and following his advice, I was 
brian> able to get the most recent version of findlib working with OCaml 
brian> 3.0.7.  That's solved my problems for now, but I urge you to share the 
brian> frontend.ml.ocaml307.patch with Gerd Stolpmann (email 
brian> <gerd(at)gerd-stolpmann.de>).  Undoubtedly, there will be someone at 
brian> some point who's trying to get OCaml 3.0.6 working with findlib 0.8.1 
brian> and your work may be a lifeline for them.  If I hadn't seen on Gerd's 
brian> site that someone (you) had gotten a version of findlib working on 
brian> Win32, I might not have pursued the matter as far as I did and may never 
brian> have gotten this sorted out.

I'm glad to hear you have solved the problem.


In depth, my patch to the findlib 0.8.1 has three (almost) independent
functionality:

 1) To allow spaces in names of install directories
       (patch to configure script)
 2) To allow spaces in command line invoked by ocamlfind
       (patch to a ML source file)
 3) To convert /cygdrive/... style pathname back to c:\ style,
    and some other issues with cygwin commands
       (patch to configure script)

So, as long as you use the path-name with no spaces (like "c:\ocaml3.0.7"),
You only need functionality 3), which is almost same as one suggested by
Eugene Kotlyarov.

# I have installed OCaml/mingw to "C:\Program Files\Objective Caml", so
# I needed functionalities 1) and 2).

The issue 1) is (to some extent) common in Unix environment: adding
many double-quotes carefully into configure script might be a good thing
to do; I will consider sending this part of fix to Gerd Stolpmann.
On the other hand, the issue 2) is specific to mingw environment: in
some place between the OCaml standard library and Windows cmd.exe (?),
double quotes are parsed twice and a space in the name of install path
becomes a word-splitter. I'm not sure whether this is a OCaml's bug or
not (just a spec), and also not sure whether this is fixed.
I have not dug this issue deeply and just patched findlib as a workaround.

I'm happy if this information helps someone in the future...

-- 
Yutaka Oiwa              Yonezawa Lab., Dept. of Computer Science,
      Graduate School of Information Sci. & Tech., Univ. of Tokyo.
                    <oiwa@yl.is.s.u-tokyo.ac.jp>, <yutaka@oiwa.jp>
PGP fingerprint = C9 8D 5C B8 86 ED D8 07  EA 59 34 D8 F4 65 53 61

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

end of thread, other threads:[~2004-05-10 18:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-10  5:59 [Caml-list] Building findlib/OCamlfind on Win32 system brian donovan
2004-05-10  8:21 ` Yutaka OIWA
2004-05-10 17:42   ` Solved! ... " brian donovan
2004-05-10 18:17     ` Yutaka OIWA
2004-05-10 11:22 ` Eugene Kotlyarov
     [not found]   ` <409F825B.4050006@lophty.com>
     [not found]     ` <409FA788.2000106@narod.ru>
2004-05-10 17:27       ` Solved ! ... " brian donovan

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