[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20/31: gnu: ghc-9.2: Support static linking with glibc < 2.34.
From: |
guix-commits |
Subject: |
20/31: gnu: ghc-9.2: Support static linking with glibc < 2.34. |
Date: |
Sun, 26 Feb 2023 04:44:38 -0500 (EST) |
lbraun pushed a commit to branch master
in repository guix.
commit 7df12c8ca631cc46f59da9ceeb883a28044dbb9e
Author: Lars-Dominik Braun <lars@6xq.net>
AuthorDate: Sun Jan 29 18:45:45 2023 +0100
gnu: ghc-9.2: Support static linking with glibc < 2.34.
* gnu/packages/patches/ghc-9.2-glibc-2.33-link-order.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/haskell.scm (ghc-9.2)[origin]: Use it.
---
gnu/local.mk | 1 +
gnu/packages/haskell.scm | 3 +-
.../patches/ghc-9.2-glibc-2.33-link-order.patch | 35 ++++++++++++++++++++++
3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index 89dee3cf6a..4ccf015316 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1198,6 +1198,7 @@ dist_patch_DATA =
\
%D%/packages/patches/genimage-mke2fs-test.patch \
%D%/packages/patches/geoclue-config.patch \
%D%/packages/patches/ghc-8.0-fall-back-to-madv_dontneed.patch \
+ %D%/packages/patches/ghc-9.2-glibc-2.33-link-order.patch \
%D%/packages/patches/ghc-testsuite-dlopen-pie.patch \
%D%/packages/patches/ghc-bloomfilter-ghc9.2.patch \
%D%/packages/patches/ghc-bytestring-handle-ghc9.patch \
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 6e00a756a8..3406161c7c 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -1286,7 +1286,8 @@ interactive environment for the functional language
Haskell.")
"/ghc-" version "-src.tar.xz"))
(sha256
(base32
- "07028i0hm74svvq9b3jpkczaj6lsdgn3hgr4wa7diqiq3dypj1h6"))))
+ "07028i0hm74svvq9b3jpkczaj6lsdgn3hgr4wa7diqiq3dypj1h6"))
+ (patches (search-patches
"ghc-9.2-glibc-2.33-link-order.patch"))))
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases '%standard-phases)
diff --git a/gnu/packages/patches/ghc-9.2-glibc-2.33-link-order.patch
b/gnu/packages/patches/ghc-9.2-glibc-2.33-link-order.patch
new file mode 100644
index 0000000000..5d4afa28c1
--- /dev/null
+++ b/gnu/packages/patches/ghc-9.2-glibc-2.33-link-order.patch
@@ -0,0 +1,35 @@
+Slightly modified version of
+https://gitlab.haskell.org/ghc/ghc/-/issues/19029#note_447989, required
+for older, buggy glibc versions < 2.34.
+
+diff -Naur ghc-9.2.5/compiler/GHC/Linker/Unit.hs
ghc-9.2.5.patched/compiler/GHC/Linker/Unit.hs
+--- ghc-9.2.5/compiler/GHC/Linker/Unit.hs 2022-11-06 20:40:29.000000000
+0100
++++ ghc-9.2.5.patched/compiler/GHC/Linker/Unit.hs 2023-01-15
14:52:57.511275338 +0100
+@@ -31,11 +31,26 @@
+ ps <- mayThrowUnitErr $ preloadUnitsInfo' unit_env pkgs
+ return (collectLinkOpts dflags ps)
+
++fixOrderLinkOpts :: [String] -> [String]
++fixOrderLinkOpts opts
++ | have_bad_glibc_version -- glibc version strictly less than 2.34
++ , let (before, rest) = break (== libc) opts
++ , not (pthread `elem` before)
++ , pthread `elem` rest -- optional if we know pthread is definitely present
++ = before ++ pthread_and_deps ++ rest
++ | otherwise
++ = opts
++ where
++ pthread = "-lpthread"
++ libc = "-lc"
++ pthread_and_deps = [ "-lrt", pthread ] -- should depend on the environment
++ have_bad_glibc_version = True
++
+ collectLinkOpts :: DynFlags -> [UnitInfo] -> ([String], [String], [String])
+ collectLinkOpts dflags ps =
+ (
+ concatMap (map ("-l" ++) . unitHsLibs (ghcNameVersion dflags) (ways
dflags)) ps,
+- concatMap (map ("-l" ++) . map ST.unpack . unitExtDepLibsSys) ps,
++ fixOrderLinkOpts $ concatMap (map ("-l" ++) . map ST.unpack .
unitExtDepLibsSys) ps,
+ concatMap (map ST.unpack . unitLinkerOptions) ps
+ )
+
- 13/31: Upgrade Haskell packages., (continued)
- 13/31: Upgrade Haskell packages., guix-commits, 2023/02/26
- 18/31: gnu: elm: Support GHC 9.2., guix-commits, 2023/02/26
- 08/31: import: hackage: Use upstream-name property., guix-commits, 2023/02/26
- 11/31: build: haskell-build-system: Process all transitive dependencies., guix-commits, 2023/02/26
- 12/31: build: haskell-build-system: Remove unused linker flags., guix-commits, 2023/02/26
- 14/31: gnu: ghc-9.2: Increase make verbosity., guix-commits, 2023/02/26
- 15/31: gnu: Remove unused Haskell packages., guix-commits, 2023/02/26
- 16/31: gnu: ghc-parsec: Update to 3.1.15.0., guix-commits, 2023/02/26
- 17/31: gnu: idris: Fix overly zealous regular expression., guix-commits, 2023/02/26
- 19/31: build-system: haskell: Drop default "static" output., guix-commits, 2023/02/26
- 20/31: gnu: ghc-9.2: Support static linking with glibc < 2.34.,
guix-commits <=
- 21/31: gnu: ghc-lua: Disable symbol export., guix-commits, 2023/02/26
- 22/31: build: haskell-build-system: Build static executables by default., guix-commits, 2023/02/26
- 24/31: gnu: hledger: Drop Haskell libraries and documentation., guix-commits, 2023/02/26
- 26/31: gnu: git-annex: Drop Haskell documentation., guix-commits, 2023/02/26
- 27/31: gnu: shellcheck: Drop Haskell libraries., guix-commits, 2023/02/26
- 28/31: gnu: pandoc: Drop Haskell libraries and documentation., guix-commits, 2023/02/26
- 30/31: gnu: xmobar: Drop Haskell libraries and documentation., guix-commits, 2023/02/26
- 23/31: gnu: ngless: Drop Haskell libraries and documentation., guix-commits, 2023/02/26
- 25/31: gnu: darcs: Drop Haskell libraries and documentation., guix-commits, 2023/02/26
- 29/31: gnu: purescript: Drop Haskell libraries and documentation., guix-commits, 2023/02/26