Skip to content

Commit 7b26744

Browse files
committed
Fix building with more recent android sdk/ndksThis requires the atomic type fix (backport), as well as some mucking around with hadrian, which failes to properly account for static libraries
1 parent 8244bb2 commit 7b26744

File tree

3 files changed

+845
-0
lines changed

3 files changed

+845
-0
lines changed

compiler/ghc/default.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,17 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec {
967967
'';
968968
buildPhase = ''
969969
runHook preBuild
970+
'' + lib.optionalString (!enableShared && targetPlatform.isAndroid && targetPlatform.isAarch64)
971+
# This is rather idiotic, but we need to create the dynamic (.so) files because
972+
# hadrian expects them in the src/Rules/Rts.hs:160 or thereabout.
973+
''
974+
mkdir -p _build/stage1/lib/aarch64-android-ghc-${ghc-version}/
975+
touch _build/stage1/lib/aarch64-android-ghc-${ghc-version}/libHSrts-1.0.2_thr_debug-ghc${ghc-version}.so
976+
touch _build/stage1/lib/aarch64-android-ghc-${ghc-version}/libHSrts-1.0.2_thr-ghc${ghc-version}.so
977+
touch _build/stage1/lib/aarch64-android-ghc-${ghc-version}/libHSrts-1.0.2_debug-ghc${ghc-version}.so
978+
touch _build/stage1/lib/aarch64-android-ghc-${ghc-version}/libHSrts-1.0.2-ghc${ghc-version}.so
979+
''
980+
+ ''
970981
${hadrian}/bin/hadrian ${hadrianArgs}
971982
'' + lib.optionalString (installStage1 && !stdenv.targetPlatform.isGhcjs && builtins.compareVersions ghc-version "9.8" < 0) ''
972983
${hadrian}/bin/hadrian ${hadrianArgs} stage1:lib:libiserv

overlays/bootstrap.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ in {
333333

334334
++ onAndroid (from "9.6" ./patches/ghc/ghc-9.6-COMPAT_R_ARM_PREL31.patch)
335335
++ onAndroid (from "9.10" ./patches/ghc/ghc-9.10-ignore-libc.patch)
336+
# unbreak modern clang with proper _atomic declarations.
337+
++ onAndroid (fromUntil "9.6" "9.12" ./patches/ghc/7db8c9927fae3369fc4ecff68f80c4cb32eea757.patch)
336338

337339
++ onGhcjs (from "9.12" ./patches/ghc/ghc-9.12-ghcjs-rts-mem-heap8.patch)
338340
# Fix for `fatal error: 'rts/Types.h' file not found` when building `primitive`

0 commit comments

Comments
 (0)