Skip to contentSkip to conversation

heaptrack: Fix build on musl

PATCH In review Khem Raj 2 participants 2 messages Nov 23, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 heaptrack: Fix build on musl

Improve upon summary and description fields
Add PV to the recipe

---
 ...heaptrack-Replace-__pid_t-with-pid_t.patch |  26 ++++
 ...t-Include-dlfcn.h-for-dlopen-dlclose.patch |  38 ++++++
 ...d-Make-noexcept-attribute-conditiona.patch | 118 ++++++++++++++++++
 ...04-backtrace-Always-include-stdint.h.patch |  42 +++++++
 .../heaptrack/heaptrack_1.2.0.bb              |  27 ++++
 .../heaptrack/heaptrack_git.bb                |  18 ---
 6 files changed, 251 insertions(+), 18 deletions(-)
 create mode 100644 meta-oe/recipes-devtools/heaptrack/heaptrack/0001-libheaptrack-Replace-__pid_t-with-pid_t.patch
 create mode 100644 meta-oe/recipes-devtools/heaptrack/heaptrack/0002-heaptrack_inject-Include-dlfcn.h-for-dlopen-dlclose.patch
 create mode 100644 meta-oe/recipes-devtools/heaptrack/heaptrack/0003-heaptrack_preload-Make-noexcept-attribute-conditiona.patch
 create mode 100644 meta-oe/recipes-devtools/heaptrack/heaptrack/0004-backtrace-Always-include-stdint.h.patch
 create mode 100644 meta-oe/recipes-devtools/heaptrack/heaptrack_1.2.0.bb
 delete mode 100644 meta-oe/recipes-devtools/heaptrack/heaptrack_git.bb
meta-oe/recipes-devtools/heaptrack/heaptrack/0001-libheaptrack-Replace-__pid_t-with-pid_t.patch new file +26 -0
new file mode 100644
index 0000000000..9681086a52
@@ -0,0 +1,26 @@
+From 18671cd6028f996c138c6eb4282caf313f3fc605 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 23 Nov 2020 15:25:18 -0800
+Subject: [PATCH] libheaptrack: Replace __pid_t with pid_t
+
+__pid_t is for internal libc use
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/track/libheaptrack.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/track/libheaptrack.cpp b/src/track/libheaptrack.cpp
+index e138bce..4120ecd 100644
+--- a/src/track/libheaptrack.cpp
++++ b/src/track/libheaptrack.cpp
+@@ -79,7 +79,7 @@ chrono::milliseconds elapsedTime()
+     return chrono::duration_cast<chrono::milliseconds>(clock::now() - startTime());
+ }
+ 
+-__pid_t gettid()
++pid_t gettid()
+ {
+     return syscall(SYS_gettid);
+ }
meta-oe/recipes-devtools/heaptrack/heaptrack/0002-heaptrack_inject-Include-dlfcn.h-for-dlopen-dlclose.patch new file +38 -0
new file mode 100644
index 0000000000..5fa802cb38
@@ -0,0 +1,38 @@
+From 8ebcf5f2dd27dbeb6c81e9c40a5d17916cb243e6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 23 Nov 2020 15:26:31 -0800
+Subject: [PATCH] heaptrack_inject: Include dlfcn.h for dlopen/dlclose
+
+Do not use __WORDSIZE which is for libc internal use
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/track/heaptrack_inject.cpp | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/track/heaptrack_inject.cpp b/src/track/heaptrack_inject.cpp
+index 325d87e..fb1c154 100644
+--- a/src/track/heaptrack_inject.cpp
++++ b/src/track/heaptrack_inject.cpp
+@@ -28,6 +28,7 @@
+ #include <link.h>
+ #include <malloc.h>
+ #include <unistd.h>
++#include <dlfcn.h>
+ 
+ #include <sys/mman.h>
+ 
+@@ -39,9 +40,10 @@
+  * @brief Experimental support for symbol overloading after runtime injection.
+  */
+ 
+-#if __WORDSIZE == 64
++#include <limits.h>
++#if ULONG_MAX == 0xffffffffffffffff
+ #define ELF_R_SYM(i) ELF64_R_SYM(i)
+-#elif __WORDSIZE == 32
++#elif ULONG_MAX == 0xffffffff
+ #define ELF_R_SYM(i) ELF32_R_SYM(i)
+ #else
+ #error unsupported word size
meta-oe/recipes-devtools/heaptrack/heaptrack/0003-heaptrack_preload-Make-noexcept-attribute-conditiona.patch new file +118 -0

118 lines not on this page · raw message

meta-oe/recipes-devtools/heaptrack/heaptrack/0004-backtrace-Always-include-stdint.h.patch new file +42 -0

42 lines not on this page · raw message

meta-oe/recipes-devtools/heaptrack/heaptrack_1.2.0.bb new file +27 -0
new file mode 100644
index 0000000000..14d3983ca6
@@ -0,0 +1,27 @@
+SUMMARY = "Heap memory profiler for Linux"
+DESCRIPTION = "Heaptrack traces all memory allocations and annotates these \
+events with stack traces. Dedicated analysis tools then allow you to interpret \
+the heap memory profile to find hotspots to reduce memory, leaks, allocation \
+hotspots and temporary allocations"
+HOMEPAGE = "https://phabricator.kde.org/source/heaptrack/"
+LICENSE = "LGPL-2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
+
+DEPENDS = "zlib boost libunwind elfutils"
+
+SRC_URI = "git://github.com/KDE/heaptrack.git;protocol=https \
+           file://0001-libheaptrack-Replace-__pid_t-with-pid_t.patch \
+           file://0002-heaptrack_inject-Include-dlfcn.h-for-dlopen-dlclose.patch \
+           file://0003-heaptrack_preload-Make-noexcept-attribute-conditiona.patch \
+           file://0004-backtrace-Always-include-stdint.h.patch \
+           "
+
+SRCREV = "bc9e3744bcc47de978673d1e382f4125a1ab5fa8"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+EXTRA_OECMAKE += "-DHEAPTRACK_BUILD_GUI=OFF"
+
+BBCLASSEXTEND = "native nativesdk"
meta-oe/recipes-devtools/heaptrack/heaptrack_git.bb deleted +0 -18
deleted file mode 100644
index 30d7b65bd7..0000000000
@@ -1,18 +0,0 @@
-DESCRIPTION = "Heaptrack"
-HOMEPAGE = "https://phabricator.kde.org/source/heaptrack/"
-LICENSE = "LGPL-2.1"
-LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
-
-DEPENDS = "zlib boost libunwind elfutils"
-
-SRC_URI = "git://github.com/KDE/heaptrack.git;protocol=https"
-
-SRCREV = "bc9e3744bcc47de978673d1e382f4125a1ab5fa8"
-
-S = "${WORKDIR}/git"
-
-inherit cmake
-
-EXTRA_OECMAKE += "-DHEAPTRACK_BUILD_GUI=OFF"
-
-BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Khem Raj

++#ifdef __GLIBC__
++#define NOEXECPT noexcept
++#else
++#define NOEXECPT
++#endif

Small typo here NOEXECPT vs. NOEXCEPT.

otherwise.