Bug#1056305: ghc: FTBFS on hurd-i386

Samuel Thibault sthibault at debian.org
Mon Nov 20 10:12:00 GMT 2023


Package: ghc
Version: 9.4.7-1
Severity: important
Tags: patch

Hello,

Since version 9.4.7 and the switch to using Hadrian, ghc fails to build
on hurd-i386. This is because of a confusion between "gnu" and "hurd".

The attached patches fix the confusion. Some of them have just been
commited upstream, others are already fixed in newer upstream versions.

I will submit the hadrian patches to the haskell-hadrian package too.
(they are needed in ghc to be able to build with the pkg.ghc.nohadrian
profile until they get applied to the haskell-hadrian package)

Samuel

-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'oldstable-proposed-updates-debug'), (500, 'oldstable-proposed-updates'), (500, 'oldoldstable-proposed-updates'), (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.5.0-1-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
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.22.1
ii  gcc             4:13.2.0-1
ii  libbsd-dev      0.11.7-4
ii  libc6           2.37-12
ii  libc6-dev       2.37-12
ii  libffi-dev      3.4.4-1
ii  libffi8         3.4.4-1
ii  libgmp-dev      2:6.3.0+dfsg-2
ii  libgmp10        2:6.3.0+dfsg-2
ii  libncurses-dev  6.4+20231016-1
ii  libtinfo6       6.4+20231016-1

ghc recommends no packages.

Versions of packages ghc suggests:
pn  ghc-doc      <none>
pn  ghc-prof     <none>
pn  haskell-doc  <none>
ii  llvm-13      1:13.0.1-13
ii  perl         5.36.0-9

-- no debconf information

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
-------------- next part --------------
https://github.com/haskell/cabal/pull/9434

Index: ghc-9.4.7/libraries/Cabal/Cabal/src/Distribution/Simple/GHC/Internal.hs
===================================================================
--- ghc-9.4.7.orig/libraries/Cabal/Cabal/src/Distribution/Simple/GHC/Internal.hs
+++ ghc-9.4.7/libraries/Cabal/Cabal/src/Distribution/Simple/GHC/Internal.hs
@@ -609,6 +609,7 @@ ghcOsString :: OS -> String
 ghcOsString Windows = "mingw32"
 ghcOsString OSX     = "darwin"
 ghcOsString Solaris = "solaris2"
+ghcOsString Hurd    = "gnu"
 ghcOsString other   = prettyShow other
 
 -- | GHC's rendering of its platform and compiler version string as used in
-------------- next part --------------
https://github.com/haskell/cabal/pull/9441

Index: ghc-9.4.7/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs
===================================================================
--- ghc-9.4.7.orig/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs
+++ ghc-9.4.7/libraries/Cabal/Cabal/src/Distribution/Simple/GHC.hs
@@ -1792,7 +1792,7 @@ getRPaths lbi clbi | supportRPaths hostO
     supportRPaths Android     = False
     supportRPaths Ghcjs       = False
     supportRPaths Wasi        = False
-    supportRPaths Hurd        = False
+    supportRPaths Hurd        = True
     supportRPaths (OtherOS _) = False
     -- Do _not_ add a default case so that we get a warning here when a new OS
     -- is added.
Index: ghc-9.4.7/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs
===================================================================
--- ghc-9.4.7.orig/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs
+++ ghc-9.4.7/libraries/Cabal/Cabal/src/Distribution/Simple/GHCJS.hs
@@ -1537,7 +1537,7 @@ getRPaths lbi clbi | supportRPaths hostO
     supportRPaths Android     = False
     supportRPaths Ghcjs       = False
     supportRPaths Wasi        = False
-    supportRPaths Hurd        = False
+    supportRPaths Hurd        = True
     supportRPaths (OtherOS _) = False
     -- Do _not_ add a default case so that we get a warning here when a new OS
     -- is added.
-------------- next part --------------
Also applies in 9.6.x
Can be dropped with 9.8.1

Index: ghc-9.4.7/libraries/ghc-boot/GHC/BaseDir.hs
===================================================================
--- ghc-9.4.7.orig/libraries/ghc-boot/GHC/BaseDir.hs
+++ ghc-9.4.7/libraries/ghc-boot/GHC/BaseDir.hs
@@ -23,7 +23,7 @@ import System.FilePath
 #if defined(mingw32_HOST_OS)
 import System.Environment (getExecutablePath)
 -- POSIX
-#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(netbsd_HOST_OS)
+#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(netbsd_HOST_OS) || defined(hurd_HOST_OS)
 import System.Environment (getExecutablePath)
 #endif
 
@@ -52,7 +52,7 @@ getBaseDir = Just . (\p -> p </> "lib")
     -- that is running this function.
     rootDir :: FilePath -> FilePath
     rootDir = takeDirectory . takeDirectory . normalise
-#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(netbsd_HOST_OS)
+#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(netbsd_HOST_OS) || defined(hurd_HOST_OS)
 -- on unix, this is a bit more confusing.
 -- The layout right now is something like
 --
-------------- next part --------------
Can be dropped with 9.6.1

Index: ghc-9.4.7/mk/config.mk.in
===================================================================
--- ghc-9.4.7.orig/mk/config.mk.in
+++ ghc-9.4.7/mk/config.mk.in
@@ -105,7 +105,7 @@ else
 WITH_TERMINFO=YES
 endif
 
-ifeq "$(findstring $(TargetOS_CPP),linux freebsd dragonfly openbsd netbsd solaris2 kfreebsdgnu haiku linux-android)" ""
+ifeq "$(findstring $(TargetOS_CPP),linux freebsd dragonfly openbsd netbsd solaris2 kfreebsdgnu gnu haiku linux-android)" ""
 TargetElf = NO
 else
 TargetElf = YES
-------------- next part --------------
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11624
To be applied to haskell-hadrian too

Index: ghc-9.4.7/hadrian/src/Hadrian/Haskell/Cabal.hs
===================================================================
--- ghc-9.4.7.orig/hadrian/src/Hadrian/Haskell/Cabal.hs
+++ ghc-9.4.7/hadrian/src/Hadrian/Haskell/Cabal.hs
@@ -71,4 +71,5 @@ cabalOsString :: String -> String
 cabalOsString "mingw32"  = "windows"
 cabalOsString "darwin"   = "osx"
 cabalOsString "solaris2" = "solaris"
+cabalOsString "gnu"      = "hurd"
 cabalOsString other      = other
-------------- next part --------------
Also applies in 9.6.x
Can be dropped with 9.8.1
To be applied to haskell-hadrian too

Index: ghc-9.4.7/hadrian/src/Oracles/Setting.hs
===================================================================
--- ghc-9.4.7.orig/hadrian/src/Oracles/Setting.hs
+++ ghc-9.4.7/hadrian/src/Oracles/Setting.hs
@@ -273,7 +273,7 @@ anyHostOs = matchSetting HostOs
 isElfTarget :: Action Bool
 isElfTarget = anyTargetOs
     [ "linux", "freebsd", "dragonfly", "openbsd", "netbsd", "solaris2", "kfreebsdgnu"
-    , "haiku", "linux-android"
+    , "gnu", "haiku", "linux-android"
     ]
 
 -- | Check whether the host OS supports the @-rpath@ linker option when
@@ -282,7 +282,7 @@ isElfTarget = anyTargetOs
 -- TODO: Windows supports lazy binding (but GHC doesn't currently support
 --       dynamic way on Windows anyways).
 hostSupportsRPaths :: Action Bool
-hostSupportsRPaths = anyHostOs ["linux", "darwin", "freebsd"]
+hostSupportsRPaths = anyHostOs ["linux", "darwin", "freebsd", "gnu"]
 
 -- | Check whether the target supports GHCi.
 ghcWithInterpreter :: Action Bool


More information about the Pkg-haskell-maintainers mailing list