caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Compiling Cryptokit on Windows
@ 2012-02-06 17:09 Romain Bardou
  2012-02-06 17:56 ` Gerd Stolpmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Romain Bardou @ 2012-02-06 17:09 UTC (permalink / raw)
  To: caml-list

Hi list,


There has been some discussion during the last few months were some 
argued that there was not enough Windows users to test libraries. Well 
it happens that I need to compile Cryptokit for Windows. Here are my 
first results, which failed miserably. I'm using OCaml 3.12.


1) With Cryptokit 1.5.

INSTALL.txt states that I need findlib. I installed OCaml from:
	http://protz.github.com/ocaml-installer/
And it seems that ocamlfind is not installed by this tool. After more 
search I read here:
	http://www.camlcity.org/archive/programming/findlib.html
that "Volunteers are still wanted who port findlib to Windows and 
Macintosh."

So I guess that every OASIS project needs findlib, but findlib does not 
work on Windows, so all OASIS projects will not be usable on Windows? I 
thought on the contrary that OASIS was a step towards unification?

I tried anyway without findlib, running:
	ocaml setup.ml -configure
I get this error: "'c:\Program' n'est pas reconnu en tant que commande 
interne" (i.e. "unrecognized internal command"). The command which is 
supposed to be run is:
	c:\Program Files\OCaml\bin\ocamlc.opt.EXE -config > somefile.txt
It just misses quotes, which seems kind of silly.


2) With Cryptokit 1.3.

So I gave up and tried an older version whose INSTALL file explains how 
to install on Windows.

I checked variables in Makefile.win and ran:
	make -f Makefile.win
Now the error I get is that gcc cannot find "C:\Program 
Files\OCaml\lib/ocamlrun.a", which actually does not exist, so this is 
not a surprise. This file "ocamlrun.a" does not exist either on my 
Debian computer, so I'm a little surprised here.


I think I'll try cross-compiling now, or maybe editing "setup.ml" to put 
quotes around the command.

Cheers,

-- 
Romain Bardou

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

* Re: [Caml-list] Compiling Cryptokit on Windows
  2012-02-06 17:09 [Caml-list] Compiling Cryptokit on Windows Romain Bardou
@ 2012-02-06 17:56 ` Gerd Stolpmann
  2012-02-06 18:02 ` David Allsopp
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Stolpmann @ 2012-02-06 17:56 UTC (permalink / raw)
  To: Romain Bardou; +Cc: caml-list


> Hi list,
>
>
> There has been some discussion during the last few months were some
> argued that there was not enough Windows users to test libraries. Well
> it happens that I need to compile Cryptokit for Windows. Here are my
> first results, which failed miserably. I'm using OCaml 3.12.
>
>
> 1) With Cryptokit 1.5.
>
> INSTALL.txt states that I need findlib. I installed OCaml from:
> 	http://protz.github.com/ocaml-installer/
> And it seems that ocamlfind is not installed by this tool. After more
> search I read here:
> 	http://www.camlcity.org/archive/programming/findlib.html
> that "Volunteers are still wanted who port findlib to Windows and
> Macintosh."

This URL points to an archived web page, starting with "This is the
archived Findlib page. The new homepage can be found here!", plus a link
to more recent information. Maybe this can be overlooked. The new link is
http://projects.camlcity.org/projects/findlib.html.

Findlib is fully supported on Win32.

> So I guess that every OASIS project needs findlib, but findlib does not
> work on Windows, so all OASIS projects will not be usable on Windows? I
> thought on the contrary that OASIS was a step towards unification?
>
> I tried anyway without findlib, running:
> 	ocaml setup.ml -configure
> I get this error: "'c:\Program' n'est pas reconnu en tant que commande
> interne" (i.e. "unrecognized internal command"). The command which is
> supposed to be run is:
> 	c:\Program Files\OCaml\bin\ocamlc.opt.EXE -config > somefile.txt
> It just misses quotes, which seems kind of silly.

I'd call this a self-made trap. I'd never install Unixish software into a
path with spaces. (I know Windows people think differently about that, but
that's how it is.)

> 2) With Cryptokit 1.3.
>
> So I gave up and tried an older version whose INSTALL file explains how
> to install on Windows.
>
> I checked variables in Makefile.win and ran:
> 	make -f Makefile.win
> Now the error I get is that gcc cannot find "C:\Program
> Files\OCaml\lib/ocamlrun.a", which actually does not exist, so this is
> not a surprise. This file "ocamlrun.a" does not exist either on my
> Debian computer, so I'm a little surprised here.

I think it was renamed to libocamlrun.a. But this is wrong for Win32
anyway, because the suffix should be .lib.

> I think I'll try cross-compiling now, or maybe editing "setup.ml" to put
> quotes around the command.

Yes, it's not a pleasure to build Ocaml software on Windows.

Gerd

> Cheers,
>
> --
> Romain Bardou
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
>


-- 
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
*** Searching for new projects! Need consulting for system
*** programming in Ocaml? Gerd Stolpmann can help you.



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

* RE: [Caml-list] Compiling Cryptokit on Windows
  2012-02-06 17:09 [Caml-list] Compiling Cryptokit on Windows Romain Bardou
  2012-02-06 17:56 ` Gerd Stolpmann
