caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Running ocaml programs on Windows
@ 2011-09-11 13:35 jocelyn.serot
  2011-09-11 13:46 ` Török Edwin
  2011-09-11 18:07 ` Dmitry Grebeniuk
  0 siblings, 2 replies; 4+ messages in thread
From: jocelyn.serot @ 2011-09-11 13:35 UTC (permalink / raw)
  To: caml-list

Hello,

This may be a trivial question for people working on multiple platforms but,
having worked for a long time only on Unix-like platforms (including Mac OS X),
i'm a bit puzzled..

What is the "best" (simplest both for the programmer and, most importantly, the
end user) way to develop a program in Ocaml in order to distribute it to people
having only MS Windows platforms ? 

Is it possible to cross-compile (from what i've read, no)  ?

Do i have to install a ocaml distribution on a machine running windows, compile
my program with the installed tools (ocamlc/ocamlopt) and distribute the
resulting .exe ?

Aux question : In the Unix version, arguments are passed on the command line. I
understand that the same can be done under Windows using some kind of "shell"
(under Cygwin). But this may be disruptive to many Windows users who are used
to the "click to launch" approach. Is there some kind of tool that could
automatically wrap a command-line-based app into a click-to-launch app (with
some additionnal pop-ups to enter arguments for ex) ? 

Sorry if these questions sound trivial but despite a long experience in Ocaml
programming (>15 yrs), i've never been exposed to sw dev under windows (in fact
i deliberately avoid this terrain ;) 

