0002-fix-build-on-uclibc-ng.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. From c84e5e55e0e9e793849f721d30979242ed6a6ee3 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 1 Oct 2023 14:12:38 +0200
  4. Subject: [PATCH] fix build on uclibc-ng
  5. Fix the following build failure with uclibc-ng raised since version
  6. 1.6.18 and
  7. https://github.com/memcached/memcached/commit/875371a75cbf1f92350de2d1fa0fae4a35ed572b:
  8. /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':
  9. thread.c:(.text+0xea2): undefined reference to `pthread_setname_np'
  10. Fixes:
  11. - http://autobuild.buildroot.org/results/e856d381f5ec7d2727f21c8bd46dacb456984416
  12. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  13. Upstream: unsent yet (waiting feedback on first patch)
  14. ---
  15. configure.ac | 1 +
  16. extstore.c | 2 +-
  17. thread.c | 2 +-
  18. 3 files changed, 3 insertions(+), 2 deletions(-)
  19. diff --git a/configure.ac b/configure.ac
  20. index d94f6fb..5ec5088 100644
  21. --- a/configure.ac
  22. +++ b/configure.ac
  23. @@ -686,6 +686,7 @@ AC_CHECK_FUNCS(clock_gettime)
  24. AC_CHECK_FUNCS(preadv)
  25. AC_CHECK_FUNCS(pread)
  26. AC_CHECK_FUNCS(eventfd)
  27. +AC_CHECK_FUNCS([pthread_setname_np],[AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Define to 1 if support pthread_setname_np])])
  28. AC_CHECK_FUNCS([accept4], [AC_DEFINE(HAVE_ACCEPT4, 1, [Define to 1 if support accept4])])
  29. AC_CHECK_FUNCS([getopt_long], [AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if support getopt_long])])
  30. diff --git a/extstore.c b/extstore.c
  31. index b079465..f6a6180 100644
  32. --- a/extstore.c
  33. +++ b/extstore.c
  34. @@ -119,7 +119,7 @@ struct store_engine {
  35. #define THR_NAME_MAXLEN 16
  36. static void thread_setname(pthread_t thread, const char *name) {
  37. assert(strlen(name) < THR_NAME_MAXLEN);
  38. -#if defined(__linux__)
  39. +#if defined(__linux__) && defined(HAVE_PTHREAD_SETNAME_NP)
  40. pthread_setname_np(thread, name);
  41. #endif
  42. }
  43. diff --git a/thread.c b/thread.c
  44. index ee120fa..76651c2 100644
  45. --- a/thread.c
  46. +++ b/thread.c
  47. @@ -635,7 +635,7 @@ static void thread_libevent_process(evutil_socket_t fd, short which, void *arg)
  48. #define THR_NAME_MAXLEN 16
  49. void thread_setname(pthread_t thread, const char *name) {
  50. assert(strlen(name) < THR_NAME_MAXLEN);
  51. -#if defined(__linux__)
  52. +#if defined(__linux__) && defined(HAVE_PTHREAD_SETNAME_NP)
  53. pthread_setname_np(thread, name);
  54. #endif
  55. }
  56. --
  57. 2.40.1