I'd like to remove terminfo
package from the default dependencies of my GHC installation, as the generated executable does not run in a particular environment without libtinfo
, saying:
./Main: error while loading shared libraries: libtinfo.so.6: cannot
open shared object file: No such file or directory
So, is there any neat way to remove dependency on terminfo
package?
The only way I found is to use -hide-all-packages
of ghc
and then enumerate all required default packages via -package
option:
ghc -hide-all-packages -package-db ~/.cabal/store/ghc-8.10.7/package.db \
-package base -package containers -package array -package template-haskell \
-package unix -package filepath -package process -package directory \
-package time --make Main.hs
Options like -hide-package
or -ignore-package
doesn't work.
$ ghc -ignore-package terminfo -ignore-package ghc --make Main.hs
Loaded package environment from /home/keigoi/.ghc/x86_64-linux-8.10.7/environments/default
<command line>: cannot satisfy -package-id ghc-8.10.7:
ghc-8.10.7 is ignored due to an -ignore-package flag
(use -v for more information)
Any ideas?
Some thoughts and additional findings:
(*) I have no idea why the generated binary depends on it -- the package is required by GHC API, which is not always necessary I think and I didn't use it.
Actually, binaries generated from the fresh installation (as of GHC 8.10 or 9.2 from ghcup
) does not depend on libtinfo
.
Under the circumstance that ~/.ghc/x86_64-linux-8.10.7/environments/default
does not exist, the generated binary has no dependency to libtinfo
. This file is generated when you initialize Cabal. After that, the compiled binary will depend on libtinfo.so.
(**) Commands like strip
seems not to elimite that dependency.