@ 2012-02-06 18:02 ` David Allsopp
  2012-02-06 21:37 ` Adrien
  2012-02-20 13:50 ` Romain Bardou
  3 siblings, 0 replies; 5+ messages in thread
From: David Allsopp @ 2012-02-06 18:02 UTC (permalink / raw)
  To: Romain Bardou, caml-list

Romain Bardou wrote:
> Hi list,
> 
> 
> There has been some discussion during the last few months were some
> argued that there was not enough Windows users to test libraries. Well it
> happens that I need to compile Cryptokit for Windows. Here are my first
> results, which failed miserably. I'm using OCaml 3.12.
> 
> 
> 1) With Cryptokit 1.5.
> 
> INSTALL.txt states that I need findlib. I installed OCaml from:
> 	http://protz.github.com/ocaml-installer/
> And it seems that ocamlfind is not installed by this tool. After more
> search I read here:
> 	http://www.camlcity.org/archive/programming/findlib.html
> that "Volunteers are still wanted who port findlib to Windows and
> Macintosh."

findlib is perfectly ported, and has been for years (see Gerd's email) - you simply need to compile it.

All that's required is a recent Cygwin with the make, mingw64-i686-gcc-core and m4 packages (patch is a good idea as well).

Assuming a working OCaml environment (OCAMLLIB set with a correct *Windows* PATH etc). For findlib 1.2.7, you need to patch the configure script - find the line camlp4_dir=`camlp4 -where` and change it camlp4_dir=`camlp4 -where | tr -d '\015'` or you'll get a corrupt META file for camlp4.

It's built using ./configure && make all opt install

To compile Cryptokit with ZLIB support requires a patch (happy to send it - it's because of a limitation in OASIS - at least at the time I built it) but otherwise:

ocaml setup.ml -configure
ocaml setup.ml -build
ocaml setup.ml -install

While it's far from ideal, life is *much* easier on Windows with a compiler (i.e. building from sources). It's also a really good idea *not* to use spaces in anything (I use C:\Dev - although amusing that's had an issue with a buggy flexlink trying to write /dev/null!). Write your own software to handle spaces correctly, but don't expect Unix-only guys to think that way ;o)

With my last refresh of OCaml to 3.12.2, I produced fully automated scripts for Windows compilation - at some point, I'll try to chuck them up somewhere in case they're of use to others (but the recent work with GODI on Windows is much more promising than what I was doing...). If you're feeling brave, I'm happy to send the scripts and patches off-list (OCaml with findlib, extlib, calendar, pcre, csv, pgocaml, zlib, camlzip, openssl, cryptokit, ocamlnet, json-wheel/static, spidermonkey+spidercaml, ocamlsha and ocamldap)


David


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

* Re: [Caml-list] Compiling Cryptokit on Windows
  2012-02-06 17:09 [Caml-list] Compiling Cryptokit on Windows Romain Bardou
  2012-02-06 17:56 ` Gerd Stolpmann
  2012-02-06 18:02 ` David Allsopp
@ 2012-02-06 21:37 ` Adrien
  2012-02-20 13:50 ` Romain Bardou
  3 siblings, 0 replies; 5+ messages in thread
From: Adrien @ 2012-02-06 21:37 UTC (permalink / raw)
  To: Romain Bardou; +Cc: caml-list

On 06/02/2012, Romain Bardou <bardou@lsv.ens-cachan.fr> wrote:
> Hi list,
>
>
> There has been some discussion during the last few months were some
> argued that there was not enough Windows users to test libraries. Well
> it happens that I need to compile Cryptokit for Windows. Here are my
> first results, which failed miserably. I'm using OCaml 3.12.
>
>
> 1) With Cryptokit 1.5.
>
> INSTALL.txt states that I need findlib. I installed OCaml from:
> 	http://protz.github.com/ocaml-installer/
> And it seems that ocamlfind is not installed by this tool. After more
> search I read here:
> 	http://www.camlcity.org/archive/programming/findlib.html
> that "Volunteers are still wanted who port findlib to Windows and
> Macintosh."
>
> So I guess that every OASIS project needs findlib, but findlib does not
> work on Windows, so all OASIS projects will not be usable on Windows? I
> thought on the contrary that OASIS was a step towards unification?
>
> I tried anyway without findlib, running:
> 	ocaml setup.ml -configure
> I get this error: "'c:\Program' n'est pas reconnu en tant que commande
> interne" (i.e. "unrecognized internal command"). The command which is
> supposed to be run is:
> 	c:\Program Files\OCaml\bin\ocamlc.opt.EXE -config > somefile.txt
> It just misses quotes, which seems kind of silly.
>
>
> 2) With Cryptokit 1.3.
>
> So I gave up and tried an older version whose INSTALL file explains how
> to install on Windows.
>
> I checked variables in Makefile.win and ran:
> 	make -f Makefile.win
> Now the error I get is that gcc cannot find "C:\Program
> Files\OCaml\lib/ocamlrun.a", which actually does not exist, so this is
> not a surprise. This file "ocamlrun.a" does not exist either on my
> Debian computer, so I'm a little surprised here.
>
>
> I think I'll try cross-compiling now, or maybe editing "setup.ml" to put
> quotes around the command.

IIRC, what you want is in setup.data.

-- 
Adrien Nader

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

* Re: [Caml-list] Compiling Cryptokit on Windows
  2012-02-06 17:09 [Caml-list] Compiling Cryptokit on Windows Romain Bardou
                   ` (2 preceding siblings ...)
  2012-02-06 21:37 ` Adrien
@ 2012-02-20 13:50 ` Romain Bardou
  3 siblings, 0 replies; 5+ messages in thread
