Bug#1098791: kicad: Please include patch to link against libatomic on powerpc

John Paul Adrian Glaubitz <[email protected]>
Newsgroups gmane.linux.debian.ports.powerpc
Message-ID <174038775521.17488.10763490159372591921.reportbug__354.670993850448$1740387989$gmane$org@z6>
Source: kicad
Version: 9.0.0+dfsg-1
Severity: normal
Tags: patch
User: [email protected]
Usertags: powerpc
X-Debbugs-Cc: [email protected]

Hi,

src:kicad currently fails to build from source due to missing linking against libatomic:

[ 34%] Linking CXX executable bitmap2component
cd /build/reproducible-path/kicad-9.0.0+dfsg/debian/build/bitmap2component && /usr/bin/cmake -E cmake_link_script CMakeFiles/bitmap2component.dir/link.txt --verbose=1
/usr/bin/ld: ../common/libcommon.a(wx_view_controls.cpp.o): undefined reference to symbol '__atomic_fetch_add_8@@LIBATOMIC_1.0'
/usr/bin/ld: /lib/powerpc-linux-gnu/libatomic.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

This can be fixed by patching debian/rules to append -latomic to DEB_LDFLAGS_MAINT_APPEND:

--- debian/rules.orig   2025-02-23 07:00:36.000000000 -0800
+++ debian/rules        2025-02-23 22:43:58.488539668 -0800
@@ -9,6 +9,11 @@
 CFLAGS+=$(CPPFLAGS)
 CXXFLAGS+=$(CPPFLAGS)
 
+# workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358
+ifneq (,$(filter $(DEB_HOST_ARCH), armel m68k powerpc sh4))
+export DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed -latomic -Wl,--as-needed
+endif
+
 # out of tree build folder for kicad application
 DEB_BUILD_DIR=debian/build
 # default install folder

Please see the attached patch. I have also included armel, m68k and sh4 in the
architecture list as this should also be necessary on these architectures.

PS: Would be nice if kicad could be built for any architecture.

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
kicad-libatomic.diff (text/plain, 497 B)
--- debian/rules.orig	2025-02-23 07:00:36.000000000 -0800
+++ debian/rules	2025-02-23 22:43:58.488539668 -0800
@@ -9,6 +9,11 @@
 CFLAGS+=$(CPPFLAGS)
 CXXFLAGS+=$(CPPFLAGS)
 
+# workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358
+ifneq (,$(filter $(DEB_HOST_ARCH), armel m68k powerpc sh4))
+export DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed -latomic -Wl,--as-needed
+endif
+
 # out of tree build folder for kicad application
 DEB_BUILD_DIR=debian/build
 # default install folder
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.