facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.96k stars 2.02k forks source link

Docker build fails with Exception: Reqs_error #718

Closed jirkadanek closed 7 years ago

jirkadanek commented 7 years ago

When following the Docker build instructions (with Infer version 0.12.0), the build fails on the following error.

Step 4/13 : RUN INFER_VERSION=v0.12.0;     cd /opt &&     curl -sL       https://github.com/facebook/infer/releases/download/${INFER_VERSION}/infer-linux64-${INFER_VERSION}.tar.xz |     tar xJ &&     rm -f /infer &&     ln -s ${PWD}/infer-linux64-$INFER_VERSION /infer
 ---> Running in 128280bfa281
 ---> c3e2af5bd239
Removing intermediate container 128280bfa281
Step 5/13 : RUN OCAML_VERSION=4.04.2;     opam init --compiler=$OCAML_VERSION -j $(getconf _NPROCESSORS_ONLN || echo 1) --yes &&     cd /infer &&     ./build-infer.sh --opam-switch $OCAML_VERSION &&     rm -rf /root/.opam
 ---> Running in d230e5a69d66
[WARNING] Running as root is not recommended
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg
    command on your system.
  - you won't be able to use darcs repositories unless you install the darcs
    command on your system.

=-=- Fetching repository information =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[default: http]
[default: http]
[default: http]
[default: http]
[default] synchronized from https://opam.ocaml.org

=-=- Installing compiler 4.04.2 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[4.04.2: http]
[4.04.2: http]
[compiler.get] https://github.com/ocaml/ocaml/archive/4.04.2.tar.gz downloaded
Now compiling OCaml. This may take a while, please bear with us...
[4.04.2: ./configure]
[4.04.2: make world]
[4.04.2: make world.opt]
[4.04.2: make install]
Done.

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-> installed base-bigarray.base
-> installed base-threads.base
-> installed base-unix.base
Done.

In normal operation, OPAM only alters files within ~/.opam.

During this initialisation, you can allow OPAM to add information to two
other files for best results. You can also make these additions manually
if you wish.

If you agree, OPAM will modify:

  - ~/.profile (or a file you specify) to set the right environment
    variables and to load the auto-completion scripts for your shell (sh)
    on startup. Specifically, it checks for and appends the following line:

    . /root/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true

  - ~/.ocamlinit to ensure that non-system installations of `ocamlfind`
    (i.e. those installed by OPAM) will work correctly when running the
    OCaml toplevel. It does this by adding $OCAML_TOPLEVEL_PATH to the list
    of include directories.

If you choose to not configure your system now, you can either configure
OPAM manually (instructions will be displayed) or launch the automatic setup
later by running:

   opam config setup -a

Do you want OPAM to modify ~/.profile and ~/.ocamlinit?
(default is 'no', use 'f' to name a file other than ~/.profile)
    [N/y/f] 
Global configuration:
  Updating ~/.opam/opam-init/init.sh
  Updating ~/.opam/opam-init/init.zsh
  Updating ~/.opam/opam-init/init.csh
  Updating ~/.opam/opam-init/init.fish

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

1. To configure OPAM in the current shell session, you need to run:

      eval `opam config env`

2. To correctly configure OPAM for subsequent use, add the following
   line to your profile file (for instance ~/.profile):

      . /root/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true

3. To avoid issues related to non-system installations of `ocamlfind`
   add the following lines to ~/.ocamlinit (create it if necessary):

      let () =
        try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
        with Not_found -> ()
      ;;

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

initializing opam... 
[WARNING] Running as root is not recommended
# To setup the new switch in the current shell, you need to run:
eval `opam config env`
[WARNING] Running as root is not recommended

installing infer dependencies; this can take up to 30 minutes... 
opam-lock not found in the current switch, installing from 'https://github.com/rgrinberg/opam-lock'...
[WARNING] Running as root is not recommended
Package lock does not exist, create as a NEW package ? [Y/n] y
lock is now git-pinned to https://github.com/rgrinberg/opam-lock

[lock: git]
[lock: git]
[lock: git]
[lock: git]
[lock: git]
[lock: git]
[lock] https://github.com/rgrinberg/opam-lock updated
[lock] Installing new package description from
https://github.com/rgrinberg/opam-lock

