Source: haskell-clash-ghc
Version: 1.8.1-3
Severity: normal
Tags: patch
User: debian-loonga...@lists.debian.org
Usertags: loong64

Dear maintainers,

Compiling the haskell-clash-ghc failed for loong64 in the Debian Package Auto-Building environment.
The error log is as follows,
```
......
[2 of 2] Linking dist-ghc/build/clash/clash
/usr/bin/ld: /tmp/ghc3441753_0/ghc_2.o: relocation R_LARCH_B26 overflow 0x9007e5c
/tmp/ghc3441753_0/ghc_2.o: in function `main':
ghc_1.c:(.text+0xd8): relocation truncated to fit: R_LARCH_B26 against symbol `hs_main' defined in .text section in /usr/lib/ghc/lib/../lib/loongarch64-linux-ghc-9.6.6/rts-1.0.2/libHSrts-1.0.2_thr.a(RtsMain.thr_o)
/usr/bin/ld: final link failed: bad value
......
```
The full build log can be found at https://buildd.debian.org/status/fetch.php?pkg=haskell-clash-ghc&arch=loong64&ver=1.8.1-3&stamp=1740487395&raw=0.

Please consider the patch I attached.
Based on attached patch, I have built  successfully on locally.
```
......
dh_builddeb -phaskell-clash-ghc-utils
dpkg-deb: building package 'haskell-clash-ghc-utils' in '../haskell-clash-ghc-utils_1.8.1-3_loong64.deb'.  dpkg-genbuildinfo --build=binary -O../haskell-clash-ghc_1.8.1-3_loong64.buildinfo  dpkg-genchanges --build=binary -O../haskell-clash-ghc_1.8.1-3_loong64.changes
```

Your opinions are welcome.

Best regards,
Dandan Zhang

diff --git a/debian/rules b/debian/rules
index 3447ef0..6e3d567 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,6 +5,10 @@ DEB_SETUP_BIN_NAME = debian/hlibrary.setup
 DEB_CABAL_PACKAGE = clash-ghc
 DEB_DEFAULT_COMPILER = ghc
 
+ifneq (,$(filter $(DEB_BUILD_ARCH),loong64))
+DEB_SETUP_GHC_CONFIGURE_ARGS += --ghc-options="-optc-mcmodel=medium"
+endif
+
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/hlibrary.mk
 

Reply via email to