Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make friendlier error when libgmp-dev is missing #1537

Open
tanyabouman opened this issue Apr 13, 2021 · 0 comments
Open

Make friendlier error when libgmp-dev is missing #1537

tanyabouman opened this issue Apr 13, 2021 · 0 comments

Comments

@tanyabouman
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When missing the libgmp-dev package, the error is not that clear.

ERROR: /root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/external/stackage/BUILD.bazel:828:22: HaskellCabalLibrary @stackage//:th-abstraction failed: (Exit 1): process-wrapper failed: error executing command 
  (cd /root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples && \
  exec env - \
    CC_WRAPPER_CC_PATH=/usr/bin/gcc \
    CC_WRAPPER_CPU=k8 \
    CC_WRAPPER_PLATFORM=linux \
    LANG=C.UTF-8 \
    PATH=/usr/bin \
    RULES_HASKELL_DOCDIR_PATH=external/rules_haskell_ghc_linux_amd64/doc/html/libraries/base-4.12.0.0 \
    RULES_HASKELL_GHC_PATH=external/rules_haskell_ghc_linux_amd64/bin/ghc \
    RULES_HASKELL_GHC_PKG_PATH=external/rules_haskell_ghc_linux_amd64/bin/ghc-pkg \
    RULES_HASKELL_LIBDIR_PATH=external/rules_haskell_ghc_linux_amd64/lib \
    TMPDIR=/tmp \
  /root/.cache/bazel/_bazel_root/install/1a4a2fac02d50c77031d44c0d91b8920/process-wrapper '--timeout=0' '--kill_delay=15' bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction_cabal_wrapper_args.json) process-wrapper failed: error executing command 
  (cd /root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples && \
  exec env - \
    CC_WRAPPER_CC_PATH=/usr/bin/gcc \
    CC_WRAPPER_CPU=k8 \
    CC_WRAPPER_PLATFORM=linux \
    LANG=C.UTF-8 \
    PATH=/usr/bin \
    RULES_HASKELL_DOCDIR_PATH=external/rules_haskell_ghc_linux_amd64/doc/html/libraries/base-4.12.0.0 \
    RULES_HASKELL_GHC_PATH=external/rules_haskell_ghc_linux_amd64/bin/ghc \
    RULES_HASKELL_GHC_PKG_PATH=external/rules_haskell_ghc_linux_amd64/bin/ghc-pkg \
    RULES_HASKELL_LIBDIR_PATH=external/rules_haskell_ghc_linux_amd64/lib \
    TMPDIR=/tmp \
  /root/.cache/bazel/_bazel_root/install/1a4a2fac02d50c77031d44c0d91b8920/process-wrapper '--timeout=0' '--kill_delay=15' bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction_cabal_wrapper_args.json)
