Relocatable OCaml #53
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rendered version. The first proof-of-concept of this work was presented at OCaml Workshop 2022.
The OCaml compiler distribution requires the Standard Library to be stored in a fixed location, specified when the compiler itself was compiled. Executables produced by the bytecode compiler (
ocamlc) by default also require the interpreter (ocamlrun) and the Standard Library to be stored in a similarly-fixed location.A consequence of this is that in order to "move" the compiler to a new location, it is necessary to build a new compiler from scratch, configured with the new location, and then recompile any bytecode executables which were built with the previous compiler.
This can be readily seen in
opamtoday:ocamlc.bytecannot be run, because the interpreter specified in its "shebang" line (#!/home/dra/work/_opam/bin/ocamlrun) no longer exists.ocamlc.optcan be run, but returns the original location of the Standard Library, which no longer exists, rather than the new location of the files in/home/dra/new-work/_opam/lib/ocaml.Relocatable OCaml proposes to fix this. An intended consequence of the proposal here is that not only can the directory containing a compiler installation be moved, but it may also be copied, specifically: