Package: otf2 Followup-For: Bug #1033672 User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu lunar ubuntu-patch Control: tags -1 patch
Listen, I swear to you, I build-tested an earlier version of the patch injecting -latomic into LDFLAGS in a riscv64 qemu instance and I saw it work; but now that just fails to build on Launchpad and in my qemu for the logical reason that ldflags come before source files on the commandline and therefore -latomic is being discarded by the linker before it has a chance to know it needs it. So I'm touching m4 after all. Here's a minimal patch which I've build-tested locally and is expected to work on riscv64 autobuilds too. You can see build results at: https://launchpad.net/ubuntu/+source/otf2/3.0.2-1ubuntu3
diff -Nru otf2-3.0.2/debian/patches/series otf2-3.0.2/debian/patches/series --- otf2-3.0.2/debian/patches/series 2022-12-18 10:24:27.000000000 -0800 +++ otf2-3.0.2/debian/patches/series 2023-03-29 19:26:32.000000000 -0700 @@ -1,3 +1,4 @@ rename reproducible instruction_set +use-libatomic.patch diff -Nru otf2-3.0.2/debian/patches/use-libatomic.patch otf2-3.0.2/debian/patches/use-libatomic.patch --- otf2-3.0.2/debian/patches/use-libatomic.patch 1969-12-31 16:00:00.000000000 -0800 +++ otf2-3.0.2/debian/patches/use-libatomic.patch 2023-03-29 19:32:07.000000000 -0700 @@ -0,0 +1,23 @@ +Description: check for libatomic and if present, pass it to the linker + gcc atomics detection fails on riscv64 because on this arch, they are + provided by libatomic which must be explicitly passed to the linker. + Check for libatomic, and unconditionally add it to libs if present. + This is safe on all Debian archs because our linker will discard the + dependency automatically if it's unneeded. +Author: Steve Langasek <steve.langa...@ubuntu.com> +Bug-Debian: https://bugs.debian.org/1033672 +Last-Update: 2023-03-29 +Forwarded: no + +Index: otf2-3.0.2/build-config/common/m4/afs_gcc_atomic_builtins.m4 +=================================================================== +--- otf2-3.0.2.orig/build-config/common/m4/afs_gcc_atomic_builtins.m4 ++++ otf2-3.0.2/build-config/common/m4/afs_gcc_atomic_builtins.m4 +@@ -67,6 +67,7 @@ + AC_REQUIRE([AX_ASM_INLINE]) + AC_MSG_CHECKING([for gcc atomic builtins]) + AC_LANG_PUSH([C]) ++AC_CHECK_LIB([atomic], [exit]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include "${srcdir}/../common/utils/src/atomic/UTILS_Atomic.inc.c"]],