lock needs to be installed.
The following actions will be performed:
  - install lock 1.2*

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[lock: git] Command started
[lock: git] Command started
[lock: git] Command started
[lock: git] Command started
[lock] https://github.com/rgrinberg/opam-lock already up-to-date

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-> installed lock.1.2
Done.
[WARNING] Running as root is not recommended
Exception:
Reqs_error
 (Process_error
   ("opam install -y ANSITerminal.0.7 atd.1.2.0 atdgen.1.10.0 bin_prot.113.33.00+4.03 biniou.1.0.12 camlp4.4.04+1 camlzip.1.07 camomile.0.8.5 cmdliner.1.0.0 conf-autoconf.0.1 conf-m4.1 conf-pkg-config.1.0 conf-which.1 core.113.33.02+4.03 core_kernel.113.33.02+4.03 cppo.1.4.1 ctypes.0.11.3 easy-format.1.2.0 extlib-compat.1.7.0 fieldslib.113.24.00 javalib.2.3.3 jbuilder.1.0+beta6 lambda-term.1.10.1 lwt.2.7.1 menhir.20170101 merlin-extend.0.3 ocaml-migrate-parsetree.0.7 ocamlbuild.0.11.0 ocamlfind.1.7.1 ounit.2.0.0 ppx_assert.113.33.00 ppx_bench.113.33.00+4.03 ppx_bin_prot.113.33.00+4.03 ppx_compare.113.33.00+4.03 ppx_core.113.33.01+4.03 ppx_custom_printf.113.33.00+4.03 ppx_deriving.4.1 ppx_driver.113.33.02+4.03 ppx_enumerate.113.33.00+4.03 ppx_expect.113.33.01+4.03 ppx_fail.113.33.00+4.03 ppx_fields_conv.113.33.00+4.03 ppx_here.113.33.00 ppx_inline_test.113.33.00+4.03 ppx_jane.113.33.00 ppx_let.113.33.00+4.03 ppx_optcomp.113.33.01+4.03 ppx_pipebang.113.33.00+4.03 ppx_sexp_conv.113.33.01+4.03 ppx_sexp_message.113.33.00+4.03 ppx_sexp_value.113.33.00+4.03 ppx_tools.5.0 ppx_tools_versioned.5.0alpha ppx_type_conv.113.33.02+4.03 ppx_typerep_conv.113.33.00+4.03 ppx_variants_conv.113.33.00+4.03 re.1.7.1 react.1.2.0 reason.1.13.4 reason-parser.1.13.4 result.1.2 sawja.1.5.2 sexplib.113.33.00+4.03 topkg.0.8.1 typerep.113.24.00 utop.1.19.3 variantslib.113.24.00 xmlm.1.2.0 yojson.1.3.3 zed.1.4 --color=never",
   Unix.WEXITED 3)).

*** Failed to install opam dependencies
*** Updating opam then retrying
[WARNING] Running as root is not recommended

=-=- Updating package repositories =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[default: http] Command started
[default: http] Command started
[default] synchronized from https://opam.ocaml.org

=-=- Synchronizing development packages -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[lock: git] Command started
[lock: git] Command started
[lock: git] Command started
[lock: git] Command started
[lock] https://github.com/rgrinberg/opam-lock already up-to-date
[WARNING] Running as root is not recommended
Exception:
Reqs_error
 (Process_error
   ("opam install -y ANSITerminal.0.7 atd.1.2.0 atdgen.1.10.0 bin_prot.113.33.00+4.03 biniou.1.0.12 camlp4.4.04+1 camlzip.1.07 camomile.0.8.5 cmdliner.1.0.0 conf-autoconf.0.1 conf-m4.1 conf-pkg-config.1.0 conf-which.1 core.113.33.02+4.03 core_kernel.113.33.02+4.03 cppo.1.4.1 ctypes.0.11.3 easy-format.1.2.0 extlib-compat.1.7.0 fieldslib.113.24.00 javalib.2.3.3 jbuilder.1.0+beta6 lambda-term.1.10.1 lwt.2.7.1 menhir.20170101 merlin-extend.0.3 ocaml-migrate-parsetree.0.7 ocamlbuild.0.11.0 ocamlfind.1.7.1 ounit.2.0.0 ppx_assert.113.33.00 ppx_bench.113.33.00+4.03 ppx_bin_prot.113.33.00+4.03 ppx_compare.113.33.00+4.03 ppx_core.113.33.01+4.03 ppx_custom_printf.113.33.00+4.03 ppx_deriving.4.1 ppx_driver.113.33.02+4.03 ppx_enumerate.113.33.00+4.03 ppx_expect.113.33.01+4.03 ppx_fail.113.33.00+4.03 ppx_fields_conv.113.33.00+4.03 ppx_here.113.33.00 ppx_inline_test.113.33.00+4.03 ppx_jane.113.33.00 ppx_let.113.33.00+4.03 ppx_optcomp.113.33.01+4.03 ppx_pipebang.113.33.00+4.03 ppx_sexp_conv.113.33.01+4.03 ppx_sexp_message.113.33.00+4.03 ppx_sexp_value.113.33.00+4.03 ppx_tools.5.0 ppx_tools_versioned.5.0alpha ppx_type_conv.113.33.02+4.03 ppx_typerep_conv.113.33.00+4.03 ppx_variants_conv.113.33.00+4.03 re.1.7.1 react.1.2.0 reason.1.13.4 reason-parser.1.13.4 result.1.2 sawja.1.5.2 sexplib.113.33.00+4.03 topkg.0.8.1 typerep.113.24.00 utop.1.19.3 variantslib.113.24.00 xmlm.1.2.0 yojson.1.3.3 zed.1.4 --color=never",
   Unix.WEXITED 3)).