From: Romain Bardou @ 2012-02-20 13:50 UTC (permalink / raw)
  To: caml-list

Le 06/02/2012 18:09, Romain Bardou a écrit :
> Hi list,
>
>
> There has been some discussion during the last few months were some
> argued that there was not enough Windows users to test libraries. Well
> it happens that I need to compile Cryptokit for Windows. Here are my
> first results, which failed miserably. I'm using OCaml 3.12.
>
>
> 1) With Cryptokit 1.5.
>
> INSTALL.txt states that I need findlib. I installed OCaml from:
> http://protz.github.com/ocaml-installer/
> And it seems that ocamlfind is not installed by this tool. After more
> search I read here:
> http://www.camlcity.org/archive/programming/findlib.html
> that "Volunteers are still wanted who port findlib to Windows and
> Macintosh."
>
> So I guess that every OASIS project needs findlib, but findlib does not
> work on Windows, so all OASIS projects will not be usable on Windows? I
> thought on the contrary that OASIS was a step towards unification?
>
> I tried anyway without findlib, running:
> ocaml setup.ml -configure
> I get this error: "'c:\Program' n'est pas reconnu en tant que commande
> interne" (i.e. "unrecognized internal command"). The command which is
> supposed to be run is:
> c:\Program Files\OCaml\bin\ocamlc.opt.EXE -config > somefile.txt
> It just misses quotes, which seems kind of silly.
>
>
> 2) With Cryptokit 1.3.
>
> So I gave up and tried an older version whose INSTALL file explains how
> to install on Windows.
>
> I checked variables in Makefile.win and ran:
> make -f Makefile.win
> Now the error I get is that gcc cannot find "C:\Program
> Files\OCaml\lib/ocamlrun.a", which actually does not exist, so this is
> not a surprise. This file "ocamlrun.a" does not exist either on my
> Debian computer, so I'm a little surprised here.
>
>
> I think I'll try cross-compiling now, or maybe editing "setup.ml" to put
> quotes around the command.
>
> Cheers,
>

