Skip to contentSkip to conversation

gperftools: Fix build with new musl updates

PATCH New Khem Raj 1 participant 1 message Oct 31, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 gperftools: Fix build with new musl updates

Latest musl shows build failures e.g. ../git/src/profile-handler.cc:275:8: error: no member named '_sigev_un' in 'sigevent'
sevp._sigev_un._tid = sys_gettid();
~~~~ ^

---
 ...dler-Specify-libc-specific-thread_id.patch | 38 +++++++++++++++++++
 .../gperftools/gperftools_2.8.bb              |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta-oe/recipes-support/gperftools/gperftools/0001-profile-handler-Specify-libc-specific-thread_id.patch
meta-oe/recipes-support/gperftools/gperftools/0001-profile-handler-Specify-libc-specific-thread_id.patch new file +38 -0
new file mode 100644
index 0000000000..4029a69c5c
@@ -0,0 +1,38 @@
+From 0a504852ed6e56620d1df26b503c4aa2b5b74760 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 31 Oct 2020 16:12:36 -0700
+Subject: [PATCH] profile-handler: Specify libc specific thread_id
+
+We need to know internal _sigev_un is glibc specific, add an else for
+musl case
+
+Fixes build issue
+../git/src/profile-handler.cc:275:8: error: no member named '_sigev_un' in 'sigevent'
+  sevp._sigev_un._tid = sys_gettid();
+  ~~~~ ^
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/profile-handler.cc | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/profile-handler.cc b/src/profile-handler.cc
+index 7fdcb69..5867118 100644
+--- a/src/profile-handler.cc
++++ b/src/profile-handler.cc
+@@ -272,7 +272,11 @@ static void StartLinuxThreadTimer(int timer_type, int signal_number,
+   struct itimerspec its;
+   memset(&sevp, 0, sizeof(sevp));
+   sevp.sigev_notify = SIGEV_THREAD_ID;
++#ifdef __GLIBC__
+   sevp._sigev_un._tid = sys_gettid();
++#else
++  sevp.sigev_notify_thread_id = sys_gettid();
++#endif
+   sevp.sigev_signo = signal_number;
+   clockid_t clock = CLOCK_THREAD_CPUTIME_ID;
+   if (timer_type == ITIMER_REAL) {
+-- 
+2.29.2
+
meta-oe/recipes-support/gperftools/gperftools_2.8.bb +1 -0
index 662777b473..d9b310bceb 100644
@@ -10,6 +10,7 @@ SRC_URI = "git://github.com/gperftools/gperftools \
            file://0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch \
            file://disable_libunwind_aarch64.patch \
            file://sgidef.patch \
+           file://0001-profile-handler-Specify-libc-specific-thread_id.patch \
            "
 
 inherit autotools
Signature · 1 line
2.29.2