From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id pBIFrLY9031213 for ; Sun, 18 Dec 2011 16:53:21 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am8BAJIL7k7U4367kGdsb2JhbABDhQymTSIBAQEBCQkNBxQDIoFyAQEFI1YQCw4MAiYCAlcGEwmHcwalUJEDgS+JP4EWBI0XjTWMYQ X-IronPort-AV: E=Sophos;i="4.71,371,1320620400"; d="scan'208";a="123820747" Received: from moutng.kundenserver.de ([212.227.126.187]) by mail4-smtp-sop.national.inria.fr with ESMTP; 18 Dec 2011 16:53:16 +0100 Received: from office1.lan.sumadev.de (dslb-094-219-215-111.pools.arcor-ip.net [94.219.215.111]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MdH3n-1RKVJY0rUh-00IILa; Sun, 18 Dec 2011 16:53:15 +0100 Received: from [192.168.178.30] (546BF816.cm-12-4d.dynamic.ziggo.nl [84.107.248.22]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id D8EFBC00C7; Sun, 18 Dec 2011 16:53:14 +0100 (CET) From: Gerd Stolpmann To: Dmitry Grebeniuk Cc: Jacques Garrigue In-Reply-To: References: <-3085435649396878115@unknownmsgid> Content-Type: text/plain; charset="UTF-8" Date: Sun, 18 Dec 2011 16:53:13 +0100 Message-ID: <1324223593.7750.126.camel@samsung> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:qpHN3KSX07RIybcfZiDMX9Z6lltSTiZF5As5pymvs+U yp+M+mx7h0HV3C0tAUembj+FmmTSZPeIcKjBb6rg6s0hduOcx4 KxUcTBdb2MSOIBuNhH/YNVaHO6B1vztx7U3v3HYFoWJu8ObArU lU+rCyGFHfEmr7m9qQLVOVk1Ftsd2jvp6fKKCwBNVrur6NV5Dc gupia5bL/PqqyaI1n6LhA6QBQR0PE7pXy5L/60/z3QUO8LjfTo 2kTq8yBdB3t1/dD/4ZvOeU41YAQb8OdOpwEHtzkEQ/ZCCjHcMa rM1Y9Up/EQ4/cGwtPTcpWWGqYRv5r71Rg0dxmGxNGH1TqcnwlS nwIZhmjRpJoh07f9SlgIER8yC7IoBWLlwDYmlz7su Subject: Re: [Caml-list] bytecode: ./prog vs ocamlrun ./prog Am Sonntag, den 18.12.2011, 17:39 +0200 schrieb Dmitry Grebeniuk: > Hello. > > > Do "head -1 prog" to see the right ocamlrun. > > Thank you, this really helped, but in the other way. > I've found that this executable has ELF format. > So, this is a -custom linked bytecode executable. > But I can't find anywhere in the documentation > any information about whether can I / should I run > such executables using ocamlrun or I can't / I shouldn't. > If the answer is "I can't / I shouldn't", then the problem > is solved (and maybe I should report a > documentation-related issue to mantis?). > This explains it. An executable compiled with -custom is self-contained, and all add-on C libraries (like Unix) are linked in. Because of this, such an executable does not include a loader section for add-on libraries, and you normally cannot run it with ocamlrun (except for the corner case that no extra libraries are needed). However, if you link without -custom, the generated bytecode includes the information which extra libraries are needed, and ocamlrun will load these libraries. You can, however, run prog with a special version of ocamlrun that statically links the extra libraries in. E.g. create a special ocamlrun that includes Unix: ocamlc -o myrun -make-runtime unix.cma Then ./myrun prog should work (provided that Unix is the only missing lib). Gerd -- ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de Creator of GODI and camlcity.org. Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de *** Searching for new projects! Need consulting for system *** programming in Ocaml? Gerd Stolpmann can help you. ------------------------------------------------------------