Btw, for those interested, the program i'm trying to port is a compiler
generating VHDL code for FPGAs from high-level actor-dataflow descriptions
(more info here :
http://wwwlasmea.univ-bpclermont.fr/Personnel/Jocelyn.Serot/caph.html).
For the moment, i'm distributing a bytecode but this requires the target
audience to have a ocaml distrib installed on their machine (which, from
experience, most of them view it as an hindrance). 

Thanks for help,

Jocelyn

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

* Re: [Caml-list] Running ocaml programs on Windows
  2011-09-11 13:35 [Caml-list] Running ocaml programs on Windows jocelyn.serot
@ 2011-09-11 13:46 ` Török Edwin
       [not found]   ` <987A8AE7-1A72-4C79-A0E2-1C1413B26E16@wanadoo.fr>
  2011-09-11 18:07 ` Dmitry Grebeniuk
  1 sibling, 1 reply; 4+ messages in thread
From: Török Edwin @ 2011-09-11 13:46 UTC (permalink / raw)
  To: caml-list

On 2011-09-11 16:35, jocelyn.serot@univ-bpclermont.fr wrote:
> Hello,
> 
> This may be a trivial question for people working on multiple platforms but,
> having worked for a long time only on Unix-like platforms (including Mac OS X),
> i'm a bit puzzled..
> 
> What is the "best" (simplest both for the programmer and, most importantly, the
> end user) way to develop a program in Ocaml in order to distribute it to people
> having only MS Windows platforms ? 
> 
> Is it possible to cross-compile (from what i've read, no)  ?

mingw32-ocaml can cross-compile, Debian and Fedora includes it.
You'll need to cross-compile all the OCaml (and native) libs you use though (Fedora might provide pre-cross-compiled libs, not sure).

Unfortunately there doesn't seem to be an easy way to cross-compile for Win64 in Debian
(might be possible if an mingw-w64-ocaml package is created based on mingw-w64), but 32-bit
executables run just there too.

> 
> Do i have to install a ocaml distribution on a machine running windows, compile
> my program with the installed tools (ocamlc/ocamlopt) and distribute the
> resulting .exe ?

That'd work of course, but you have the inconvenience of booting windows everytime.

> 
> Aux question : In the Unix version, arguments are passed on the command line. I
> understand that the same can be done under Windows using some kind of "shell"
> (under Cygwin). But this may be disruptive to many Windows users who are used
> to the "click to launch" approach. Is there some kind of tool that could
> automatically wrap a command-line-based app into a click-to-launch app (with
> some additionnal pop-ups to enter arguments for ex) ? 

Not that I know of, but one could be written using ocaml-win32 (or lablgtk).
Is your app purely console based otherwise, or does its Unix version have a GUI?

> 
> Sorry if these questions sound trivial but despite a long experience in Ocaml
> programming (>15 yrs), i've never been exposed to sw dev under windows (in fact
> i deliberately avoid this terrain ;) 
> 
> Btw, for those interested, the program i'm trying to port is a compiler
> generating VHDL code for FPGAs from high-level actor-dataflow descriptions
> (more info here :
> http://wwwlasmea.univ-bpclermont.fr/Personnel/Jocelyn.Serot/caph.html).
> For the moment, i'm distributing a bytecode but this requires the target
> audience to have a ocaml distrib installed on their machine (which, from
> experience, most of them view it as an hindrance). 

Does that mean that you don't use 3rdparty libs, or only use
ones that can be compiled to pure bytecode (without native code)?
If so cross-compiling with mingw32-ocaml should work fairly well.

Another alternative would be to distribute ocamlrun.exe alongside your program.

Best regards,
--Edwin

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

* Re: [Caml-list] Running ocaml programs on Windows
       [not found]     ` <4E6CC8C8.9030001@gmail.com>
@ 2011-09-11 16:41       ` Jocelyn Sérot
  0 siblings, 0 replies; 4+ messages in thread
From: Jocelyn Sérot @ 2011-09-11 16:41 UTC (permalink / raw)
  To: Török Edwin; +Cc: caml-list


Le 11 sept. 11 à 16:42, Török Edwin a écrit :

> On 2011-09-11 17:31, Jocelyn Sérot wrote:
>> Thanks for your answer, Edwin.
>
> Did you mean to reply to me directly?
> If not please CC the ML too.

No. I did CC but from a mail account different from the one i used to  
subscribe to the list. Need to correct this.

Thanks for the pointers, anyway. Will have a look at mingw32/64 !

Best wishes

Jocelyn

>
>>
>>
>> Le 11 sept. 11 à 15:46, Török Edwin a écrit :
>>
>>> On 2011-09-11 16:35, jocelyn.serot@univ-bpclermont.fr wrote:
>>>> Hello,
>>>>
>>>> This may be a trivial question for people working on multiple  
>>>> platforms but,
>>>> having worked for a long time only on Unix-like platforms  
>>>> (including Mac OS X),
>>>> i'm a bit puzzled..
>>>>
>>>> What is the "best" (simplest both for the programmer and, most  
>>>> importantly, the
>>>> end user) way to develop a program in Ocaml in order to  
>>>> distribute it to people
>>>> having only MS Windows platforms ?
>>>>
>>>> Is it possible to cross-compile (from what i've read, no)  ?
>>>
>>> mingw32-ocaml can cross-compile, Debian and Fedora includes it.
>>
>> Ok. But since i'm running MacOS X, this means that i'll have to  
>> reboot under Debian/Fedora Linux  (or run it using VB).
>
> Sorry I don't have a Mac OS X to give more detailed instructions,  
> maybe someone else on this list can help.
>
> Try compiling OCaml with mingw32 on your Mac (see mingw.org and http://mingw-w64.sourceforge.net/) 
> ,
> or find a pre-packaged cross-compiler for Mac (in the ports?).
>
> If you try to build a cross-compiler yourself you might need to  
> patch OCaml, AFAIK
> Debian has to patch upstream OCaml to make it build with mingw32  
> cross-compiler.
> Have a look at the mingw32-ocaml-3.12.0+debian3/debian/patches  
> directory:
> ftp://ftp.debian.org/debian/pool/main/m/mingw32-ocaml/mingw32-ocaml_3.12.0+debian3.tar.gz
>
>>
>>> You'll need to cross-compile all the OCaml (and native) libs you  
>>> use though (Fedora might provide pre-cross-compiled libs, not sure).
>>>
>>> Unfortunately there doesn't seem to be an easy way to cross- 
>>> compile for Win64 in Debian
>>> (might be possible if an mingw-w64-ocaml package is created based  
>>> on mingw-w64), but 32-bit
>>> executables run just there too.
>>
>> Windows XP is 32b and Seven is 64b, aren't they ?
>
> There is a 64-bit version of XP (although less popular), and there  
> is a 32-bit version of Win7 too.
> The 64-bit version can run 32-bit apps just fine though.
>
>>
>>>
>>>>
>>>> Do i have to install a ocaml distribution on a machine running  
>>>> windows, compile
>>>> my program with the installed tools (ocamlc/ocamlopt) and  
>>>> distribute the
>>>> resulting .exe ?
>>>
>>> That'd work of course, but you have the inconvenience of booting  
>>> windows everytime.
>>>
>>>>
>>>> Aux question : In the Unix version, arguments are passed on the  
>>>> command line. I
>>>> understand that the same can be done under Windows using some  
>>>> kind of "shell"
>>>> (under Cygwin). But this may be disruptive to many Windows users  
>>>> who are used
>>>> to the "click to launch" approach. Is there some kind of tool  
>>>> that could
>>>> automatically wrap a command-line-based app into a click-to- 
>>>> launch app (with
>>>> some additionnal pop-ups to enter arguments for ex) ?
>>>
>>> Not that I know of, but one could be written using ocaml-win32 (or  
>>> lablgtk).
>>
>>> Is your app purely console based otherwise, or does its Unix  
>>> version have a GUI?
>>
>> Purely console-based for now, but writing a GUI should not be too  
>> difficult.
>>
>>>
>>>>
>>>> Sorry if these questions sound trivial but despite a long  
>>>> experience in Ocaml
>>>> programming (>15 yrs), i've never been exposed to sw dev under  
>>>> windows (in fact
>>>> i deliberately avoid this terrain ;)
>>>>
>>>> Btw, for those interested, the program i'm trying to port is a  
>>>> compiler
>>>> generating VHDL code for FPGAs from high-level actor-dataflow  
>>>> descriptions
>>>> (more info here :
>>>> http://wwwlasmea.univ-bpclermont.fr/Personnel/Jocelyn.Serot/caph.html) 
>>>> .
>>>> For the moment, i'm distributing a bytecode but this requires the  
>>>> target
>>>> audience to have a ocaml distrib installed on their machine  
>>>> (which, from
>>>> experience, most of them view it as an hindrance).
>>>
>>> Does that mean that you don't use 3rdparty libs, or only use
>>> ones that can be compiled to pure bytecode (without native code)?
>>> If so cross-compiling with mingw32-ocaml should work fairly well.
>>
>> The app only uses libs from the ocaml distrib (unix.cm[x]a and  
>> dynlink.cm[x]a).
>>
>>>
>>> Another alternative would be to distribute ocamlrun.exe alongside  
>>> your program.
>>>
>>
>> Good idea. Can i do this (i mean, is it allowed by the licence  
>> conditions) ?
>
> IANAL, but I think you can distribute ocamlrun.exe under the terms  
> of the OCaml license:
> http://caml.inria.fr/ocaml/license.en.html,
> and distribute the bytecode itself under your own license.
>
> Of course bytecode is slower than native, so getting cross- 
> compilation working somehow might still be worth it.
>
> Best regards,
> --Edwin



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

* Re: [Caml-list] Running ocaml programs on Windows
  2011-09-11 13:35 [Caml-list] Running ocaml programs on Windows jocelyn.serot
  2011-09-11 13:46 ` Török Edwin
@ 2011-09-11 18:07 ` Dmitry Grebeniuk
  1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Grebeniuk @ 2011-09-11 18:07 UTC (permalink / raw)
  To: jocelyn.serot

Hello.

> What is the "best" (simplest both for the programmer and, most importantly, the
> end user) way to develop a program in Ocaml in order to distribute it to people
> having only MS Windows platforms ?

  If you want to just distribute your program, you can get
cross-compilers.  They will make the binaries that you
can distribute, of course.
  If you want to test your program (to see whether it runs,
at least!), assure the quality of your program in some
ways -- the cross-compiling is not enough, and you
should use the real windows installation or some kind
of a virtual machine.  This is caused by the differences
between many windows versions, currently installed
"windows updates", software versions (for example,
the version of installed ActiveState Tcl/Tk package
for GUI OCaml programs).

> Is there some kind of tool that could
> automatically wrap a command-line-based app into a click-to-launch app (with
> some additionnal pop-ups to enter arguments for ex) ?

  The best way is to distribute a tcl/tk-powered application
with a fair GUI (and with the tcl/tk itself).
  Also the "wish" utility from tcl/tk does exist in windows
tcl/tk installation (AFAIR), you can use it too, for simple
GUIs, for just "prompt and go" wrappers.
  Lablgtk2 is good too.
  Avoid the .bat/.cmd files generation (Sys.command too),
since cmd (the windows shell) uses some
incomprehensible ways to handle the quotes. It's more
safe to write some utility in ocaml+labltk that passes
command line options to the real working program with
Unix.create_process-like functions (the functions that
receive the argv[] list! arguments shouldn't be concat'ed
to the string).

  As for ocaml-windows-mingw-32bit developement, you
can use my project "overbld": http://overbld.sourceforge.net/ ,
it provides installers for some variants of OCaml+libraries
distribution.  I will add/fix libraries to/in the distribution.
(compiler in the overbld distribution will be updated when
OCaml 3.13 will be released, in 1..2 weeks from the OCaml
release).
  It's easy for me, since I'm fighting this issue (windows,
ocaml, libraries) for a long time.
  64 bits are not required for my windows applications, so
I'm not adding/compiling 64-bit version of overbld.  But it is
not a very hard task, as I have seen, since OCaml runs on
mingw64.  (Really, I saw it On The Internets!).

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

end of thread, other threads:[~2011-09-11 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-11 13:35 [Caml-list] Running ocaml programs on Windows jocelyn.serot
2011-09-11 13:46 ` Török Edwin
     [not found]   ` <987A8AE7-1A72-4C79-A0E2-1C1413B26E16@wanadoo.fr>
     [not found]     ` <4E6CC8C8.9030001@gmail.com>
2011-09-11 16:41       ` Jocelyn Sérot
2011-09-11 18:07 ` Dmitry Grebeniuk

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