ghc 9.2.2 wrappers have "#!sh" on macos11 which doesn't work
I apologize if this is a GHC issue and not a GHCUP issue.
I have been using GHCUP successfully on my x86 mac 11.6 for a while, to install GHC and Cabal, and now I want to install GHC 9.2.2 and it fails:
$ ghcup install ghc 9.2.2
...
[ ghc-make ] '/Users/quark/tmpghc/bin/ghc-pkg' recache
[ ghc-make ] sh: /Users/quark/tmpghc/bin/ghc-pkg: sh: bad interpreter: No such file or directory
[ ghc-make ] make: *** [update_package_db] Error 126
[ Error ] (Process "make" with arguments ["install"] failed with exit code 2.,
GHCUP deletes the install directory, so I couldn't see what was wrong with the file at first. (Is there any way to force GHCUP to leave the files?) But I was able to find the temp build directory and manually run make install
. When I do that, I can see the ghc-pkg
file (a wrapper shell script) and I see that the first line is #!sh
and not #!/bin/sh
. For some reason, #!sh
doesn't work. (If I replace it with #!/bin/sh
, then the script runs.)
If I look at the wrapper it in my earlier installations (such as GHC 9.0.1), I see that they have #!/bin/sh
.
In the temp directory where GHCUP unpacked the source files (ghc-9.2.2-x86_64-apple-darwin
) I see that there is a wrappers
directory, but the files there are just the bodies; the top-level Makefile
creates the wrappers by inserting the first lines of the file. I see, for example, that it creates the first line using SHELL
:
echo "#!$(SHELL)" >> '$2' && \
and I see that the configure script has determined that SHELL
is sh
, in the log:
SHELL='sh'
Is there some way to tell GHCUP to pass a different shell value to the configure script?
I do see in the GHC repo that this Makefile appears to come from hadrian/bindist/Makefile
, and that this line has been unchanged since 2019, so nothing has changed there. I am not sure where the configure scripts come from, though, so I can't see if something has changed there.