infer
infer copied to clipboard
Fail to build infer (Linux)
Hi, I am trying to build infer on the google cloud platform, and I came across an error during building the infer. Below are some error logs:
- Once run ./build-infer.sh java ocaml --version The OCaml toplevel, version 4.08.1 opam --version 2.0.5
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed ocaml-option-flambda.1
[ERROR] The compilation of ocaml-variants failed at "/root/.opam/opam-init/hooks/sandbox.sh build ./configure --prefix=/root/.opam/4.12.0+flambda -C --enable-flambda".
#=== ERROR while compiling ocaml-variants.4.12.0+options ======================#
# context 2.0.5 | linux/x86_64 | ocaml-option-flambda.1 | https://opam.ocaml.org#93ee8809
# path ~/.opam/4.12.0+flambda/.opam-switch/build/ocaml-variants.4.12.0+options
# command ~/.opam/opam-init/hooks/sandbox.sh build ./configure --prefix=/root/.opam/4.12.0+flambda -C --enable-flambda
# exit-code 1
# env-file ~/.opam/log/ocaml-variants-9827-e7966f.env
# output-file ~/.opam/log/ocaml-variants-9827-e7966f.out
### output ###
# bwrap: Creating new namespace failed: Operation not permitted
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocaml-variants 4.12.0+options
└─
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install base-bigarray base
│ ∗ install base-threads base
│ ∗ install base-unix base
│ ∗ install ocaml-option-flambda 1
└─
<><> ocaml-variants.4.12.0+options troubleshooting ><><><><><><><><><><><><><><>
=> A failure in the middle of the build may be caused by build parallelism
(enabled by default).
Please file a bug report at https://github.com/ocaml/opam-repository/issues
=> You can try installing again including --jobs=1
to force a sequential build instead.
# Run eval $(opam env) to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [Y/n] y
*** ERROR: `opam_switch_create_if_needed 4.12.0+flambda --package=ocaml-variants.4.12.0+options,ocaml-option-flambda` failed
Do I need to adjust the: INFER_OPAM_DEFAULT_SWITCH="4.12.0+flambda" INFER_OPAM_DEFAULT_SWITCH_OPTIONS="--package=ocaml-variants.4.12.0+options,ocaml-option-flambda"
and how to correct them?
Thank you so much for your help
[edited your post to add formatting]
Hi @wang-weishi, it looks like an issue with bwrap
, the sandboxing utility that opam uses. I don't know how to fix the issue itself but you shouldn't need the sandboxing since your job is already running in a container, so you could adjust the opam options to include --disable-sandboxing
. I think that only matters in the opam init
command here:
https://github.com/facebook/infer/blob/733696724e1c79bb15de5170807507e837b3b978/build-infer.sh#L138
@jvillard Thanks for the suggestions, I have already disabled sandboxing, and the same error happens as shown by @thyecust. If anyone knows how to fix this issue, could you please kindly leave some hints? Thanks in advance!
you can try running ./build-infer.sh java --no-opam-lock.