Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 521

Relocatable compiler with binary patching?

$
0
0

Following up on my earlier question Relocatable compiler work

Could opam or dune make the compiler relocatable by downloading pre-built binaries and doing a search-and-replace of the hard-coded paths with the user’s opam switch path?

Suppose we are talking about Windows, which has a max path length of 256. Let’s say we arrange things so that the prebuilt binaries have paths like:

C:/U/.opam/_________________________________________________________________________________________________________________________________________________________/.opam-switch/build/ocaml-base-compiler.4.14.1/stdlib/libasmrun.a(main.n.o)._main.fail_nat.c

Ie we choose a name for the switch such that the longest path in the binary would be 256 characters. Then on the user’s device we could replace the prefix with their actual opam switch prefix and pad the difference (if any).

Assuming prebuilt binaries are built and available from eg a cloud storage bucket for the user’s OS and architecture, would this strategy work?

19 posts - 10 participants

Read full topic


Viewing all articles
Browse latest Browse all 521

Trending Articles