Source: haskell-pandoc-lua-engine
Version: 0.2.0.1-1
Severity: important
Tags: ftbfs patch
User: debian-loonga...@lists.debian.org
Usertags: loong64

Dear maintainers,

The haskell-pandoc-lua-engine is blocked from building by haskell-pandoc in the Debian Package Auto-Building environment.
Compiling the haskell-pandoc-lua-engine failed for loong64 in my local ENV.
The error message is consistent with haskel-pandoc, and both are related to "relocation R_LARCH_B26 overflow ......" during static linking in the test-pandoc stage. The build error log of haskell-pandoc-lua-engine from my local ENV is as follows,
```
[6 of 6] Linking dist-ghc/build/test-pandoc-lua-engine/test-pandoc-lua-engine /usr/bin/ld.bfd: /usr/lib/ghc/lib/../lib/loongarch64-linux-ghc-9.4.7/rts-1.0.2/libHSrts-1.0.2.a(NonMovingMark.o): relocation R_LARCH_B26 overflow 0xfffffffff61da41c
Dump relocate record:
stack top        relocation name        symbol
at /usr/lib/ghc/lib/../lib/loongarch64-linux-ghc-9.4.7/rts-1.0.2/libHSrts-1.0.2.a(NonMovingMark.o)(.text+0xae4):
...
0x0000000000000000 R_LARCH_B16    `.L172'
......
```

There are two suggestions to solve "relocation R_LARCH_B26 overflow ......" during static linking.
1.Add build rules to reduce binary size.
2.Disable tests in d/rules on loong64.
3.Add extra --ghc-options in d/rules on loong64 to increase jump-instructions' range.

It is recommended to use --ghc-options="-optc-mcmodel=medium" in d/rules for loong64.
Please consider the patch I attached.
With the attached patch, the haskell-pandoc-lua-engine was built successfully in my local ENV.


Your opinions are welcome.

Thanks,
Dandan Zhang

diff -Nru haskell-pandoc-lua-engine-0.2.0.1/debian/rules 
haskell-pandoc-lua-engine-0.2.0.1/debian/rules
--- haskell-pandoc-lua-engine-0.2.0.1/debian/rules      2024-01-04 
00:32:40.000000000 +0000
+++ haskell-pandoc-lua-engine-0.2.0.1/debian/rules      2024-01-04 
00:32:40.000000000 +0000
@@ -4,3 +4,8 @@
 
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/hlibrary.mk
+
+ifneq (,$(filter $(DEB_BUILD_ARCH),loong64))
+DEB_SETUP_GHC_CONFIGURE_ARGS += --ghc-options="-optc-mcmodel=medium"
+endif
+

Reply via email to