Skip to content

Shrink list of RUNPATH entries for GHC libraries

Recently Cabal/GHC acquired dynamic-library-dirs file tag support in ** .conf** files.

Cabal-HEAD when used with GHC-HEAD puts all shared libraries into a single directory except the GHC itself (a fallout of https://github.com/haskell/cabal/issues/4046 ).

In https://github.com/haskell/cabal/issues/4046#issuecomment-256603828 Christiaan explains our current sources of RUNPATH tags.

Basically, current GHC dynamic library layout is still per-directory:

/usr/lib64/ghc-8.1.20161026/Cabal-1.25.0.0/libHSCabal-1.25.0.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/array-0.5.1.1/libHSarray-0.5.1.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/base-4.9.0.0/libHSbase-4.9.0.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/binary-0.8.3.0/libHSbinary-0.8.3.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/bytestring-0.10.8.1/libHSbytestring-0.10.8.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/compact-1.0.0.0/libHScompact-1.0.0.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/containers-0.5.7.1/libHScontainers-0.5.7.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/deepseq-1.4.2.0/libHSdeepseq-1.4.2.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/directory-1.2.6.2/libHSdirectory-1.2.6.2-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/filepath-1.4.1.0/libHSfilepath-1.4.1.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/ghc-8.1/libHSghc-8.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/ghc-boot-8.1/libHSghc-boot-8.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/ghc-boot-th-8.1/libHSghc-boot-th-8.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/ghc-prim-0.5.0.0/libHSghc-prim-0.5.0.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/ghci-8.1/libHSghci-8.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/haskeline-0.7.2.3/libHShaskeline-0.7.2.3-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/hoopl-3.10.2.1/libHShoopl-3.10.2.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/hpc-0.6.0.3/libHShpc-0.6.0.3-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/integer-gmp-1.0.0.1/libHSinteger-gmp-1.0.0.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/pretty-1.1.3.3/libHSpretty-1.1.3.3-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/process-1.4.2.0/libHSprocess-1.4.2.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/rts/libHSrts-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/rts/libHSrts_debug-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/rts/libHSrts_l-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/rts/libHSrts_thr-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/rts/libHSrts_thr_debug-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/rts/libHSrts_thr_l-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/template-haskell-2.11.0.0/libHStemplate-haskell-2.11.0.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/terminfo-0.4.0.2/libHSterminfo-0.4.0.2-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/time-1.6.0.1/libHStime-1.6.0.1-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/transformers-0.5.2.0/libHStransformers-0.5.2.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/unix-2.7.2.0/libHSunix-2.7.2.0-ghc8.1.20161026.so
/usr/lib64/ghc-8.1.20161026/xhtml-3000.2.1/libHSxhtml-3000.2.1-ghc8.1.20161026.so

Could we store them exactly as Cabal does? Namely

dynamic-library-dirs: /usr/lib64/x86_64-linux-ghc-8.1.20161026

Then for globally installed packages (how distributions usually build packages) we would have exactly one RUNPATH.

Currently we have:

$ readelf -a /usr/bin/read-idiii | grep RUNPATH
 0x000000000000001d (RUNPATH)            Library runpath: [/usr/lib64/ghc-8.1.20161026/array-0.5.1.1:/usr/lib64/ghc-8.1.20161026/base-4.9.0.0:/usr/lib64/ghc-8.1.20161026/binary-0.8.3.0:/usr/lib64/ghc-8.1.20161026/bytestring-0.10.8.1:/usr/lib64/ghc-8.1.20161026/containers-0.5.7.1:/usr/lib64/ghc-8.1.20161026/deepseq-1.4.2.0:/usr/lib64/ghc-8.1.20161026/directory-1.2.6.2:/usr/lib64/ghc-8.1.20161026/filepath-1.4.1.0:/usr/lib64/ghc-8.1.20161026/ghc-prim-0.5.0.0:/usr/lib64/ghc-8.1.20161026/integer-gmp-1.0.0.1:/usr/lib64/ghc-8.1.20161026/process-1.4.2.0:/usr/lib64/ghc-8.1.20161026/rts:/usr/lib64/ghc-8.1.20161026/time-1.6.0.1:/usr/lib64/ghc-8.1.20161026/transformers-0.5.2.0:/usr/lib64/ghc-8.1.20161026/unix-2.7.2.0:/usr/lib64/x86_64-linux-ghc-8.1.20161026]

And that could be just single

/usr/lib64/x86_64-linux-ghc-8.1.20161026

It's close to ticket #11587 (closed).

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ezyang
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information