[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1069179: pandoc: use "--enable-executable-dynamic" in d/rules to reduce binary size on loong64



Source: pandoc
Version: 3.1.3+ds-2
Severity: important
Tags: ftbfs patch
User: debian-loongarch@lists.debian.org
Usertags: loong64
X-Debbugs-Cc: wanghonghu@loongson.cn, zhangjialing@loongson.cn, fanpeng@loongson.cn

Dear maintainers,

The pandoc is blocked from building by haskell-pandoc and haskell-pandoc-lua-engine in the Debian Package Auto-Building environment. I have built haskell-pandoc and haskell-pandoc-lua-engine locally, and then compiling pandoc for loong64 in my local ENV failed.

The error message is related to "relocation R_LARCH_B26 overflow ......" during static linking when built pandoc binary.
The build error log of pandoc from my local ENV is as follows,
```
[4 of 4] Linking dist-ghc/build/pandoc/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 0xfffffffff62f45e4
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)
......
```

It is recommended to use "--enable-executable-dynamic" in d/rules to reduce binary size on loong64. The parameter "--enable-executable-dynamic" means "enable dynamic linking of executable files".
Please consider the patch I attached.
With the attached patch, the pandoc was built successfully in my local ENV.
```
......
if grep -q '^Component:[[:space:]]*main' /CurrentlyBuilding 2>/dev/null; then dh_scour -ppandoc ; fi
dh_md5sums -ppandoc
dh_builddeb -ppandoc
dpkg-deb: building package 'pandoc' in '../pandoc_3.1.3+ds-2_loong64.deb'.
 dpkg-genbuildinfo -O../pandoc_3.1.3+ds-2_loong64.buildinfo
 dpkg-genchanges -O../pandoc_3.1.3+ds-2_loong64.changes
```

Your opinions are welcome.
In addition, before the pandoc was built for loong64 in the Debian Package Auto-Building environment, could I dupload the pandoc compiled locally using "-enable-executable-dynamic" to the debian-ports/pool-loong64 repository?
Looking forward to your reply.

Thanks,
Dandan Zhang

diff -Nru pandoc-3.1.3+ds/debian/rules pandoc-3.1.3+ds/debian/rules
--- pandoc-3.1.3+ds/debian/rules	2023-12-21 20:13:11.000000000 +0000
+++ pandoc-3.1.3+ds/debian/rules	2024-01-07 00:52:39.000000000 +0000
@@ -58,6 +58,10 @@
 DEB_SETUP_GHC_CONFIGURE_ARGS += --ghc-options="-O0"
 endif
 
+ifneq (,$(filter $(DEB_HOST_ARCH_CPU), loong64))
+DEB_SETUP_GHC_CONFIGURE_ARGS += --enable-executable-dynamic 
+endif
+
 DEB_SETUP_GHC_CONFIGURE_ARGS += $(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),,-ftests)
 
 DEB_INSTALL_DOCS_ALL += README.md

Reply to: