Skip to content

Make friendlier error when libtinfo5 is missing #1535

Open
@tanyabouman

Description

@tanyabouman

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

ERROR: Error fetching repository: Traceback (most recent call last):
	File "/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/external/rules_haskell/haskell/ghc_bindist.bzl", line 377, column 31, in _ghc_bindist_impl
		execute_or_fail_loudly(
	File "/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/external/rules_haskell/haskell/private/workspace_utils.bzl", line 27, column 13, in execute_or_fail_loudly
		fail("\n".join(["Command failed: " + " ".join(arguments), exec_result.stderr]))
Error in fail: Command failed: make install
/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/external/rules_haskell_ghc_linux_amd64/lib/bin/ghc-pkg: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
make[1]: *** [ghc.mk:991: install_packages] Error 127
make: *** [Makefile:51: install] Error 2
ERROR: /rules_haskell/examples/cat_hs/exec/cat_hs/BUILD.bazel:6:15: //cat_hs/exec/cat_hs:cat_hs depends on @rules_haskell_ghc_linux_amd64//:toolchain-impl in repository @rules_haskell_ghc_linux_amd64 which failed to fetch. no such package '@rules_haskell_ghc_linux_amd64//': Command failed: make install
/root/.cache/bazel/_bazel_root/0d15a96fd12ed9dca003553c71536f42/external/rules_haskell_ghc_linux_amd64/lib/bin/ghc-pkg: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
make[1]: *** [ghc.mk:991: install_packages] Error 127
make: *** [Makefile:51: install] Error 2

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 libgmp-dev libtinfo-dev python python3
bazel build --verbose_failures //cat_hs/exec/cat_hs

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

apt update && apt install -y libtinfo5

Describe the solution you'd like
An error that clearly points to the missing library, 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 libtinfo.so.5, 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 libtinfo, which could be confusing.

Additional context
Inspired by #1416 and #1419

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions