From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q1KDnstN028215 for ; Mon, 20 Feb 2012 14:49:58 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjMDAD1PQk+K57AEgWdsb2JhbABEsVMiAQEWJieBdAEFMgEFQBELIRYPCQMCAQIBNwENEwgCBRWHa7lsi38HAgcKEgQJBgIDBgMHAgYKC4NeLgEFAgcOgy8EmxSNEQ X-IronPort-AV: E=Sophos;i="4.73,451,1325458800"; d="scan'208";a="145100030" Received: from ariane.ens-cachan.fr ([138.231.176.4]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 20 Feb 2012 14:49:58 +0100 Received: from localhost (localhost [127.0.0.1]) by ariane.ens-cachan.fr (Postfix) with ESMTP id DBAE6BC8C3 for ; Mon, 20 Feb 2012 14:49:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at ens-cachan.fr Received: from ariane.ens-cachan.fr ([127.0.0.1]) by localhost (ariane.ens-cachan.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id c-B+fALYLqKk for ; Mon, 20 Feb 2012 14:49:13 +0100 (CET) Received: from olive.lsv.ens-cachan.fr (olive.lsv.ens-cachan.fr [138.231.81.248]) by ariane.ens-cachan.fr (Postfix) with ESMTP id B7643BC8C1 for ; Mon, 20 Feb 2012 14:49:13 +0100 (CET) Received: from [138.231.81.152] (unknown [138.231.81.152]) by olive.lsv.ens-cachan.fr (Postfix) with ESMTP id 6A4E44C01A4 for ; Mon, 20 Feb 2012 14:49:11 +0100 (CET) Message-ID: <4F424F94.9080005@lsv.ens-cachan.fr> Date: Mon, 20 Feb 2012 14:50:12 +0100 From: Romain Bardou User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111114 Icedove/3.1.16 MIME-Version: 1.0 To: caml-list@inria.fr References: <4F300957.5050708@lsv.ens-cachan.fr> In-Reply-To: <4F300957.5050708@lsv.ens-cachan.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Validation-by: bardou@lsv.ens-cachan.fr Subject: Re: [Caml-list] Compiling Cryptokit on Windows 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