tags 1075065 + fixed-upstream patch
thanks

On Wed, 03 Jul 2024 12:30:02 +0000 Matthias Klose <[email protected]> wrote:
The package fails to build in a test rebuild on at least amd64 with
gcc-14/g++-14, but succeeds to build with gcc-13/g++-13. The
severity of this report will be raised before the trixie release.

The full build log can be found at:
http://qa-logs.debian.net/2024/07/01/heaptrack_1.5.0+dfsg1-2_unstable_gccexp.log
The last lines of the build log are at the end of this report.
The issue is fixed in upstream commit [1].

Backporting that commit fixes the build.
I'm attaching a patch that does that.

Best regards,
Michael


[1] https://invent.kde.org/sdk/heaptrack/-/commit/c6c45f3455a652c38aefa402aece5dafa492e8ab
From 29b9975134402c3e50f5b8d7fa4f06670ca67b9d Mon Sep 17 00:00:00 2001
From: Michael Weghorn <[email protected]>
Date: Mon, 2 Sep 2024 09:33:51 +0200
Subject: [PATCH] Backport upstream commit to fix build with GCC 14

Backport upstream commit

    commit c6c45f3455a652c38aefa402aece5dafa492e8ab
    Author: Florian Weimer <[email protected]>
    Date:   Fri Dec 15 22:53:19 2023 +0100

        cmake: Fix C compatibility of libunwind probes

which fixes this build error with GCC 14 [1]:

    CMake Error at /usr/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
      Could NOT find Libunwind (missing: LIBUNWIND_HAS_UNW_BACKTRACE) (found
      version "1.6.2")
    Call Stack (most recent call first):
      /usr/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
      cmake/FindLibunwind.cmake:70 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
      CMakeLists.txt:155 (find_package)

[1] http://qa-logs.debian.net/2024/07/01/heaptrack_1.5.0+dfsg1-2_unstable_gccexp.log

Closes: #1075065
---
 ...-C-compatibility-of-libunwind-probes.patch | 46 +++++++++++++++++++
 debian/patches/series                         |  2 +
 2 files changed, 48 insertions(+)
 create mode 100644 debian/patches/30_cmake-Fix-C-compatibility-of-libunwind-probes.patch

diff --git a/debian/patches/30_cmake-Fix-C-compatibility-of-libunwind-probes.patch b/debian/patches/30_cmake-Fix-C-compatibility-of-libunwind-probes.patch
new file mode 100644
index 0000000..3a6af8e
--- /dev/null
+++ b/debian/patches/30_cmake-Fix-C-compatibility-of-libunwind-probes.patch
@@ -0,0 +1,46 @@
+From: Florian Weimer <[email protected]>
+Date: Fri, 15 Dec 2023 22:53:19 +0100
+Subject: cmake: Fix C compatibility of libunwind probes
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+Future compilers such as GCC 14 are likely to enforce C type
+compatibility rules by default and report errors like this one:
+
+…/TryCompile-aAxUZn/src.c: In function ‘main’:
+…/TryCompile-aAxUZn/src.c:3:43: error: passing argument 1 of ‘unw_backtrace’ from incompatible pointer type
+    3 | int main() { void* buf[10]; unw_backtrace(&buf, 10); return 0; }
+      |                                           ^~~~
+      |                                           |
+      |                                           void * (*)[10]
+In file included from /usr/include/libunwind-x86_64.h:129,
+                 from /usr/include/libunwind.h:23,
+                 from …/TryCompile-aAxUZn/src.c:2:
+/usr/include/libunwind-common.h:318:27: note: expected ‘void **’ but argument is of type ‘void * (*)[10]’
+  318 | extern int unw_backtrace (void **, int);
+      |                           ^~~~~~~
+
+Removing the address operator ensures that the array type decays to
+a pointer, and that the types are compatible.
+
+(cherry picked from commit c6c45f3455a652c38aefa402aece5dafa492e8ab)
+---
+ cmake/FindLibunwind.cmake | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/FindLibunwind.cmake b/cmake/FindLibunwind.cmake
+index 2dddfad..d597de9 100644
+--- a/cmake/FindLibunwind.cmake
++++ b/cmake/FindLibunwind.cmake
+@@ -57,8 +57,8 @@ if (LIBUNWIND_LIBRARY)
+                           LIBUNWIND_HAS_UNW_GETCONTEXT)
+   check_c_source_compiles("#define UNW_LOCAL_ONLY 1\n#include <libunwind.h>\nint main() { unw_context_t context; unw_cursor_t cursor; unw_getcontext(&context); unw_init_local(&cursor, &context); return 0; }"
+                           LIBUNWIND_HAS_UNW_INIT_LOCAL)
+-  check_c_source_compiles("#define UNW_LOCAL_ONLY 1\n#include <libunwind.h>\nint main() { void* buf[10]; unw_backtrace(&buf, 10); return 0; }" LIBUNWIND_HAS_UNW_BACKTRACE)
+-  check_c_source_compiles ("#define UNW_LOCAL_ONLY 1\n#include <libunwind.h>\nint main() { void* buf[10]; unw_backtrace_skip(&buf, 10, 2); return 0; }" LIBUNWIND_HAS_UNW_BACKTRACE_SKIP)
++  check_c_source_compiles("#define UNW_LOCAL_ONLY 1\n#include <libunwind.h>\nint main() { void* buf[10]; unw_backtrace(buf, 10); return 0; }" LIBUNWIND_HAS_UNW_BACKTRACE)
++  check_c_source_compiles ("#define UNW_LOCAL_ONLY 1\n#include <libunwind.h>\nint main() { void* buf[10]; unw_backtrace_skip(buf, 10, 2); return 0; }" LIBUNWIND_HAS_UNW_BACKTRACE_SKIP)
+   check_c_source_compiles ("#define UNW_LOCAL_ONLY 1\n#include <libunwind.h>\nint main() { return unw_set_cache_size(unw_local_addr_space, 1024, 0); }" LIBUNWIND_HAS_UNW_SET_CACHE_SIZE)
+   check_c_source_compiles ("#define UNW_LOCAL_ONLY 1\n#include <libunwind.h>\nint main() { return unw_set_caching_policy(unw_local_addr_space, UNW_CACHE_PER_THREAD); }" LIBUNWIND_HAS_UNW_CACHE_PER_THREAD)
+   set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
diff --git a/debian/patches/series b/debian/patches/series
index e52f4ea..35deeeb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,4 @@
 10_update_cmake_version.patch
 20_disable_some_unreliable_tests.patch
+# backported from upstream
+30_cmake-Fix-C-compatibility-of-libunwind-probes.patch
-- 
2.45.2

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to