Package: ghc Version: 9.4.7-1+loong64.1 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 increase jump-instructions's range. ``` diff --git a/debian/rules b/debian/rules index 29b9da7..4c55f52 100755 --- a/debian/rules +++ b/debian/rules @@ -102,6 +102,10 @@ ifneq (,$(filter noopt, $(DEB_BUILD_OPTIONS))) EXTRA_HADRIAN_FLAGS += "*.*.rts.*.opts += -O0" endif +ifneq (,$(filter loong64, $(DEB_HOST_ARCH))) + EXTRA_HADRIAN_FLAGS += "*.*.ghc.*.opts += -optc-mcmodel=medium" +endif + ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) endif ``` Meanwhile, you can also consider the patch I attached. Your opinions are welcome. Thanks. -- System Information: Debian Release: trixie/sid APT prefers unreleased APT policy: (500, 'unreleased'), (500, 'unstable') Architecture: loong64 (loongarch64) Kernel: Linux 5.10.0-60.121.0.148.oe2203.loongarch64 (SMP w/32 CPU threads) Kernel taint flags: TAINT_UNSIGNED_MODULE Locale: LANG=zh_CN.UTF-8, LC_CTYPE=zh_CN.UTF-8 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to POSIX), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: unable to detect Versions of packages ghc depends on: ii dpkg 1.22.6 ii gcc 4:13.2.0-7 ii libbsd-dev 0.12.2-1 ii libc6 2.38-11 ii libc6-dev 2.38-11 ii libffi-dev 3.4.6-1 ii libffi8 3.4.6-1 ii libgmp-dev 2:6.3.0+dfsg-2 ii libgmp10 2:6.3.0+dfsg-2 ii libncurses-dev 6.5-2 ii libnuma1 2.0.18-1 ii libtinfo6 6.5-2 ii llvm-16 1:16.0.6-27 ghc recommends no packages. Versions of packages ghc suggests: ii ghc-doc 9.4.7-5 ii ghc-prof 9.4.7-1+loong64.1 pn llvm-15 <none> ii perl 5.38.2-4 -- no debconf information
diff --git a/debian/rules b/debian/rules index 29b9da7..4c55f52 100755 --- a/debian/rules +++ b/debian/rules @@ -102,6 +102,10 @@ ifneq (,$(filter noopt, $(DEB_BUILD_OPTIONS))) EXTRA_HADRIAN_FLAGS += "*.*.rts.*.opts += -O0" endif +ifneq (,$(filter loong64, $(DEB_HOST_ARCH))) + EXTRA_HADRIAN_FLAGS += "*.*.ghc.*.opts += -optc-mcmodel=medium" +endif + ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) endif