I’ve updated to OPAM 2, and I’m having issues installing some packages. In particular, when trying to install javalib.2.3.5 on OPAM 2.0.0 on a 4.07.0 switch I get the following:
# command ~/.opam/opam-init/hooks/sandbox.sh build make installptrees
...
# ocamlfind: Cannot mkdir /Users/ins/.opam/4.07.0/lib/ptrees: Operation not permitted
My guess is that this is due to the new sandboxing feature that was introduced. Is there a way to say “I trust this package, install it as you would have in OPAM 1.2.x?”
I’ve seen conflicting reports about backwards compatibility. For example, here it says:
All packages installing in opam 1.2.2 should exist and install fine on 2.0.0~rc4 (if you find one that doesn’t, please report!)
But i’ve also seen plenty of GitHub issues with issues similar to mine.
Here, the package definition is not sandboxing compatible: during build steps, it tries to install library but sandboxing doesn’t allow write access to certain opam root folders, while install does (e.g lib, bin… in opam root). When build and install command are well separated, sandboxing isn’t blocking.
Disabling sandboxing is not a single-operation. Ensure to re-enable it afterwards, disasters do happen.
Once you have an opam initialised, you need to give the --reinit to relaunch initialisation, especially for scripts.
I’ve posted an issue on the javalib issue tracker, requesting that they update their package.
I’ve re-enabled sandboxing now, and will continue to encourage package maintainers to update their packages to support sandboxing.
I realized I forgot a --reinit afterwards, but unfortunately even opam init --reinit --disable-sandboxing didn’t work. I’ve added a follow-up to my GitHub issue.