• Bug#1100364: haskell-clash-ghc: Use extra --ghc-options in d/rules on l

    From zhangdandan@21:1/5 to All on Thu Mar 13 02:50:01 2025
    This is a multi-part message in MIME format.
    Source: haskell-clash-ghc
    Version: 1.8.1-3
    Severity: normal
    Tags: patch
    User: debian-loongarch@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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ilias Tsitsimpis@21:1/5 to zhangdandan on Sun Mar 16 11:30:01 2025
    Hi Dandan,

    On Thu, Mar 13, 2025 at 09:39AM, zhangdandan wrote:
    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
    ......
    ```

    I thought we fixed those errors with GHC 9.6.6-4, where we applied the
    patches from https://bugs.debian.org/1089921. What are we missing?

    Please consider the patch I attached.
    Based on attached patch, I have built  successfully on locally.

    Can we stop patching every Haskell package to pass the --ghc-options="-optc-mcmodel=medium" flag? The plan was to remove this work-around now that we have the proper fix in GHC.

    Thanks,

    --
    Ilias

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)