From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Dmitry Grebeniuk <gdsfh1@gmail.com>
Cc: Jacques Garrigue <caml-list@inria.fr>
Subject: Re: [Caml-list] bytecode: ./prog vs ocamlrun ./prog
Date: Sun, 18 Dec 2011 16:53:13 +0100 [thread overview]
Message-ID: <1324223593.7750.126.camel@samsung> (raw)
In-Reply-To: <CAPi0vKX5LJGifDEYn1y5-+b1UhAuB4eBo0x_2b76GafviX1h+w@mail.gmail.com>
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.
------------------------------------------------------------
next prev parent reply other threads:[~2011-12-18 15:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 4:30 Jacques Garrigue
2011-12-18 15:20 ` oliver
2011-12-18 15:39 ` Dmitry Grebeniuk
2011-12-18 15:53 ` Gerd Stolpmann [this message]
2011-12-18 16:40 ` Dmitry Grebeniuk
2011-12-18 16:49 ` Gerd Stolpmann
-- strict thread matches above, loose matches on Subject: below --
2011-12-18 1:19 Dmitry Grebeniuk
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=1324223593.7750.126.camel@samsung \
--to=info@gerd-stolpmann.de \
--cc=caml-list@inria.fr \
--cc=gdsfh1@gmail.com \
/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