Does the new relocatable OCaml compiler works for anyone?

Based on published guide Relocatable OCaml by @dra27 I have tried to have faster switches bootstraps, however it does not work in my case:

  • $ time opam switch create --repos=relocatable=git+https://github.com/dra27/opam-repository.git#relocatable,default original-compiler ocaml.5.4.0
    Creating repository relocatable…
    [relocatable] Initialised
    
    <><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
    Switch invariant: [“ocaml” {= “5.4.0”}]
    
    <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
    ∗ installed base-bigarray.base
    ∗ installed base-threads.base
    ∗ installed base-unix.base
    ∗ installed ocaml-options-vanilla.1
    ⬇ retrieved ocaml.5.4.0  (https://raw.githubusercontent.com/dra27/ocaml/977f2d05a98a5aeec260b5ba200f72c4e79e4fdc/tools/opam/gen_ocaml_config.ml)
    ⬇ retrieved ocaml-compiler.5.4.0  (cached)
    ∗ installed ocaml-compiler.5.4.0
    ∗ installed ocaml-base-compiler.5.4.0
    ∗ installed ocaml.5.4.0
    ∗ installed base-domains.base
    ∗ installed base-effects.base
    ∗ installed base-nnp.base
    Done.
    
    To update the current shell environment, run: eval $(opam env --switch=original-compiler)
    
    real	1m17,531s
    user	5m19,929s
    sys	0m35,741s
    
  • $ eval $(opam env)
    $ ocamlopt -where
    /home/user/.opam/original-compiler/lib/ocaml

  • $ time opam switch create . --repos=relocatable,default ocaml.5.4.0
    
    <><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
    Switch invariant: [“ocaml” {= “5.4.0”}]
    
    <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
    ⬇ retrieved ocaml.5.4.0  (cached)
    ∗ installed base-bigarray.base
    ∗ installed base-threads.base
    ∗ installed base-unix.base
    ∗ installed ocaml-options-vanilla.1
    ⬇ retrieved ocaml-compiler.5.4.0  (cached)
    ∗ installed ocaml-compiler.5.4.0
    ∗ installed ocaml-base-compiler.5.4.0
    ∗ installed ocaml.5.4.0
    ∗ installed base-domains.base
    ∗ installed base-effects.base
    ∗ installed base-nnp.base
    Done.
    
    To update the current shell environment, run: eval $(opam env)
    
    real	1m17,862s
    user	5m23,877s
    sys	0m35,578s
    

See, there is no speed-up. Derived switch took about the same time of 1 min and 18 secs.

What am I missing? I’ve tried to follow instructions from original post but to no avail.

Tested on Linux x86_64, shell is BASH and opam is of version 2.5.0

1 Like

Oops, OCaml 5.4.0 got released a month after that release - if you do it with ocaml.5.4.1 then it should all work as expected.

3 Likes

Yes, that was it! With 5.4.1 version the new switch was created in mere 4 seconds.

:+1:

2 Likes