From 943dd49c9b70210b8b32199c6bfe648235a92700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 17 Jan 2023 10:36:43 +0100 Subject: [PATCH] Fix undefined pthread_setname_np https://fedoraproject.org/wiki/Toolchain/PortingToModernC --- gc.spec | 8 +++++++- pthread_setname_np.patch | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 pthread_setname_np.patch diff --git a/gc.spec b/gc.spec index 91feaeb..3ad797c 100644 --- a/gc.spec +++ b/gc.spec @@ -1,7 +1,7 @@ Summary: Garbage collector for C and C++ Name: gc Version: 8.2.2 -Release: 1%{?dist} +Release: 2%{?dist} License: BSD URL: https://www.hboehm.info/gc/ @@ -10,6 +10,8 @@ Source0: https://github.com/ivmai/bdwgc/releases/download/v%{version}/gc-%{versi ## upstreamable patches ## downstream patches +# Already upstream: https://github.com/ivmai/bdwgc/commit/4489757f1cc1fe4aa98d4c1ebbe0789b2b308e11 +Patch0: pthread_setname_np.patch BuildRequires: automake libtool BuildRequires: gcc-c++ @@ -105,6 +107,10 @@ make check %{?arch_ignore} %changelog +* Tue Jan 17 2023 Timm Bäder - 8.2.2-2 +- Fix undefined pthread_setname_np +- https://fedoraproject.org/wiki/Toolchain/PortingToModernC + * Tue Sep 20 2022 Rex Dieter 8.2.2-1 - 8.2.2 (#2124760) diff --git a/pthread_setname_np.patch b/pthread_setname_np.patch new file mode 100644 index 0000000..1925064 --- /dev/null +++ b/pthread_setname_np.patch @@ -0,0 +1,22 @@ +diff -ruN gc-8.2.2.orig/configure.ac gc-8.2.2/configure.ac +--- gc-8.2.2.orig/configure.ac 2022-08-26 20:44:49.000000000 +0200 ++++ gc-8.2.2/configure.ac 2023-01-17 10:24:04.342866823 +0100 +@@ -833,13 +833,15 @@ + AS_IF([test "$THREADS" = posix], + [AC_MSG_CHECKING(for pthread_setname_np) + old_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS $CFLAGS_EXTRA -Werror" +- AC_TRY_COMPILE([#include ], ++ CFLAGS="$CFLAGS $CFLAGS_EXTRA -Werror -pthread" ++ AC_TRY_COMPILE([#define _GNU_SOURCE ++ #include ], + [pthread_setname_np("thread-name")], + [AC_MSG_RESULT([yes (w/o tid)]) + AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID], [1], + [Define to use 'pthread_setname_np(const char*)' function.])], +- [AC_TRY_COMPILE([#include ], ++ [AC_TRY_COMPILE([#define _GNU_SOURCE ++ #include ], + [pthread_setname_np(pthread_self(), "thread-name-%u", 0)], + [AC_MSG_RESULT([yes (with tid and arg)]) + AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG], [1],