Using flambda2 with opam

I built 0xCaml (flambda2) on macOS and installed it under /usr/local.

How do I create a switch for opam with my locally built ocaml?

It seems that opam sets up zsh hooks and I can’t just put /usr/local/bin at the beginning of $PATH anymore since opam puts itself there.

It seems I can opam switch create ocaml-local --empty but how do I tell dune to use my local compiler? opam install dune pulls in the standard ocaml 5.2 compiler and dune then proceeds to use that.

Jane St has instructions for installing flambda2 using opam. You can use this repo to test if it’s working.

I’m still scratching my head about using a locally built version. There’s helpful information available but I wasn’t able to take advantage of it.

1 Like

In general, if you want to create a switch with a locally-built compiler you need to use the ocaml-system package. But my experience with it is not great, so I would advise using the official way; with manual editing of the opam package if you really want to use a non-release version (opam pin edit ocaml-variants.5.2.0+ox, you can change the url field to point to something else like a git branch).

2 Likes