What Can I Do If the Undefined reference to `pthread_setname_np' Error Is Reported During Redis 6.2.7 Compilation in SUSE 11?

Comment From: sundb

pthread_getname_np was introduced in glibc 2.2., what is the gblic version you are using? You can use 'ldd --version' to find it. ping @yossigo

Comment From: alinlky

suse11 glibc version is 2.11.3

Comment From: alinlky

pthread_getname_np was introduced in glibc 2.2., what is the gblic version you are using? You can use 'ldd --version' to find it. ping @yossigo

can i replace pthread_setname_np(pthread_self(), name) to prctl(PR_SET_NAME, name) in suse11?

Comment From: sundb

@alinlky Please try this patch:

diff --git a/src/config.h b/src/config.h
index 3c9a27013..d719e0a47 100644
--- a/src/config.h
+++ b/src/config.h
@@ -280,7 +280,7 @@ void setproctitle(const char *fmt, ...);
 #endif

 /* Define for redis_set_thread_title */
-#ifdef __linux__
+#if (defined __linux__ && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 12)
 #define redis_set_thread_title(name) pthread_setname_np(pthread_self(), name)
 #else
 #if (defined __FreeBSD__ || defined __OpenBSD__)

Comment From: alinlky

diff Define for redis_set_thread_title

Yes, this solves the compilation problem.