caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Mr. Herr" <misterherr@freenet.de>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] proposal of small changes to bytecode executables
Date: Mon, 17 Aug 2015 11:13:19 +0200	[thread overview]
Message-ID: <55D1A5AF.1060302@freenet.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1435 bytes --]

Hi,

to produce executable files we currently have two general options: compile to native 
code, or compile to byte code.

For byte code as executable files, ocamlc can produce two sorts of output: with 
(option -custom) or without embedded runtime.

Let's look at byte code without embedded runtime.

The bytecode VM "ocamlrun" is tied to the compiler version, and so is the ocamlc 
produced output.

To make sure that byte code and ocamlrun versions match, the runtime reads a magic 
byte at the end of the byte code and
refuses to execute non matching input. Additionally ocamlc puts an absolute hash bang 
path at
the beginning of the executable, pointing to the correct ocamlrun binary executable 
at the time of compilation.

Perceived shortcoming:

opam has become very good at managing compilers, yet it is not recommended to run 
opam as root.
This leads to an absolute ocamlrun path pointing to the hidden .opam directory in the 
programmer's home directory (opam default),
limiting use of non-custom ocamlc builds to the programmer.


Solution: build the ocamlrun executable with the version in the name: ocamlrun_xyz, 
change the hash bang path to "#!/usr/bin/env ocamlrun_xyz",
this would give the sysadmin the basics to easily manage byte code executables 
without embedded runtime.

Complexity of change: very small. The only question is what exotic *nix systems do 
not have /usr/bin/env?

What do you think?

/Str.




[-- Attachment #2: Type: text/html, Size: 2243 bytes --]

                 reply	other threads:[~2015-08-17  9:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=55D1A5AF.1060302@freenet.de \
    --to=misterherr@freenet.de \
    --cc=caml-list@inria.fr \
    /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).