caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Portability of Byte-Code programs
@ 2003-02-11  6:37 Oliver Bandel
  2003-02-11  8:26 ` Sven Luther
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Bandel @ 2003-02-11  6:37 UTC (permalink / raw)
  To: caml-list

Hello,

when I create a program with ocamlc
and give it to other people, who want
to use it - will they be able to run
it on another computer, even if they
do not have the necessary libraries?

Or do they have to install them?

So, the questions goes into the direction
of linkage - dynamic or static.

Both has advantages. For portability I
would choose the way, to include all necessary
libs, and for filesize-issues I would
prefer a dynamic solution.

How does Ocaml do it?
Or are both ways possible?

Ciao,
   Oliver
-------------------
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] 2+ messages in thread

* Re: [Caml-list] Portability of Byte-Code programs
  2003-02-11  6:37 [Caml-list] Portability of Byte-Code programs Oliver Bandel
@ 2003-02-11  8:26 ` Sven Luther
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Luther @ 2003-02-11  8:26 UTC (permalink / raw)
  To: Oliver Bandel; +Cc: caml-list

On Tue, Feb 11, 2003 at 07:37:01AM +0100, Oliver Bandel wrote:
> Hello,
> 
> when I create a program with ocamlc
> and give it to other people, who want
> to use it - will they be able to run
> it on another computer, even if they
> do not have the necessary libraries?
> 
> Or do they have to install them?
> 
> So, the questions goes into the direction
> of linkage - dynamic or static.
> 
> Both has advantages. For portability I
> would choose the way, to include all necessary
> libs, and for filesize-issues I would
> prefer a dynamic solution.
> 
> How does Ocaml do it?
> Or are both ways possible?

Yes, both are possible. By default ocaml links dynamically, and you need
to use the -custom flag to link statically. There is a discution of this
in the manual, i think it is in the linking with C part.

But notice that this only applies to C libraries, or bindings, the pure
caml libraries are always linked statically. When you link statically
the C bindings using the -custom flag, then you create and architecture
dependant binary, which will only run on the same architecture and
plateform than you compiled it for. On the other side, the binary is
mostly self included. When you link a binary dynamically, you need to
have the correct stublibs installed on the machine running it, in
addition to ocamlrun that is. But you alos produce a true architecture
independent bytecode executable, that is, you should be able to run on
your program equallye under windows, macosX, solaris, or whatever, even
if you compiled it under linux. The catch here is that the stublibs your
program use need to be installed on the box where it runs, and
naturally that ocaml is installed on it also, and that ocamlrun is the
same version that the one you compiled it with.

On a debian box, this is no problem, since all ocaml libraries are
separated into the developpment files, and a smallish runtime package
containing only the stublibs. In the same way, the ocaml package is
separated into the developpment package and a small package containing
only ocamlrun and the stublibs included into the ocaml package. So you
would just need to install the needed runtime packages on the box you
wish to run your program (lablgl and lablgtk for example) and you would
do this with a simple apt-get invocation.

BTW, Xavier, would it make sense to change the installation process so
that ocamlrun is no more installed as /usr/bin/ocamlrun, but as
/usr/bin/ocamlrun-version ? So that you could still run a bytecode
binary even if you have installed a newer version of ocaml on your box ?

Friendly,

Sven Luther
> 
> Ciao,
>    Oliver
> -------------------
> 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
-------------------
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] 2+ messages in thread

end of thread, other threads:[~2003-02-11  8:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-11  6:37 [Caml-list] Portability of Byte-Code programs Oliver Bandel
2003-02-11  8:26 ` Sven Luther

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