Package: ghc
Version: 9.6.6-3
Tags: ftbfs
Usertags: hppa

The ghc source package provides this header file for other programs:
rts-1.0.2/include/stg/SMP.h

So, when building the haskell-ghc-lib-parser package the compiler generates 
this error:
error: In file included from 
/usr/lib/ghc/lib/../lib/hppa-linux-ghc-9.6.6/rts-1.0.2/include/Stg.h:415,
                 from 
/usr/lib/ghc/lib/../lib/hppa-linux-ghc-9.6.6/rts-1.0.2/include/Rts.h:38,
                 from FFIClosures_ProfilingDisabled.hsc:9:
/usr/lib/ghc/lib/../lib/hppa-linux-ghc-9.6.6/rts-1.0.2/include/stg/SMP.h: In 
function ‘write_barrier’:
/usr/lib/ghc/lib/../lib/hppa-linux-ghc-9.6.6/rts-1.0.2/include/stg/SMP.h:496:2: 
error: #error memory barriers unimplemented on this architecture
  496 | #error memory barriers unimplemented on this architecture
      |  ^~~~~
/usr/lib/ghc/lib/../lib/hppa-linux-ghc-9.6.6/rts-1.0.2/include/stg/SMP.h: In 
function ‘store_load_barrier’:
/usr/lib/ghc/lib/../lib/hppa-linux-ghc-9.6.6/rts-1.0.2/include/stg/SMP.h:522:2: 
error: #error memory barriers unimplemented on this architecture
  522 | #error memory barriers unimplemented on this architecture
      |  ^~~~~
/usr/lib/ghc/lib/../lib/hppa-linux-ghc-9.6.6/rts-1.0.2/include/stg/SMP.h: In 
function ‘load_load_barrier’:
/usr/lib/ghc/lib/../lib/hppa-linux-ghc-9.6.6/rts-1.0.2/include/stg/SMP.h:548:2: 
error: #error memory barriers unimplemented on this architecture
  548 | #error memory barriers unimplemented on this architecture

Full log is here:
https://buildd.debian.org/status/fetch.php?pkg=haskell-ghc-lib-parser&arch=hppa&ver=9.6.6.20240701-1&stamp=1726567569&raw=0

The attached patch seems to work.
Alternatively,
__asm__ __volatile__ ("sync" : : : "memory");
should work instead of __sync_synchronize() as well.

Can you please verify, apply it and bring this or a similiar patch upstream?

Thanks!
Helge
diff -up ./SMP.h.org ./SMP.h
--- ./SMP.h.org	2024-12-19 12:36:45.182588553 +0000
+++ ./SMP.h	2024-12-19 12:54:30.393622294 +0000
@@ -492,6 +492,8 @@ write_barrier(void) {
     __asm__ __volatile__ ("fence w,w" : : : "memory");
 #elif defined(loongarch64_HOST_ARCH)
     __asm__ __volatile__ ("dbar 0" : : : "memory");
+#elif defined(hppa_HOST_ARCH)
+    __sync_synchronize();
 #else
 #error memory barriers unimplemented on this architecture
 #endif
@@ -518,6 +520,8 @@ store_load_barrier(void) {
     __asm__ __volatile__ ("fence w,r" : : : "memory");
 #elif defined(loongarch64_HOST_ARCH)
     __asm__ __volatile__ ("dbar 0" : : : "memory");
+#elif defined(hppa_HOST_ARCH)
+    __sync_synchronize();
 #else
 #error memory barriers unimplemented on this architecture
 #endif
@@ -544,6 +548,8 @@ load_load_barrier(void) {
     __asm__ __volatile__ ("fence r,r" : : : "memory");
 #elif defined(loongarch64_HOST_ARCH)
     __asm__ __volatile__ ("dbar 0" : : : "memory");
+#elif defined(hppa_HOST_ARCH)
+    __sync_synchronize();
 #else
 #error memory barriers unimplemented on this architecture
 #endif

Reply via email to