caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sven Luther <luther@dpt-info.u-strasbg.fr>
To: Oliver Bandel <oliver@first.in-berlin.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Portability of Byte-Code programs
Date: Tue, 11 Feb 2003 09:26:18 +0100	[thread overview]
Message-ID: <20030211082618.GA786@iliana> (raw)
In-Reply-To: <20030211063701.GA328@first.in-berlin.de>

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


      reply	other threads:[~2003-02-11  8:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-11  6:37 Oliver Bandel
2003-02-11  8:26 ` Sven Luther [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030211082618.GA786@iliana \
    --to=luther@dpt-info.u-strasbg.fr \
    --cc=caml-list@inria.fr \
    --cc=oliver@first.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).