Ghc install - libtinfo.so.6: cannot open shared object file

Hi!

I have this error during ghc installation: (this is the package I downloaded https://downloads.haskell.org/ghc/8.10.2/ghc-8.10.2-aarch64-deb10-linux.tar.xz)

Installing library in /usr/local/lib/ghc-8.10.2/ghc-8.10.2
"/usr/local/lib/ghc-8.10.2/bin/ghc-pkg" --force --global-package-db "/usr/local/lib/ghc-8.10.2/package.conf.d" update rts/dist/package.conf.install
/usr/local/lib/ghc-8.10.2/bin/ghc-pkg: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory
ghc.mk:967: recipe for target 'install_packages' failed
make[1]: *** [install_packages] Error 127

there is a topic with a similar issue but libtinfo.so.5 is installed on my system.

So what I did as a workaround is to make a symlink to version 5:
ln -s /lib/aarch64-linux-gnu/libtinfo.so.5.9 /lib/aarch64-linux-gnu/libtinfo.so.6
But then I got this error:

Installing library in /usr/local/lib/ghc-8.10.2/ghc-8.10.2
"/usr/local/lib/ghc-8.10.2/bin/ghc-pkg" --force --global-package-db "/usr/local/lib/ghc-8.10.2/package.conf.d" update rts/dist/package.conf.install
/usr/local/lib/ghc-8.10.2/bin/ghc-pkg: /lib/aarch64-linux-gnu/libtinfo.so.6: version `NCURSES6_TINFO_5.0.19991023' not found (required by /usr/local/lib/ghc-8.10.2/bin/ghc-pkg)
/usr/local/lib/ghc-8.10.2/bin/ghc-pkg: /lib/aarch64-linux-gnu/libtinfo.so.6: version `NCURSES6_TINFO_5.0.19991023' not found (required by /usr/local/lib/ghc-8.10.2/bin/../terminfo-0.4.1.4/libHSterminfo-0.4.1.4-ghc8.10.2.so)
ghc.mk:967: recipe for target 'install_packages' failed
make[1]: *** [install_packages] Error 1
Makefile:51: recipe for target 'install' failed
make: *** [install] Error 2

Any ideas what went worng? Thanks!

uname -a                 
Linux d17578762118 4.15.0-143-generic #147-Ubuntu SMP Wed Apr 14 16:10:11 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
cat /etc/issue
Ubuntu 18.04.5 LTS \n \l

Hello, it appears the ghc version you are currently trying to use has been linked again libtinfo6, you should consider installing the required dependency. libtinfo5 and libtinfo6 are different libraries, I mean same project but not version.

As for the second error, it is to be expected, a symlink to libtinfo5 will not make a libtinfo6 out of it. I mean you’ll only fool the dynamic linker up to the point when it is looking for a symbol in your lib that is not present (see ld.so(8) for more information). If you want to check the symbols in a shared object (dynamic library) then you could use nm -D mylib.so.

Since you’re using Ubuntu, maybe

$ sudo apt-get install libtinfo6

will resolve your issue, you can have libtinfo5 and libtinfo6 living in harmony on the same system without any trouble. And if you want to check which of your packages are relying on libtinfo5, then

$ apt-cache rdepends libtinfo5

should do the trick…

Hi!

Thanks for the response!
The problem is that 18.04 does not contain libtinfo6…
So I need to switch to 20.04, I guess…
https://www.ubuntuupdates.org/package/core/focal/main/base/libtinfo6

Hi. You’re welcome.

Well, that’s unfortunate, I see another solution if you want to keep this Long Term Support install (16.04 is already in Extended Security Maintenance phase though), however be advised that you might run into other outdated libs. First you would have to get the corresponding libtinfo6 package, then either you install it manually (dpkg -i libtinfo6_6.2-0ubuntu2_amd64.deb for amd64 arch), since this package does only have one dependency on libc6, or you extract the required lib (.so and symlinks) with the help of dpkg-deb tool (dpkg package on Debian, probably the same on Ubuntu). Then don’t forget to run ldconfig.

Content of libtinfo6_6.2-0ubuntu2_amd64.deb package
$ dpkg-deb -c libtinfo6_6.2-0ubuntu2_amd64.deb
drwxr-xr-x root/root         0 2020-02-26 08:14 ./
drwxr-xr-x root/root         0 2020-02-26 08:14 ./lib/
drwxr-xr-x root/root         0 2020-02-26 08:14 ./lib/x86_64-linux-gnu/
-rw-r--r-- root/root    192032 2020-02-26 08:14 ./lib/x86_64-linux-gnu/libtinfo.so.6.2
drwxr-xr-x root/root         0 2020-02-26 08:14 ./usr/
drwxr-xr-x root/root         0 2020-02-26 08:14 ./usr/lib/
drwxr-xr-x root/root         0 2020-02-26 08:14 ./usr/lib/x86_64-linux-gnu/
-rw-r--r-- root/root     67896 2020-02-26 08:14 ./usr/lib/x86_64-linux-gnu/libtic.so.6.2
drwxr-xr-x root/root         0 2020-02-26 08:14 ./usr/share/
drwxr-xr-x root/root         0 2020-02-26 08:14 ./usr/share/doc/
drwxr-xr-x root/root         0 2020-02-26 08:14 ./usr/share/doc/libtinfo6/
-rw-r--r-- root/root      2383 2019-10-21 18:45 ./usr/share/doc/libtinfo6/FAQ
-rw-r--r-- root/root       256 2019-10-21 18:45 ./usr/share/doc/libtinfo6/TODO.Debian
-rw-r--r-- root/root      2341 2020-02-26 08:14 ./usr/share/doc/libtinfo6/changelog.Debian.gz
-rw-r--r-- root/root      6366 2019-10-21 18:45 ./usr/share/doc/libtinfo6/copyright
lrwxrwxrwx root/root         0 2020-02-26 08:14 ./lib/x86_64-linux-gnu/libtinfo.so.6 -> libtinfo.so.6.2
lrwxrwxrwx root/root         0 2020-02-26 08:14 ./usr/lib/x86_64-linux-gnu/libtic.so.6 -> libtic.so.6.2

And remember this solution is more of a workaround than a fix because if you go this way you will not get the benefits of the package manager, you’ll have to do it again if libtinfo6 has an update.