haskell / ghcup-hs

https://www.haskell.org/ghcup/
GNU Lesser General Public License v3.0
265 stars 78 forks source link

ghcup 0.1.22.0 fails to build cross-compilers with --hadrian #1082

Open vmchale opened 2 weeks ago

vmchale commented 2 weeks ago

Running:

ghcup compile ghc -j6 -v 9.2.8 -b 9.0.2 -x aarch64-linux-gnu --config $(pwd)/build-native.mk

fails with

[ ghc-make ] # We finally replace the original file.
[ ghc-make ] mv '/home/vanessa/.ghcup/tmp/ghcup-8de9ba68268d658c/home/vanessa/.ghcup/ghc/aarch64-linux-gnu-9.2.8/lib/ghc-9.2.8/lib/package.conf.d/ghc-compact-0.1.0.0.conf.copy.co...
[ ghc-make ] '/home/vanessa/.ghcup/tmp/ghcup-8de9ba68268d658c/home/vanessa/.ghcup/ghc/aarch64-linux-gnu-9.2.8/lib/ghc-9.2.8/bin/ghc-pkg' --global-package-db "/home/vanessa/.ghcup...
[ ghc-make ] /bin/bash: line 1: /home/vanessa/.ghcup/tmp/ghcup-8de9ba68268d658c/home/vanessa/.ghcup/ghc/aarch64-linux-gnu-9.2.8/lib/ghc-9.2.8/bin/ghc-pkg: No such file or directo...
[ ghc-make ] gmake: *** [Makefile:218: update_package_db] Error 127
[ Error ] [GHCup-00841] Process "gmake" with arguments ["DESTDIR=/home/vanessa/.ghcup/tmp/ghcup-8de9ba68268d658c",
[ ...   ]                                 "install"] failed with exit code 2.

where ghcup 0.1.18.0 succeeded.

Also it will use the system GHC rather than the GHC specified by -b (for ghcup 0.1.18.0 -b works). I have to run ghcup set ... to get it to run with ghcup 0.1.22.0

vmchale commented 2 weeks ago

This appears to be related to --hadrian. ghcup compile ghc -j6 -v 9.2.8 -b 9.0.2 -x aarch64-linux-gnu --config $(pwd)/build-native.mk --make with ghcup 0.1.22.0 works, provided that one runs ghcup set ghc 9.0.2 instead of relying on -b

dfordivam commented 2 weeks ago

It is so weird that the error happened in gmake install phase, which is supposed to happen after the hadrian step, but the --make is working.

The error indicates that aarch64-linux-gnu-9.2.8/lib/ghc-9.2.8/bin/ghc-pkg is not available, something is likely wrong with the bindist being created by hadrian.

dfordivam commented 2 weeks ago

@vmchale the issue here is that hadrian does not support "build.mk" based config. The regression in the behaviour of ghcup is just due to hadrian becoming the default, earlier ghcup (0.1.18.0) would have used --make.

hasufell commented 1 week ago

Yes, there are a couple of GHC versions that support both make and hadrian. GHCup's logic is as follows:

The issues with -b are here: