Accepting request 520357 from home:wolfi323:branches:KDE:Extra
- Add fix-build.patch to fix build with glibc 2.26 in Factory (kde#383889) OBS-URL: https://build.opensuse.org/request/show/520357 OBS-URL: https://build.opensuse.org/package/show/KDE:Extra/heaptrack?expand=0&rev=3
This commit is contained in:
parent
0831329ddf
commit
8c2a07c088
137
fix-build.patch
Normal file
137
fix-build.patch
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
From f0a682550118b7019e74af71d9e8624902b8a984 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Milian Wolff <milian.wolff@kdab.com>
|
||||||
|
Date: Thu, 31 Aug 2017 09:51:34 +0200
|
||||||
|
Subject: Use check_symbol_exists() to check if cfree() is available
|
||||||
|
|
||||||
|
Thanks to Daniel Vratil for the initial work.
|
||||||
|
|
||||||
|
heaptrack now compiles on Fedora rawhide and Arch Linux x86_64
|
||||||
|
with glibc 2.26 or newer.
|
||||||
|
|
||||||
|
Differential Revision: https://phabricator.kde.org/D7621
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 5 +++++
|
||||||
|
src/track/heaptrack_inject.cpp | 7 +------
|
||||||
|
src/track/heaptrack_preload.cpp | 6 +-----
|
||||||
|
src/util/config.h.cmake | 4 ++++
|
||||||
|
tests/manual/CMakeLists.txt | 4 ++++
|
||||||
|
tests/manual/test.cpp | 6 ++++++
|
||||||
|
6 files changed, 21 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 0cdde70..7ff93df 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -73,6 +73,11 @@ if (NOT HAVE_LINUX_HEADERS)
|
||||||
|
message(FATAL_ERROR "You are missing some Linux headers required to compile heaptrack.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
+# cfree() does not exist in glibc 2.26+.
|
||||||
|
+# See: https://bugs.kde.org/show_bug.cgi?id=383889
|
||||||
|
+include(CheckSymbolExists)
|
||||||
|
+check_symbol_exists(cfree malloc.h HAVE_CFREE)
|
||||||
|
+
|
||||||
|
set(BIN_INSTALL_DIR "bin")
|
||||||
|
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
|
||||||
|
set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}")
|
||||||
|
diff --git a/src/track/heaptrack_inject.cpp b/src/track/heaptrack_inject.cpp
|
||||||
|
index 93508e0..c24a266 100644
|
||||||
|
--- a/src/track/heaptrack_inject.cpp
|
||||||
|
+++ b/src/track/heaptrack_inject.cpp
|
||||||
|
@@ -18,6 +18,7 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "libheaptrack.h"
|
||||||
|
+#include "util/config.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
@@ -43,12 +44,6 @@
|
||||||
|
#error unsupported word size
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || defined(__USE_MISC)
|
||||||
|
-#define HAVE_CFREE 1
|
||||||
|
-#else
|
||||||
|
-#define HAVE_CFREE 0
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
namespace Elf {
|
||||||
|
diff --git a/src/track/heaptrack_preload.cpp b/src/track/heaptrack_preload.cpp
|
||||||
|
index d8dde24..b77774a 100644
|
||||||
|
--- a/src/track/heaptrack_preload.cpp
|
||||||
|
+++ b/src/track/heaptrack_preload.cpp
|
||||||
|
@@ -18,6 +18,7 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "libheaptrack.h"
|
||||||
|
+#include "util/config.h"
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
@@ -30,7 +31,6 @@ using namespace std;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#define HAVE_ALIGNED_ALLOC defined(_ISOC11_SOURCE)
|
||||||
|
-#define HAVE_CFREE (defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || defined(__USE_MISC))
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
diff --git a/src/util/config.h.cmake b/src/util/config.h.cmake
|
||||||
|
index 7bad362..861c1f7 100644
|
||||||
|
--- a/src/util/config.h.cmake
|
||||||
|
+++ b/src/util/config.h.cmake
|
||||||
|
@@ -30,4 +30,8 @@
|
||||||
|
|
||||||
|
#define HEAPTRACK_DEBUG_BUILD @HEAPTRACK_DEBUG_BUILD@
|
||||||
|
|
||||||
|
+// cfree() does not exist in glibc 2.26+.
|
||||||
|
+// See: https://bugs.kde.org/show_bug.cgi?id=383889
|
||||||
|
+#cmakedefine01 HAVE_CFREE
|
||||||
|
+
|
||||||
|
#endif // HEAPTRACK_CONFIG_H
|
||||||
|
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt
|
||||||
|
index fe9602b..8996201 100644
|
||||||
|
--- a/tests/manual/CMakeLists.txt
|
||||||
|
+++ b/tests/manual/CMakeLists.txt
|
||||||
|
@@ -2,6 +2,10 @@ set(CMAKE_BUILD_TYPE Debug)
|
||||||
|
|
||||||
|
add_executable(test_c test.c)
|
||||||
|
add_executable(test_cpp test.cpp)
|
||||||
|
+set_target_properties(test_cpp PROPERTIES
|
||||||
|
+ INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/../../src/
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
add_executable(threaded threaded.cpp)
|
||||||
|
target_link_libraries(threaded ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
|
diff --git a/tests/manual/test.cpp b/tests/manual/test.cpp
|
||||||
|
index a77dbd7..4c7b0d2 100644
|
||||||
|
--- a/tests/manual/test.cpp
|
||||||
|
+++ b/tests/manual/test.cpp
|
||||||
|
@@ -1,6 +1,8 @@
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
+#include "util/config.h"
|
||||||
|
+
|
||||||
|
#define HAVE_ALIGNED_ALLOC defined(_ISOC11_SOURCE)
|
||||||
|
|
||||||
|
struct Foo
|
||||||
|
@@ -60,7 +62,11 @@ int main()
|
||||||
|
|
||||||
|
buf = calloc(5, 5);
|
||||||
|
printf("calloc: %p\n", buf);
|
||||||
|
+#if HAVE_CFREE
|
||||||
|
cfree(buf);
|
||||||
|
+#else
|
||||||
|
+ free(buf);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#if HAVE_ALIGNED_ALLOC
|
||||||
|
buf = aligned_alloc(16, 160);
|
||||||
|
--
|
||||||
|
cgit v0.11.2
|
||||||
|
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Sep 2 15:03:19 UTC 2017 - wbauer@tmo.at
|
||||||
|
|
||||||
|
- Add fix-build.patch to fix build with glibc 2.26 in Factory
|
||||||
|
(kde#383889)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Apr 19 18:22:16 UTC 2017 - fabian@ritter-vogt.de
|
Wed Apr 19 18:22:16 UTC 2017 - fabian@ritter-vogt.de
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ License: LGPL-2.1+
|
|||||||
Group: Development/Tools/Other
|
Group: Development/Tools/Other
|
||||||
Url: https://userbase.kde.org/Heaptrack
|
Url: https://userbase.kde.org/Heaptrack
|
||||||
Source0: https://download.kde.org/stable/heaptrack/%{version}/src/%{name}-%{version}.tar.xz
|
Source0: https://download.kde.org/stable/heaptrack/%{version}/src/%{name}-%{version}.tar.xz
|
||||||
|
# PATCH-FIX-UPSTREAM
|
||||||
|
Patch: fix-build.patch
|
||||||
# Needs office-chart-area icon
|
# Needs office-chart-area icon
|
||||||
BuildRequires: breeze5-icons
|
BuildRequires: breeze5-icons
|
||||||
BuildRequires: extra-cmake-modules
|
BuildRequires: extra-cmake-modules
|
||||||
@ -63,6 +65,7 @@ A memory profiler for Linux, tracking heap allocations.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch -p1
|
||||||
# Disable building tests, they're not used and post-build-checks trips over it
|
# Disable building tests, they're not used and post-build-checks trips over it
|
||||||
sed -i"" '/add_subdirectory(tests)/d' CMakeLists.txt
|
sed -i"" '/add_subdirectory(tests)/d' CMakeLists.txt
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user