From a7beb46aa788193bc07f4de2b3a77de4ac8d30de Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Thu, 5 Jun 2025 15:10:11 +0100 Subject: [PATCH] haskellPackages: fix GHC 9.12 on android --- .../compilers/ghc/common-hadrian.nix | 5 ++++ ...c-define-undefined-elf-st-visibility.patch | 24 +++++++++++++++++++ pkgs/top-level/release-haskell.nix | 4 ++-- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/compilers/ghc/ghc-define-undefined-elf-st-visibility.patch diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index f4f40bec3f22..b57beac509ad 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -291,6 +291,11 @@ url = "https://gitlab.haskell.org/ghc/ghc/-/commit/39bb6e583d64738db51441a556d499aa93a4fc4a.patch"; sha256 = "0w5fx413z924bi2irsy1l4xapxxhrq158b5gn6jzrbsmhvmpirs0"; }) + ] + + # Missing ELF symbols + ++ lib.optionals stdenv.targetPlatform.isAndroid [ + ./ghc-define-undefined-elf-st-visibility.patch ]; stdenv = stdenvNoCC; diff --git a/pkgs/development/compilers/ghc/ghc-define-undefined-elf-st-visibility.patch b/pkgs/development/compilers/ghc/ghc-define-undefined-elf-st-visibility.patch new file mode 100644 index 000000000000..bd3b3ea60485 --- /dev/null +++ b/pkgs/development/compilers/ghc/ghc-define-undefined-elf-st-visibility.patch @@ -0,0 +1,24 @@ +diff --git a/rts/linker/ElfTypes.h b/rts/linker/ElfTypes.h +index f5e2f819d9..7f75087738 100644 +--- a/rts/linker/ElfTypes.h ++++ b/rts/linker/ElfTypes.h +@@ -33,6 +33,9 @@ + #define Elf_Sym Elf64_Sym + #define Elf_Rel Elf64_Rel + #define Elf_Rela Elf64_Rela ++#if !defined(ELF64_ST_VISIBILITY) ++#define ELF64_ST_VISIBILITY(o) ((o)&0x3) ++#endif + #if !defined(ELF_ST_VISIBILITY) + #define ELF_ST_VISIBILITY ELF64_ST_VISIBILITY + #endif +@@ -60,6 +63,9 @@ + #define Elf_Sym Elf32_Sym + #define Elf_Rel Elf32_Rel + #define Elf_Rela Elf32_Rela ++#if !defined(ELF32_ST_VISIBILITY) ++#define ELF32_ST_VISIBILITY(o) ((o)&0x3) ++#endif + #if !defined(ELF_ST_VISIBILITY) + #define ELF_ST_VISIBILITY ELF32_ST_VISIBILITY + #endif /* ELF_ST_VISIBILITY */ diff --git a/pkgs/top-level/release-haskell.nix b/pkgs/top-level/release-haskell.nix index 315e94e73a79..b65b8095b288 100644 --- a/pkgs/top-level/release-haskell.nix +++ b/pkgs/top-level/release-haskell.nix @@ -515,8 +515,8 @@ let ; }; - haskell.packages.ghc910 = { - inherit (packagePlatforms pkgs.pkgsCross.aarch64-android-prebuilt.haskell.packages.ghc910) + haskell.packages.ghc912 = { + inherit (packagePlatforms pkgs.pkgsCross.aarch64-android-prebuilt.haskell.packages.ghc912) ghc hello microlens