Skip to contentSkip to conversation

package/memcached: fix uclibc-ng build

PATCH Applied Fabrice Fontaine 2 participants 2 messages Oct 1, 2023 – Nov 4, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/memcached: fix uclibc-ng build

Fix the following uclibc-ng build failure raised since bump to version 1.6.21 in commit 6ce55ab0ed3b7125cd11ecfe8c18aaf156b5f060 and
https://github.com/memcached/memcached/commit/875371a75cbf1f92350de2d1fa0fae4a35ed572b:

/home/buildroot/autobuild/instance-2/output-1/host/lib/gcc/arc-buildroot-linux-uclibc/10.2.0/../../../../arc-buildroot-linux-uclibc/bin/ld: memcached-thread.o: in function `thread_setname':
thread.c:(.text+0xea2): undefined reference to `pthread_setname_np'

Fixes:
- http://autobuild.buildroot.org/results/e856d381f5ec7d2727f21c8bd46dacb456984416

---
 .../0002-fix-build-on-uclibc-ng.patch         | 64 +++++++++++++++++++
 package/memcached/memcached.mk                |  2 +
 2 files changed, 66 insertions(+)
 create mode 100644 package/memcached/0002-fix-build-on-uclibc-ng.patch
package/memcached/0002-fix-build-on-uclibc-ng.patch new file +64 -0
new file mode 100644
index 0000000000..a5af7a2adb
@@ -0,0 +1,64 @@
+From c84e5e55e0e9e793849f721d30979242ed6a6ee3 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Sun, 1 Oct 2023 14:12:38 +0200
+Subject: [PATCH] fix build on uclibc-ng
+
+Fix the following build failure with uclibc-ng raised since version
+1.6.18 and
+https://github.com/memcached/memcached/commit/875371a75cbf1f92350de2d1fa0fae4a35ed572b:
+
+/home/buildroot/autobuild/instance-2/output-1/host/lib/gcc/arc-buildroot-linux-uclibc/10.2.0/../../../../arc-buildroot-linux-uclibc/bin/ld: memcached-thread.o: in function `thread_setname':
+thread.c:(.text+0xea2): undefined reference to `pthread_setname_np'
+
+Fixes:
+ - http://autobuild.buildroot.org/results/e856d381f5ec7d2727f21c8bd46dacb456984416
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+Upstream: unsent yet (waiting feedback on first patch)
+---
+ configure.ac | 1 +
+ extstore.c   | 2 +-
+ thread.c     | 2 +-
+ 3 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index d94f6fb..5ec5088 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -686,6 +686,7 @@ AC_CHECK_FUNCS(clock_gettime)
+ AC_CHECK_FUNCS(preadv)
+ AC_CHECK_FUNCS(pread)
+ AC_CHECK_FUNCS(eventfd)
++AC_CHECK_FUNCS([pthread_setname_np],[AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Define to 1 if support pthread_setname_np])])
+ AC_CHECK_FUNCS([accept4], [AC_DEFINE(HAVE_ACCEPT4, 1, [Define to 1 if support accept4])])
+ AC_CHECK_FUNCS([getopt_long], [AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if support getopt_long])])
+ 
+diff --git a/extstore.c b/extstore.c
+index b079465..f6a6180 100644
+--- a/extstore.c
++++ b/extstore.c
+@@ -119,7 +119,7 @@ struct store_engine {
+ #define THR_NAME_MAXLEN 16
+ static void thread_setname(pthread_t thread, const char *name) {
+ assert(strlen(name) < THR_NAME_MAXLEN);
+-#if defined(__linux__)
++#if defined(__linux__) && defined(HAVE_PTHREAD_SETNAME_NP)
+ pthread_setname_np(thread, name);
+ #endif
+ }
+diff --git a/thread.c b/thread.c
+index ee120fa..76651c2 100644
+--- a/thread.c
++++ b/thread.c
+@@ -635,7 +635,7 @@ static void thread_libevent_process(evutil_socket_t fd, short which, void *arg)
+ #define THR_NAME_MAXLEN 16
+ void thread_setname(pthread_t thread, const char *name) {
+ assert(strlen(name) < THR_NAME_MAXLEN);
+-#if defined(__linux__)
++#if defined(__linux__) && defined(HAVE_PTHREAD_SETNAME_NP)
+ pthread_setname_np(thread, name);
+ #endif
+ }
+-- 
+2.40.1
+
package/memcached/memcached.mk +2 -0
index 2ebc672d1c..a1a5eac049 100644
@@ -13,6 +13,8 @@ MEMCACHED_LICENSE = BSD-3-Clause
 MEMCACHED_LICENSE_FILES = COPYING
 MEMCACHED_CPE_ID_VENDOR = memcached
 MEMCACHED_SELINUX_MODULES = memcached
+# We're patching configure.ac
+MEMCACHED_AUTORECONF = YES
 
 ifeq ($(BR2_ENDIAN),"BIG")
 MEMCACHED_CONF_ENV += ac_cv_c_endian=big
Signature · 6 lines
2.40.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 11 lines · On Sun, 1 Oct 2023 15:04:59 +0200 Fabrice Fontaine…

Fix the following uclibc-ng build failure raised since bump to version 1.6.21 in commit 6ce55ab0ed3b7125cd11ecfe8c18aaf156b5f060 and
https://github.com/memcached/memcached/commit/875371a75cbf1f92350de2d1fa0fae4a35ed572b:

/home/buildroot/autobuild/instance-2/output-1/host/lib/gcc/arc-buildroot-linux-uclibc/10.2.0/../../../../arc-buildroot-linux-uclibc/bin/ld: memcached-thread.o: in function `thread_setname':
thread.c:(.text+0xea2): undefined reference to `pthread_setname_np'

Fixes:
- http://autobuild.buildroot.org/results/e856d381f5ec7d2727f21c8bd46dacb456984416

Thanks, applied!

package/memcached/0002-fix-build-on-uclibc-ng.patch line 17

Quoted 2 lines
package/memcached/0002-fix-build-on-uclibc-ng.patch new file +2 -0
+Signed-off-by: Fabrice Fontaine <[email protected]>
+Upstream: unsent yet (waiting feedback on first patch)

I think you should submit without waiting for feedback on your first patch, it's a separate topic/issue.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot