From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA03690; Tue, 11 Feb 2003 09:26:27 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA04376 for ; Tue, 11 Feb 2003 09:26:26 +0100 (MET) Received: from mel-rto6.wanadoo.fr (smtp-out-6.wanadoo.fr [193.252.19.25]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h1B8QQf23772 for ; Tue, 11 Feb 2003 09:26:26 +0100 (MET) Received: from mel-rta6.wanadoo.fr (193.252.19.26) by mel-rto6.wanadoo.fr (6.7.015) id 3E0C343F01CCDAFB; Tue, 11 Feb 2003 09:26:20 +0100 Received: from iliana (80.13.248.121) by mel-rta6.wanadoo.fr (6.7.015) id 3E26CE2100EDDEB6; Tue, 11 Feb 2003 09:26:20 +0100 Received: from luther by iliana with local (Exim 3.36 #1 (Debian)) id 18iVkA-0000JM-00; Tue, 11 Feb 2003 09:26:18 +0100 Date: Tue, 11 Feb 2003 09:26:18 +0100 To: Oliver Bandel Cc: caml-list@inria.fr Subject: Re: [Caml-list] Portability of Byte-Code programs Message-ID: <20030211082618.GA786@iliana> References: <20030211063701.GA328@first.in-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030211063701.GA328@first.in-berlin.de> User-Agent: Mutt/1.5.3i From: Sven Luther Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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