<command line>: can't load .so/.DLL for: libgmp.so (libgmp.so: cannot open shared object file: No such file or directory)
Traceback (most recent call last):
  File "/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/runghc.runfiles/rules_haskell/haskell/runghc.py", line 9, in <module>
    subprocess.run([r.Rlocation("rules_haskell_ghc_linux_amd64/bin/runghc")] + sys.argv[1:], check=True)
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/runghc.runfiles/rules_haskell_ghc_linux_amd64/bin/runghc', '/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/external/stackage/th-abstraction-0.3.1.0/Setup.hs', 'configure', 'lib:th-abstraction', '--verbose=0', '--user', '--with-compiler=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/external/rules_haskell_ghc_linux_amd64/bin/ghc', '--with-hc-pkg=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/external/rules_haskell_ghc_linux_amd64/bin/ghc-pkg', '--with-ar=/usr/bin/ar', '--with-gcc=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python', '--with-strip=/usr/bin/strip', '--enable-deterministic', '--ghc-option=-pgma', '--ghc-option=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python', '--ghc-option=-pgmc', '--ghc-option=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python', '--ghc-option=-pgml', '--ghc-option=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python', '--ghc-option=-pgmP', '--ghc-option=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python -E -undef -traditional', '--ghc-option=-optc-fno-stack-protector', '--enable-relocatable', '--builddir=../../../bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/tmpeq9qhrmg', '--prefix=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install', '--libdir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0_iface', '--dynlibdir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/lib', '--libsubdir=', '--bindir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/bin', '--datadir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0_data', '--datasubdir=', '--haddockdir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0_haddock', '--htmldir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0_haddock_html', '--package-db=clear', '--package-db=global', '--flags=', '--ghc-option=-optl-no-pie', '--ghc-option=-w', '--ghc-option=-optF=-w', '--ghc-option=-optl-Wl,-rpath,$ORIGIN/../../../../../_solib_k8/external_Srules_Uhaskell_Ughc_Ulinux_Uamd64', '--package-db=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0.conf.d']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper.runfiles/rules_haskell/haskell/private/cabal_wrapper.py", line 188, in <module>
    run([runghc] + runghc_args + [setup, "configure", \
  File "/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper.runfiles/rules_haskell/haskell/private/cabal_wrapper.py", line 60, in run
    subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, *args, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/runghc', '/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/external/stackage/th-abstraction-0.3.1.0/Setup.hs', 'configure', 'lib:th-abstraction', '--verbose=0', '--user', '--with-compiler=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/external/rules_haskell_ghc_linux_amd64/bin/ghc', '--with-hc-pkg=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/external/rules_haskell_ghc_linux_amd64/bin/ghc-pkg', '--with-ar=/usr/bin/ar', '--with-gcc=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python', '--with-strip=/usr/bin/strip', '--enable-deterministic', '--ghc-option=-pgma', '--ghc-option=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python', '--ghc-option=-pgmc', '--ghc-option=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python', '--ghc-option=-pgml', '--ghc-option=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python', '--ghc-option=-pgmP', '--ghc-option=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/host/bin/external/rules_haskell/haskell/cc_wrapper-python -E -undef -traditional', '--ghc-option=-optc-fno-stack-protector', '--enable-relocatable', '--builddir=../../../bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/tmpeq9qhrmg', '--prefix=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install', '--libdir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0_iface', '--dynlibdir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/lib', '--libsubdir=', '--bindir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/bin', '--datadir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0_data', '--datasubdir=', '--haddockdir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0_haddock', '--htmldir=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0_haddock_html', '--package-db=clear', '--package-db=global', '--flags=', '--ghc-option=-optl-no-pie', '--ghc-option=-w', '--ghc-option=-optF=-w', '--ghc-option=-optl-Wl,-rpath,$ORIGIN/../../../../../_solib_k8/external_Srules_Uhaskell_Ughc_Ulinux_Uamd64', '--package-db=/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples/bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction-0.3.1.0/_install/th-abstraction-0.3.1.0.conf.d']' returned non-zero exit status 1.
Target //cat_hs/exec/cat_hs:cat_hs failed to build
ERROR: /root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/external/stackage/BUILD.bazel:794:22 HaskellCabalLibrary @stackage//:text-show failed: (Exit 1): process-wrapper failed: error executing command 
  (cd /root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples && \
  exec env - \
    CC_WRAPPER_CC_PATH=/usr/bin/gcc \
    CC_WRAPPER_CPU=k8 \
    CC_WRAPPER_PLATFORM=linux \
    LANG=C.UTF-8 \
    PATH=/usr/bin \
    RULES_HASKELL_DOCDIR_PATH=external/rules_haskell_ghc_linux_amd64/doc/html/libraries/base-4.12.0.0 \
    RULES_HASKELL_GHC_PATH=external/rules_haskell_ghc_linux_amd64/bin/ghc \
    RULES_HASKELL_GHC_PKG_PATH=external/rules_haskell_ghc_linux_amd64/bin/ghc-pkg \
    RULES_HASKELL_LIBDIR_PATH=external/rules_haskell_ghc_linux_amd64/lib \
    TMPDIR=/tmp \
  /root/.cache/bazel/_bazel_root/install/1a4a2fac02d50c77031d44c0d91b8920/process-wrapper '--timeout=0' '--kill_delay=15' bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction_cabal_wrapper_args.json) process-wrapper failed: error executing command 
  (cd /root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/sandbox/processwrapper-sandbox/33/execroot/rules_haskell_examples && \
  exec env - \
    CC_WRAPPER_CC_PATH=/usr/bin/gcc \
    CC_WRAPPER_CPU=k8 \
    CC_WRAPPER_PLATFORM=linux \
    LANG=C.UTF-8 \
    PATH=/usr/bin \
    RULES_HASKELL_DOCDIR_PATH=external/rules_haskell_ghc_linux_amd64/doc/html/libraries/base-4.12.0.0 \
    RULES_HASKELL_GHC_PATH=external/rules_haskell_ghc_linux_amd64/bin/ghc \
    RULES_HASKELL_GHC_PKG_PATH=external/rules_haskell_ghc_linux_amd64/bin/ghc-pkg \
    RULES_HASKELL_LIBDIR_PATH=external/rules_haskell_ghc_linux_amd64/lib \
    TMPDIR=/tmp \
  /root/.cache/bazel/_bazel_root/install/1a4a2fac02d50c77031d44c0d91b8920/process-wrapper '--timeout=0' '--kill_delay=15' bazel-out/host/bin/external/rules_haskell/haskell/cabal_wrapper bazel-out/k8-fastbuild/bin/external/stackage/th-abstraction_cabal_wrapper_args.json)
INFO: Elapsed time: 22.807s, Critical Path: 5.82s
INFO: 12 processes: 6 internal, 6 processwrapper-sandbox.
FAILED: Build did NOT complete successfully

Reproduce with:

docker run --rm -it ubuntu:20.04 bash
# follow bazel instructions here https://docs.bazel.build/versions/master/install-ubuntu.html
apt update && apt install -y git
git clone https://github.com/tweag/rules_haskell
cd rules_haskell/examples
apt update && apt install -y build-essential libffi-dev libtinfo5 libtinfo-dev python python3
bazel build --verbose_failures --sandbox_debug //cat_hs/exec/cat_hs

The error is easily resolved by installing libgmp-dev, as indicated in the list of dependencies.

apt update && apt install -y libgmp-dev

Describe the solution you'd like
An error that clearly points to the possibility of a missing library, since that's likely the problem, and links to the other required dependencies, just in case those are missing too.

Describe alternatives you've considered
The current error is not that terrible, because it does mention libgmp.so, and a quick internet search will probably find out that the problem is a missing package. However, that search also returns results about having the wrong version of libgmp, which could be confusing.

Additional context
Inspired by: #1416 #1419 #1535

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants