From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 468677F02E for ; Mon, 17 Aug 2015 11:15:57 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of misterherr@freenet.de) identity=pra; client-ip=195.4.92.90; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="misterherr@freenet.de"; x-sender="misterherr@freenet.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of misterherr@freenet.de) identity=mailfrom; client-ip=195.4.92.90; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="misterherr@freenet.de"; x-sender="misterherr@freenet.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout0.freenet.de) identity=helo; client-ip=195.4.92.90; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="misterherr@freenet.de"; x-sender="postmaster@mout0.freenet.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AOAgAbptFVh1pcBMNdgm+FDbktijtMAQEBAQEBEgEBAQgNCQcjLoRNVSAdFgsCCwMCAQIBPwwNCAEBF4d9ARYDAaoDj2OPGAmBMwGFHZMQDC8SgTEFjF6IPwGVVQOROoFwDDcdgVWDOwEBAQ X-IPAS-Result: A0AOAgAbptFVh1pcBMNdgm+FDbktijtMAQEBAQEBEgEBAQgNCQcjLoRNVSAdFgsCCwMCAQIBPwwNCAEBF4d9ARYDAaoDj2OPGAmBMwGFHZMQDC8SgTEFjF6IPwGVVQOROoFwDDcdgVWDOwEBAQ X-IronPort-AV: E=Sophos;i="5.15,694,1432591200"; d="scan'208,217";a="173821430" Received: from mout0.freenet.de ([195.4.92.90]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Aug 2015 11:15:41 +0200 Received: from [195.4.92.142] (helo=mjail2.freenet.de) by mout0.freenet.de with esmtpa (ID misterherr@freenet.de) (port 25) (Exim 4.85 #1) id 1ZRGW3-0007l5-R3 for caml-list@inria.fr; Mon, 17 Aug 2015 11:15:39 +0200 Received: from localhost ([::1]:48122 helo=mjail2.freenet.de) by mjail2.freenet.de with esmtpa (ID misterherr@freenet.de) (Exim 4.85 #1) id 1ZRGW3-0001O4-Mm for caml-list@inria.fr; Mon, 17 Aug 2015 11:15:39 +0200 Received: from mx12.freenet.de ([195.4.92.22]:50287) by mjail2.freenet.de with esmtpa (ID misterherr@freenet.de) (Exim 4.85 #1) id 1ZRGTo-0004pW-Fl for caml-list@inria.fr; Mon, 17 Aug 2015 11:13:20 +0200 Received: from cl-252.ham-02.de.sixxs.net ([2001:6f8:1c00:fb::2]:54994) by mx12.freenet.de with esmtpsa (ID misterherr@freenet.de) (TLSv1.2:DHE-RSA-AES128-SHA:128) (port 465) (Exim 4.85 #1) id 1ZRGTo-0002Q9-8g for caml-list@inria.fr; Mon, 17 Aug 2015 11:13:20 +0200 To: Caml List From: "Mr. Herr" Message-ID: <55D1A5AF.1060302@freenet.de> Date: Mon, 17 Aug 2015 11:13:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------080507000101040401030401" X-Originated-At: 2001:6f8:1c00:fb::2!54994 Subject: [Caml-list] proposal of small changes to bytecode executables This is a multi-part message in MIME format. --------------080507000101040401030401 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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. --------------080507000101040401030401 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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.
=C2=A0


--------------080507000101040401030401--