Hadrian binary-dist Installs files into the wrong location
I've compared the binary dist installation of GHC-8.6.1 and HEAD+Hadrian (on linux):
$ cd ghc-8.6.1
$ ./configure --prefix=~/ghc-8.6.1
$ sudo make install # I'm not sure why, but sudo was needed here
$ cd ..
$ cd ghc # ghc head
$ ./hadrian/build.sh -j dinary-dist
$ cd _build/bindist/ghc-<ver>-<ptfm>
$ ./configure --prefix=~/ghc-HEAD
$ make install
$ cd ..
It seems Hadrian places many files in the wrong place:
- (A) 8.6.1 places many files in
${prefix}/lib/ghc-8.6.1
and places no other files/directories directly in${prefix}/lib
. HEAD+Hadrian on the other hand, places some of the corresponding files in${prefix}/lib/ghc-<ver>
, and the rest in the parent directory${prefix}/lib
(this seems like a blatant bug to me). - (B) HEAD+Hadrian places an
include
directory in${prefix}
while make places it in${prefix}/lib/ghc-8.6.1
.
Also note that all binaries (e.g. ghc itself) should be placed in ${prefix}/lib/ghc-<ver>
as is done in make. Annoyingly, these binaries will fail to run if called directly. Instead, the wrapper scripts must be used (placed at ${prefix}/bin
). This begs the question:
- (C) The rpaths on the Hadrian binaries are correct in the
_build
directory, but are no longer correct after a binary-dist install! In order for the rpaths to be correct in both cases, the relative locations of the shared libraries and the binaries must be the same. This could be solved by changing the location of the binaries in the_build
directory (and possibly adding wrapper scripts in_build
in place of the binaries e.g. so_build/stage1/bin/ghc
is a wrapper that calls_build/stage1/lib/bin/ghc
).
Related github issue: https://github.com/snowleopard/hadrian/issues/570.