Skip to content

Commit d0b2d45

Browse files
angermanhamishmack
andauthored
Fix building with more recent android sdk/ndks (#2443)
* Fix building with more recent android sdk/ndks This requires the atomic type fix (backport), as well as some mucking around with hadrian, which failes to properly account for static libraries. * Fix patch upper bound --------- Co-authored-by: Hamish Mackenzie <[email protected]>
1 parent 09e2152 commit d0b2d45

File tree

3 files changed

+854
-0
lines changed

3 files changed

+854
-0
lines changed

compiler/ghc/default.nix

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,26 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec {
969969
'';
970970
buildPhase = ''
971971
runHook preBuild
972+
'' + lib.optionalString (!enableShared && targetPlatform.isAndroid && targetPlatform.isAarch64)
973+
# This is rather idiotic, but we need to create the dynamic (.so) files because
974+
# hadrian expects them in the src/Rules/Rts.hs:160 or thereabout.
975+
''
976+
mkdir -p _build/stage1/lib/aarch64-android-ghc-${ghc-version}/
977+
touch _build/stage1/lib/aarch64-android-ghc-${ghc-version}/libHSrts-1.0.2_thr_debug-ghc${ghc-version}.so
978+
touch _build/stage1/lib/aarch64-android-ghc-${ghc-version}/libHSrts-1.0.2_thr-ghc${ghc-version}.so
979+
touch _build/stage1/lib/aarch64-android-ghc-${ghc-version}/libHSrts-1.0.2_debug-ghc${ghc-version}.so
980+
touch _build/stage1/lib/aarch64-android-ghc-${ghc-version}/libHSrts-1.0.2-ghc${ghc-version}.so
981+
'' + lib.optionalString (!enableShared && targetPlatform.isAndroid && targetPlatform.isAarch32)
982+
# This is rather idiotic, but we need to create the dynamic (.so) files because
983+
# hadrian expects them in the src/Rules/Rts.hs:160 or thereabout.
984+
''
985+
mkdir -p _build/stage1/lib/arm-android-ghc-${ghc-version}/
986+
touch _build/stage1/lib/arm-android-ghc-${ghc-version}/libHSrts-1.0.2_thr_debug-ghc${ghc-version}.so
987+
touch _build/stage1/lib/arm-android-ghc-${ghc-version}/libHSrts-1.0.2_thr-ghc${ghc-version}.so
988+
touch _build/stage1/lib/arm-android-ghc-${ghc-version}/libHSrts-1.0.2_debug-ghc${ghc-version}.so
989+
touch _build/stage1/lib/arm-android-ghc-${ghc-version}/libHSrts-1.0.2-ghc${ghc-version}.so
990+
''
991+
+ ''
972992
${hadrian}/bin/hadrian ${hadrianArgs}
973993
'' + lib.optionalString (installStage1 && !stdenv.targetPlatform.isGhcjs && builtins.compareVersions ghc-version "9.8" < 0) ''
974994
${hadrian}/bin/hadrian ${hadrianArgs} stage1:lib:libiserv

overlays/bootstrap.nix

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

336336
++ onAndroid (from "9.6" ./patches/ghc/ghc-9.6-COMPAT_R_ARM_PREL31.patch)
337337
++ onAndroid (from "9.10" ./patches/ghc/ghc-9.10-ignore-libc.patch)
338+
# unbreak modern clang with proper _atomic declarations.
339+
++ onAndroid (fromUntil "9.6" "9.6.5" ./patches/ghc/7db8c9927fae3369fc4ecff68f80c4cb32eea757.patch)
338340

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

0 commit comments

Comments
 (0)