Source: gasnet
Version: 2025.8.0-5
Severity: normal
Tags: FTBFS patch
User: [email protected]
Usertags: loong64

Dear maintainers,

Compiling gasnet for loong64 has been failing in the Debian Package Auto-Building environment.
The error log is as follows,
```
......
In file included from /build/reproducible-path/gasnet-2025.8.0/gasnet_tools.h:91,                  from /build/reproducible-path/gasnet-2025.8.0/gasnet_tools.c:26: /build/reproducible-path/gasnet-2025.8.0/gasnet_membar.h:232:3: error: #error unknown CPU - dont know how to do a local memory barrier for your CPU/OS   232 |  #error unknown CPU - dont know how to do a local memory barrier for your CPU/OS
      |   ^~~~~
In file included from /build/reproducible-path/gasnet-2025.8.0/gasnet_tools.h:93: /build/reproducible-path/gasnet-2025.8.0/gasnet_atomicops.h: In function ‘gasneti_genatomic32_set’: /build/reproducible-path/gasnet-2025.8.0/gasnet_atomicops.h:99:81: error: implicit declaration of function ‘gasneti_local_wmb’; did you mean ‘gasneti_local_mb’? [-Wimplicit-function-declaration]    99 |                                                 if (f & GASNETI_ATOMIC_WMB_PRE) gasneti_local_wmb();
      |
^~~~~~~~~~~~~~~~~
......
```
After analyzing, we need to add loongarch64 support for gasnet.
Please consider the patch attached.
Based attached patch, I have built  gasnet successfully on loong64.
```
dpkg-deb: building package 'libgasnet-dev' in '../libgasnet-dev_2025.8.0-5.1_loong64.deb'.
dpkg-deb: building package 'gasnet' in '../gasnet_2025.8.0-5.1_loong64.deb'.
dpkg-deb: building package 'gasnet-dbgsym' in '../gasnet-dbgsym_2025.8.0-5.1_loong64.deb'.
 dpkg-genbuildinfo -O../gasnet_2025.8.0-5.1_loong64.buildinfo
 dpkg-genchanges -O../gasnet_2025.8.0-5.1_loong64.changes
dpkg-genchanges: info: not including original source code in upload
 dpkg-source --after-build .
dpkg-buildpackage: info: binary and diff upload (original source NOT included)
 signfile gasnet_2025.8.0-5.1.dsc
```

I was unable to locate where to submit a pull request upstream.
If someone knows where to submit the pull request, they can help contribute the patch upstream.

Best regards,
Dandan Zhang

Description: <short summary of the patch>
 .
 gasnet (2025.8.0-5.1) unstable; urgency=medium
 .
   * Add basic loongarch64 support.
Author: Dandan Zhang <[email protected]>

---
Last-Update: 2026-04-01

--- gasnet-2025.8.0.orig/gasnet_atomic_fwd.h
+++ gasnet-2025.8.0/gasnet_atomic_fwd.h
@@ -61,6 +61,7 @@
     (PLATFORM_COMPILER_XLC && GASNETI_HAVE_SYNC_ATOMICS_32) || \
     (PLATFORM_ARCH_SPARC && PLATFORM_COMPILER_CLANG /* TODO: not using GCC ASM due to Bug 3805 */) || \
     PLATFORM_ARCH_AARCH64 || \
+    PLATFORM_ARCH_LOONGARCH64 || \
     PLATFORM_ARCH_S390 || \
     PLATFORM_ARCH_TILE || \
     PLATFORM_ARCH_RISCV
--- gasnet-2025.8.0.orig/gasnet_membar.h
+++ gasnet-2025.8.0/gasnet_membar.h
@@ -208,6 +208,16 @@
  #endif
  #define GASNETI_RMB_IS_MB
  #define GASNETI_WMB_IS_MB
+#elif PLATFORM_ARCH_LOONGARCH64
+ #if PLATFORM_COMPILER_GNU
+   #define gasneti_local_mb() __sync_synchronize()
+   #define gasneti_local_wmb() gasneti_local_mb()
+   #define gasneti_local_rmb() gasneti_local_mb()
+ #else
+   #define GASNETI_USING_SLOW_MEMBARS 1
+ #endif
+ #define GASNETI_RMB_IS_MB
+ #define GASNETI_WMB_IS_MB
 #elif PLATFORM_ARCH_S390
  #if PLATFORM_COMPILER_GNU
    #define gasneti_local_mb() __sync_synchronize()
--- gasnet-2025.8.0.orig/other/gasnet_portable_platform.h
+++ gasnet-2025.8.0/other/gasnet_portable_platform.h
@@ -1030,6 +1030,15 @@
     #define _PLATFORM_ARCH_32 1
   #endif
 
+#elif defined(__loongarch__)
+  #define PLATFORM_ARCH_LOONGARCH64 1
+  #define PLATFORM_ARCH_FAMILYNAME LOONGARCH64
+  #define _PLATFORM_ARCH_LITTLE_ENDIAN 1
+  #if defined(__loongarch_lp64)
+    #define _PLATFORM_ARCH_64 1
+  #else
+    #define _PLATFORM_ARCH_32 1
+  #endif
 #elif defined(__s390__)
   #define PLATFORM_ARCH_S390 1
   #define PLATFORM_ARCH_FAMILYNAME S390
-- 
debian-science-maintainers mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-science-maintainers

Reply via email to