Hi list,

First of all, thanks to Gerd, David and Adrien for their answers. I was 
eventually able to take the time to tackle this problem again and my 
program compiles and runs just fine on Windows now, with Cryptokit 1.5.

I had to:
- reinstall OCaml in a directory without any space in it (otherwise 
Cryptokit would not configure without a hack, and would not compile even 
with the hack);
- modify cryptokit/setup.data, there was a reference to "Program Files", 
but I don't think it was actually used so this step might not be useful;
- move the source of Cryptokit to a directory without any space in it 
(otherwise it would not install);
- compile and install findlib.
Then Cryptokit would compile and install. I was then able to link with it.

I also tried cross-compiling but I failed, because (I think) 
mingw32-ocamlmklib produces a .dll (which makes sense) but Cryptokit 
believes it is in an environment where DLL are .so files. With more work 
I'm pretty sure it could be done but maybe not without modifying the 
compilation process of Cryptokit. Maybe it's just a matter of changing 
one parameter somewhere.

To sum up, here are some general ideas that would improve the OCaml 
developing environment when Win32 is involved.

1) In OASIS: fix the handling of paths with spaces in them.

2) In the OCaml binary installer: install Findlib by default. After all, 
it installs emacs, but emacs is much less mandatory for OCaml 
programming than Findlib.

3) In Debian: provide a findlib package which could be used for 
cross-compiling with mingw32. It would be configured to use the 
cross-compiled mingw32 OCaml libraries in 
/usr/i686-w64-mingw32/lib/ocaml. Maybe it could simply install a shell 
script which would call the existing Linux ocamlfind, but using a 
different configuration file by default.

4) In Debian also: provide Ocamlbuild with the mingw32 cross-compilation 
tools for OCaml. For instance, /usr/bin/i686-w64-mingw32-ocamlbuild. 
This Ocamlbuild would be configured to use the 
/usr/bin/i686-w64-mingw32-ocaml* executables by default, and to believe 
it runs in a Windows environment (so as to handle ocamlmklib and its 
output .dll file correctly).

5) In OASIS: do something to help with cross-compilation. For instance, 
add a -build-cross-mingw32 option to setup.ml or something. If 3) and 4) 
are available, it would be easy to implement. Else, instead of looking 
for "ocamlc" in the path, look for "i686-w64-mingw32-ocamlc". I don't 
know whether this name is Debian-only though. And other tweaks would be 
necessary so that Ocamlbuild is happy.

Regarding 3, 4, and 5, maybe I'm doing it wrong though. I'm not very 
familiar with cross-compiling.

Cheers,

-- 
Romain

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

end of thread, other threads:[~2012-02-20 13:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-06 17:09 [Caml-list] Compiling Cryptokit on Windows Romain Bardou
2012-02-06 17:56 ` Gerd Stolpmann
2012-02-06 18:02 ` David Allsopp
2012-02-06 21:37 ` Adrien
2012-02-20 13:50 ` Romain Bardou

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