• Bug#1103415: weakforced: Append -latomic to LDFLAGS on loong64

    From zhangdandan@21:1/5 to All on Thu Apr 17 12:10:01 2025
    This is a multi-part message in MIME format.
    Source: weakforced
    Version: 2.10.2-2
    Severity: normal
    Tags: patch
    User: debian-loongarch@lists.debian.org
    Usertags: loong64

    Dear maintainers,

    Compiling the weakforced failed for loong64 in the Debian Package
    Auto-Building environment.
    The error log is as follows,
    ```
    ......
    /usr/bin/ld: trackalert.o: in function `std::_Rb_tree<std::pair<Netmask, bool>*, std::pair<Netmask, bool>*, std::_Identity<std::pair<Netmask,
    bool>*>, std::less<std::pair<Netmask, bool>*>, std::allocator<std::pair<Netmask, bool>*>
    ::_M_erase(std::_Rb_tree_node<std::pair<Netmask, bool>*>*)': /usr/include/c++/14/bits/stl_tree.h:1930:(.text+0x6e0): undefined
    reference to `__atomic_load_16'
    /usr/bin/ld: trackalert.o: in function `std::_Rb_tree<std::pair<Netmask, bool>*, std::pair<Netmask, bool>*, std::_Identity<std::pair<Netmask,
    bool>*>, std::less<std::pair<Netmask, bool>*>, std::allocator<std::pair<Netmask, bool>*>
    ::_S_left(std::_Rb_tree_node_base*)': /usr/include/c++/14/bits/stl_tree.h:778:(.text+0x710): undefined
    reference to `__atomic_compare_exchange_16'
    ......
    ```
    The full build log can be found at https://buildd.debian.org/status/logs.php?pkg=weakforced&arch=loong64.

    Please consider the patch I attached.
    Append -latomic to LDFLAGS on loong64, and weakforced was built
    successfully on locally.
    Your opinions are welcome.

    Best regards,
    Dandan Zhang


    diff -Nru weakforced-2.10.2/debian/changelog weakforced-2.10.2/debian/changelog --- weakforced-2.10.2/debian/changelog 2025-04-11 12:37:09.000000000 +0000
    +++ weakforced-2.10.2/debian/changelog 2025-04-17 09:48:27.000000000 +0000
    @@ -1,3 +1,9 @@
    +weakforced (2.10.2-2+loong64) unstable; urgency=medium
    +
    + * Append -latomic to LDFLAGS on loong64.
    +
    + -- Dandan Zhang <zhangdandan@loongson.cn> Thu, 17 Apr 2025 17:48:27 +0800
    +
    weakforced (2.10.2-2) unstable; urgency=medium

    [ Gui-Yue ]
    diff -Nru weakforced-2.10.2/debian/rules weakforced-2.10.2/debian/rules
    --- weakforced-2.10.2/debian/rules 2025-04-11 12:34:02.000000000 +0000
    +++ weakforced-2.10.2/debian/rules 2025-04-17 09:48:27.000000000 +0000
    @@ -9,6 +9,10 @@
    DPKG_EXPORT_BUILDFLAGS = 1
    include /usr/share/dpkg/default.mk

    +ifneq (,$(filter $(DEB_HOST_ARCH), loong64))
    + export DEB_LDFLAGS_MAINT_APPEND += -latomic
    +endif
    +
    DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

    %:

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