terminfo-0.4.1.4 breaks a build of hls not finding a specific version of some symbols from libtinfo.so, one of them being tigetnum.
There is also this warning, which I see when building other programs:
/lib64/libtinfo.so.5: no version information available (required by terminfo-0.4.1.4/libHSterminfo-0.4.1.4-ghc8.10.7.so)
The following is an error that breaks building of haskell-language-server:
terminfo-0.4.1.4/libHSterminfo-0.4.1.4-ghc8.10.7.so: error: undefined reference to 'tigetnum', version 'NCURSES_TINFO_5.0.19991023'
This is using versioned symbols feature of gcc stack, where you can have symbols with different versions in the same ELF file. However, my copy of libtinfo.so does not have versioned symbols and I don't see anything in terminfo code on github that would indicate it is requiring versioned symbols: that said I am not sure what I should be looking for, just grepped the srcs for the version.
objdump -x invoked on libHSterminfo-0.4.1.4-ghc8.10.7.so:
Version definitions:
1 0x01 0x057dc17f libHSterminfo-0.4.1.4-ghc8.10.7.so
Version References:
required from libtinfo.so.5:
0x02a6c513 0x00 02 NCURSES_TINFO_5.0.19991023
required from libc.so.6:
0x09691a75 0x00 03 GLIBC_2.2.5
Unfortunately, I believe this may be a Stack issue where it downloads the wrong versions of GHC on CentOS/RHEL7 systems (i.e., downloading the Debian 9 version instead of the CentOS 7 version).
In order to work around this problem, you will first need to manually clean out your
.stackdirectory to remove the offending binary packages. The bad GHC version (tarfile and directory) will need to be removed from.stack/programs/x86_64-linux. I also found I needed to clean out.stack/snapshotsto avoid additional linkage errors, and I can't point you to exactly which files under there were the offenders. It's honestly safest to wipe your entire.stackdirectory and start from scratch.Anyway, I was able to build
haskell-language-serverin a CentOS 7 container as follows:Ensure
ncurses-develandzlib-develpackages are installed.Remove the entire
.stackdirectory.Run
stack updateto recreate a skeleton.stackdirectory.Edit
.stack/config.yamlto add the following clause:Obviously, this is per-version configuration, so if you build with other GHC versions, you'll need to add additional subclauses.
Download and check out tag 1.7.0.0 of the HLS source:
Build.
Again, it's crucial that no stale binaries from
.stackor the project-local.stack-worksneak into your build. So removing.stackentirely and also building from a fresh Git clone of HLS will be safest.Until this Stack bug is fixed, you'll have to remain vigilant in adding additional clauses to
config.yamlto avoid accidentally downloading a Debian build of some older or newer GHC version and wrecking your.stackcache.