The command '/bin/sh -c OCAML_VERSION=4.04.2;     opam init --compiler=$OCAML_VERSION -j $(getconf _NPROCESSORS_ONLN || echo 1) --yes &&     cd /infer &&     ./build-infer.sh --opam-switch $OCAML_VERSION &&     rm -rf /root/.opam' returned a non-zero code: 1

When I execute the opam install command on my physical machine, I get the following error.

[nix-shell:~/Work/repos/infer/infer-linux64-v0.12.0]$ opam install -y ANSITerminal.0.7 atd.1.2.0 atdgen.1.10.0 bin_prot.113.33.00+4.03 biniou.1.0.12 camlp4.4.04+1 camlzip.1.07 camomile.0.8.5 cmdliner.1.0.0 conf-autoconf.0.1 conf-m4.1 conf-pkg-config.1.0 conf-which.1 core.113.33.02+4.03 core_kernel.113.33.02+4.03 cppo.1.4.1 ctypes.0.11.3 easy-format.1.2.0 extlib-compat.1.7.0 fieldslib.113.24.00 javalib.2.3.3 jbuilder.1.0+beta6 lambda-term.1.10.1 lwt.2.7.1 menhir.20170101 merlin-extend.0.3 ocaml-migrate-parsetree.0.7 ocamlbuild.0.11.0 ocamlfind.1.7.1 ounit.2.0.0 ppx_assert.113.33.00 ppx_bench.113.33.00+4.03 ppx_bin_prot.113.33.00+4.03 ppx_compare.113.33.00+4.03 ppx_core.113.33.01+4.03 ppx_custom_printf.113.33.00+4.03 ppx_deriving.4.1 ppx_driver.113.33.02+4.03 ppx_enumerate.113.33.00+4.03 ppx_expect.113.33.01+4.03 ppx_fail.113.33.00+4.03 ppx_fields_conv.113.33.00+4.03 ppx_here.113.33.00 ppx_inline_test.113.33.00+4.03 ppx_jane.113.33.00 ppx_let.113.33.00+4.03 ppx_optcomp.113.33.01+4.03 ppx_pipebang.113.33.00+4.03 ppx_sexp_conv.113.33.01+4.03 ppx_sexp_message.113.33.00+4.03 ppx_sexp_value.113.33.00+4.03 ppx_tools.5.0 ppx_tools_versioned.5.0alpha ppx_type_conv.113.33.02+4.03 ppx_typerep_conv.113.33.00+4.03 ppx_variants_conv.113.33.00+4.03 re.1.7.1 react.1.2.0 reason.1.13.4 reason-parser.1.13.4 result.1.2 sawja.1.5.2 sexplib.113.33.00+4.03 topkg.0.8.1 typerep.113.24.00 utop.1.19.3 variantslib.113.24.00 xmlm.1.2.0 yojson.1.3.3 zed.1.4 --color=never
The following dependencies couldn't be met:
  - ppx_deriving -> cppo_ocamlbuild -> cppo >= 1.6.0
Your request can't be satisfied:
  - Conflicting version constraints for cppo

I managed to build 0.12.0 when I edited the Dockerfile to apply the following patch before build.

diff --git a/opam.lock b/opam.lock
index e08ce54..ab52d20 100644
--- a/opam.lock
+++ b/opam.lock
@@ -13,13 +13,13 @@ conf-pkg-config = 1.0
 conf-which = 1
 core = 113.33.02+4.03
 core_kernel = 113.33.02+4.03
-cppo = 1.4.1
+cppo = 1.6.0
 ctypes = 0.11.3
 easy-format = 1.2.0
 extlib-compat = 1.7.0
 fieldslib = 113.24.00
 javalib = 2.3.3
-jbuilder = 1.0+beta6
+jbuilder = 1.0+beta10
 lambda-term = 1.10.1
 lwt = 2.7.1
 menhir = 20170101
jirkadanek commented 7 years ago

I am still looking in vain for a duplicate report of this. I cannot imagine how it could affect only me...

jvillard commented 7 years ago

Thanks for the report, this is due to a recent incompatible change in opam that is affecting our latest release: https://github.com/ocaml/opam-repository/pull/10047

fernando-jascovich commented 7 years ago

I am having the same issue with exactly the same output. In order to apply your patch to the image, I added the following two lines in the Dockerfile (just after the download of the latest Infer release):

RUN sed -i 's/cppo = 1\.4\.1/cppo = 1.6.0/' /infer/opam.lock
RUN sed -i 's/jbuilder = 1\.0+beta6/jbuilder = 1.0+beta10/' /infer/opam.lock

I know is not a solution but it will allow to build the image

veryitman commented 7 years ago

This help me. Ths.