Source: haskell-pandoc
Version: 3.1.3-2
Severity: important
Tags: ftbfs patch
User: debian-loonga...@lists.debian.org
Usertags: loong64

Dear maintainers,

Compiling the haskell-pandoc failed for loong64 in the Debian Package Auto-Building environment.
The error log is as follows,
```
[58 of 58] Linking dist-ghc/build/test-pandoc/test-pandoc
/usr/bin/ld.bfd:
/usr/lib/ghc/lib/../lib/loongarch64-linux-ghc-9.4.7/rts-1.0.2/libHSrts-1.0.2_thr.a(NonMovingMark.thr_o):
relocation R_LARCH_B26 overflow 0xfffffffff5fec6a4
Dump relocate record:
stack top        relocation name        symbol
at
/usr/lib/gcc/loongarch64-linux-gnu/13/../../../loongarch64-linux-gnu/crt1.o(.text+0x0):
...
0x0000000000000000 R_LARCH_NONE    `<nameless>' + 3(0x3)
......
```

The Full log can be found at
https://buildd.debian.org/status/logs.php?pkg=haskell-pandoc&ver=3.1.3-1&arch=loong64.

The reason for the above error is that "relocation R_LARCH_B26 overflow
......" occurs during static linking in the test-pandoc stage.
Currently we have a verified method, don't need to skip test cases to solve "relocation R_LARCH_B26
overflow ......" during static linking.
The verified method is as follows,
We need to add extra --ghc-options in d/rules on loong64 to reduce binary size.
```
diff --git a/home/pandoc-3/haskell-pandoc/again/haskell-pandoc-3.1.3/debian/rules b/debian/rules
index cacf45d..7542c81 100755
--- a/home/pandoc-3/haskell-pandoc/again/haskell-pandoc-3.1.3/debian/rules
+++ b/debian/rules
@@ -2,9 +2,8 @@

 DEB_ENABLE_TESTS = yes

-# Disable tests on loong64, see https://bugs.debian.org/1069165
-ifneq (,$(filter $(DEB_HOST_ARCH_CPU), loong64))
-DEB_ENABLE_TESTS = no
+ifneq (,$(filter $(DEB_BUILD_ARCH),loong64))
+DEB_SETUP_GHC_CONFIGURE_ARGS += --ghc-options="-optc-mcmodel=medium"
 endif
```

Meanwhile, you can also consider the patch I attached.
Your opinions are welcome.

Thanks,
Dandan Zhang

diff --git a/again/haskell-pandoc-3.1.3/debian/rules 
b/haskell-pandoc-3.1.3/debian/rules
index cacf45d..7542c81 100755
--- a/again/haskell-pandoc-3.1.3/debian/rules
+++ b/haskell-pandoc-3.1.3/debian/rules
@@ -2,9 +2,8 @@
 
 DEB_ENABLE_TESTS = yes
 
-# Disable tests on loong64, see https://bugs.debian.org/1069165
-ifneq (,$(filter $(DEB_HOST_ARCH_CPU), loong64))
-DEB_ENABLE_TESTS = no
+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

Reply via email to