iOS cross compiler build is slightly broken
There are a couple of pain points trying to build GHC 9.0.1 as a
aarch64-apple-ios cross compiler.
Steps to reproduce
./configure --target=aarch64-apple-ios && gmake -k in the GHC 9.0.1 source distribution on x86_64 macOS 11.2.3 with wrapper scripts
aarch64-apple-ios-clang etc. on the PATH that invoke the corresponding utilities through
xcrun (XCode 12.4). Having either LLVM 11 or LLVM 9 (as some of the errors from using LLVM 11 suggest) on the PATH reproduces failure.
Once the dust settles, there appear to be 2 files that fail to compile in the RTS and a whole slew of GHC panics from
ghc-stage1 about not being able to look up the data layout for
arm64-apple-ios (note the triple has changed!).
AFAICT the note about LLVM not understanding
aarch64-apple-ios is not true (anymore), so I can fix the panics by changing the LLVM arch from
mk/project.mk. The RTS compilation errors appear to be because a couple of
#if defined(darwin_HOST_OS) branches were not being taken, which I can fudge by adding appropriate
|| defined(ios_HOST_OS)s near the errors. Then
gmake clean && gmake successfully builds. I'm not sure how to "correctly" fix these, so I'm opening an issue instead of an MR. In particular,
mk/project.mk is supposed to be auto-generated, and I'm wondering if there are more Darwin/iOS branches incorrectly labelled only Darwin.