[From nobody Sun Mar 15 10:51:06 2026
Received: (at submit) by bugs.debian.org; 18 Feb 2026 21:11:45 +0000
X-Spam-Checker-Version: SpamAssassin 4.0.1-bugs.debian.org_2005_01_02
 (2024-03-25) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-117.1 required=4.0 tests=BAYES_00,
 BODY_INCLUDES_PACKAGE,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,
 DKIM_VALID_AU,DKIM_VALID_EF,FOURLA,FROMDEVELOPER,HAS_PACKAGE,
 MD5_SHA1_SUM,SPF_HELO_NONE,SPF_NONE,UNPARSEABLE_RELAY,
 USER_IN_DKIM_WELCOMELIST autolearn=ham autolearn_force=no
 version=4.0.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 114; hammy, 150; neutral, 341; spammy,
 0. spammytokens:
 hammytokens:0.000-+--Hx-spam-relays-external:sk:stravin,
 0.000-+--H*RT:sk:stravin, 0.000-+--Hx-spam-relays-external:311,
 0.000-+--H*RT:311, 0.000-+--H*RT:108
Return-path: &lt;sthibault@debian.org&gt;
Received: from stravinsky.debian.org ([2001:41b8:202:deb::311:108]:47682)
 by buxtehude.debian.org with esmtps
 (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
 (Exim 4.96) (envelope-from &lt;sthibault@debian.org&gt;)
 id 1vsopl-003q3V-1e for submit@bugs.debian.org;
 Wed, 18 Feb 2026 21:11:45 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; 
 s=smtpauto.stravinsky;
 h=X-Debian-User:Content-Type:MIME-Version:Message-ID:
 Subject:To:From:Date:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:
 Content-Description:In-Reply-To:References;
 bh=E6T7JU65yQCXvGcH5oMJsSFrMmO49U93KwiU/K71Hi0=; b=a+mBqd+PI4/W7XWOZ7PQaZk2vM
 UwAes/iLi7lNVt2xix1zeY2q1tlcHUSA5eGe0oH1m5wC2e3zvSmjMlzuFlDUpDuIK/Zk06t29JJGA
 upASmRymNeT+N9z+G2jF4MHY8VM7hY2kvGt/Cc8J0l4xfXUuLaYwRYA7exo1mJZ+tAXjy1jbT9JYS
 Nlufs+5Jp7N15Fln/uKNfiLJC+UMysM+AT6ea9sTjfqZuCplDLHa9hfaUtIRkngjSCRDukp67iwQ9
 WqYtjZWYNfzlFZ/doPTHoled0+YhawMZu72CJtTFinVX56tgA1q1/6F2EmygZB8A81XgF67Sz/BsQ
 8Tvsx9Tw==;
Received: from authenticated user by stravinsky.debian.org with esmtpsa
 (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
 (Exim 4.94.2) (envelope-from &lt;sthibault@debian.org&gt;)
 id 1vsopk-005NpZ-1K
 for submit@bugs.debian.org; Wed, 18 Feb 2026 21:11:43 +0000
Received: from samy by end with local (Exim 4.99.1)
 (envelope-from &lt;sthibault@debian.org&gt;) id 1vsoph-0000000CZZI-3Ao4
 for submit@bugs.debian.org; Wed, 18 Feb 2026 22:11:41 +0100
Date: Wed, 18 Feb 2026 22:11:41 +0100
From: Samuel Thibault &lt;sthibault@debian.org&gt;
To: Debian Bug Tracking System &lt;submit@bugs.debian.org&gt;
Subject: ghc: Hurd fixes
Message-ID: &lt;aZYrDeHpzqNXYKHi@end&gt;
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=&quot;xmBzAhjakjLVndSI&quot;
Content-Disposition: inline
X-Reportbug-Version: 13.2.0
Organization: I am not organized
X-Debian-User: sthibault
Delivered-To: submit@bugs.debian.org


--xmBzAhjakjLVndSI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Package: ghc
Version: 9.6.6-4
Severity: important
Tags: patch upstream
Forwarded: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/15319

Hello,

A few patches are needed to fix building ghc on hurd-any. The attached
three patches have already been applied upstream, could you apply them
to the Debian package?

Thanks,
Samuel

-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'proposed-updates'), (500, 'oldstable-debug'), (500, 'oldoldstable'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64

Kernel: Linux 6.19.0 (SMP w/22 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages ghc depends on:
ii  dpkg            1.23.5
ii  gcc             4:15.2.0-5
ii  libbsd-dev      0.12.2-2+b1
ii  libc6           2.42-11+b1
ii  libc6-dev       2.42-11+b1
ii  libffi-dev      3.5.2-3+b1
ii  libffi8         3.5.2-3+b1
ii  libgmp-dev      2:6.3.0+dfsg-5+b1
ii  libgmp10        2:6.3.0+dfsg-5+b1
ii  libncurses-dev  6.6+20251231-1
ii  libnuma-dev     2.0.19-1+b1
ii  libnuma1        2.0.19-1+b1
ii  libtinfo6       6.6+20251231-1

Versions of packages ghc recommends:
ii  libstdc++-14-dev  14.3.0-12

Versions of packages ghc suggests:
pn  ghc-doc   &lt;none&gt;
pn  ghc-prof  &lt;none&gt;
ii  llvm-18   1:18.1.8-20+b2
ii  perl      5.40.1-7

-- no debconf information

--xmBzAhjakjLVndSI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-hurd-linklm

commit bf4694e9d10b7d9898ed1e3cd7ae115fd33ac725
Author: Samuel Thibault &lt;samuel.thibault@ens-lyon.org&gt;
Date:   Sat Jan 10 15:53:10 2026 +0100

    Fix linking against libm by moving the -lm option
    
    For those systems that need -lm for getting math functions, this is
    currently added on the link line very early, before the object files being
    linked together. Newer toolchains enable --as-needed by default, which means
    -lm is ignored at that point because no object requires a math function
    yet. With such toolchains, we thus have to add -lm after the objects, so the
    linker actually includes libm in the link.

---
 compiler/GHC/Linker/Dynamic.hs |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

https://gitlab.haskell.org/ghc/ghc/-/merge_requests/15319

--- a/compiler/GHC/Linker/Dynamic.hs
+++ b/compiler/GHC/Linker/Dynamic.hs
@@ -223,7 +223,6 @@ linkDynLib logger tmpfs dflags0 unit_env
 
             runLink logger tmpfs linker_config (
                     map Option verbFlags
-                 ++ libmLinkOpts platform
                  ++ [ Option &quot;-o&quot;
                     , FileOption &quot;&quot; output_fn
                     ]
@@ -234,6 +233,7 @@ linkDynLib logger tmpfs dflags0 unit_env
                     -- Solaris 10 doesn't support the latter:
                  ++ [ Option (&quot;-Wl,-h,&quot; ++ takeFileName output_fn) ]
                  ++ extra_ld_inputs
+                 ++ libmLinkOpts platform
                  ++ map Option lib_path_opts
                  ++ map Option pkg_lib_path_opts
                  ++ map Option pkg_link_opts

--xmBzAhjakjLVndSI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-gnu-hurd

https://gitlab.haskell.org/ghc/ghc/-/merge_requests/15318

+

&gt;From 3939a8bf93e27d8151aa1d92bf3ce10bbbc96a72 Mon Sep 17 00:00:00 2001
From: Samuel Thibault &lt;samuel.thibault@ens-lyon.org&gt;
Date: Sun, 15 Sep 2024 15:57:52 +0200
Subject: [PATCH] GNU/Hurd: Add getExecutablePath support

GNU/Hurd exposes it as /proc/self/exe just like on Linux.
---
 .../src/GHC/Internal/System/Environment/ExecutablePath.hsc  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: ghc-9.10.3/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
===================================================================
--- ghc-9.10.3.orig/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
+++ ghc-9.10.3/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
@@ -51,7 +51,7 @@ import GHC.Internal.Foreign.Ptr
 import GHC.Internal.Foreign.Storable
 import GHC.Internal.System.IO.Error (isDoesNotExistError)
 import GHC.Internal.System.Posix.Internals
-#elif defined(linux_HOST_OS)
+#elif defined(linux_HOST_OS) || defined(gnu_HOST_OS)
 import GHC.Internal.Data.Functor
 import GHC.Internal.Data.List (isSuffixOf)
 import GHC.Internal.Foreign.C.Types
@@ -200,9 +200,9 @@ executablePath = Just (fmap Just getExec
       | otherwise             = throw e
 
 --------------------------------------------------------------------------------
--- Linux / Solaris
+-- Linux / Solaris / Hurd
 
-#elif defined(linux_HOST_OS) || defined(solaris2_HOST_OS)
+#elif defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(gnu_HOST_OS)
 
 foreign import ccall unsafe &quot;readlink&quot;
     c_readlink :: CString -&gt; CString -&gt; CSize -&gt; IO CInt
@@ -219,7 +219,7 @@ readSymbolicLink file =
                    c_readlink s buf 4096
             peekFilePathLen (buf,fromIntegral len)
 
-#  if defined(linux_HOST_OS)
+#  if defined(linux_HOST_OS) || defined(gnu_HOST_OS)
 getExecutablePath = readSymbolicLink $ &quot;/proc/self/exe&quot;
 
 executablePath = Just (check &lt;$&gt; getExecutablePath) where

--xmBzAhjakjLVndSI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-hurd-gnu

commit 95773d289c62373772f676df91c1278b7d382e30
Author: Samuel Thibault &lt;samuel.thibault@ens-lyon.org&gt;
Date:   Sat Jan 10 15:59:18 2026 +0100

    Fix the OS string encoding for GNU/Hurd
    
    Following https://github.com/haskell/cabal/pull/9434/files , and as seen
    in the various gnu_HOST_OS usages in the source code, it is expected that
    GNU/Hurd is advertised as &quot;gnu&quot;, like the autotools do.

https://gitlab.haskell.org/ghc/ghc/-/merge_requests/15320
https://github.com/haskell/cabal/pull/11401

--- a/libraries/Cabal/Cabal/src/Distribution/Simple/PreProcess.hs
+++ b/libraries/Cabal/Cabal/src/Distribution/Simple/PreProcess.hs
@@ -780,7 +780,7 @@ platformDefines lbi =
       Android -&gt; [&quot;android&quot;]
       Ghcjs -&gt; [&quot;ghcjs&quot;]
       Wasi -&gt; [&quot;wasi&quot;]
-      Hurd -&gt; [&quot;hurd&quot;]
+      Hurd -&gt; [&quot;gnu&quot;]
       Haiku -&gt; [&quot;haiku&quot;]
       OtherOS _ -&gt; []
     archStr = case hostArch of
--- a/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
+++ b/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
@@ -157,7 +157,7 @@ stringEncodeOS = \case
   OSHaiku     -&gt; &quot;haiku&quot;
   OSQNXNTO    -&gt; &quot;nto-qnx&quot;
   OSAIX       -&gt; &quot;aix&quot;
-  OSHurd      -&gt; &quot;hurd&quot;
+  OSHurd      -&gt; &quot;gnu&quot;
   OSWasi      -&gt; &quot;wasi&quot;
   OSGhcjs     -&gt; &quot;ghcjs&quot;
 

--xmBzAhjakjLVndSI--
]