From 93ce3d2e5c2b5d091c063742c6d22b746ff0683d Mon Sep 17 00:00:00 2001 From: Matěj Grabovský Date: Feb 20 2020 09:23:19 +0000 Subject: Add patch for building with GCC 10/Fedora 32 --- diff --git a/0001-Fix-for-build-on-GCC-10.patch b/0001-Fix-for-build-on-GCC-10.patch new file mode 100644 index 0000000..fecedba --- /dev/null +++ b/0001-Fix-for-build-on-GCC-10.patch @@ -0,0 +1,80 @@ +From 0d98403557465dd12e4f8d33a673d98b3468dd60 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Grabovsk=C3=BD?= +Date: Thu, 20 Feb 2020 10:11:47 +0100 +Subject: [PATCH] Fix for build on GCC 10 + +GCC 10 defaults to -fno-common which requires us to explicitly mark +global variables with extern in header files. +--- + include/Logging.h | 6 ++---- + include/ProcDumpConfiguration.h | 6 +++--- + src/ProcDumpConfiguration.c | 6 ++++++ + 3 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/include/Logging.h b/include/Logging.h +index 2ac9d2d..992b758 100644 +--- a/include/Logging.h ++++ b/include/Logging.h +@@ -26,8 +26,6 @@ + #define S2(x) S1(x) + #define LOCATION "in "__FILE__ ", at line " S2(__LINE__) + +-extern struct ProcDumpConfiguration g_config; +- + + enum LogLevel{ + debug, +@@ -39,7 +37,7 @@ enum LogLevel{ + + void Log(enum LogLevel logLevel, const char *message, ...); + +-pthread_mutex_t LoggerLock; ++extern pthread_mutex_t LoggerLock; + + void DiagTrace(const char* message, ...); + +@@ -54,4 +52,4 @@ void DiagTrace(const char* message, ...); + #define Trace(format, ...) \ + DiagTrace(format " %s", ##__VA_ARGS__, LOCATION); + +-#endif // LOGGING_H +\ No newline at end of file ++#endif // LOGGING_H +diff --git a/include/ProcDumpConfiguration.h b/include/ProcDumpConfiguration.h +index 70f7b00..8f55815 100644 +--- a/include/ProcDumpConfiguration.h ++++ b/include/ProcDumpConfiguration.h +@@ -38,10 +38,10 @@ + #define MIN_KERNEL_VERSION 3 + #define MIN_KERNEL_PATCH 5 + +-struct ProcDumpConfiguration g_config; // backbone of the program ++extern struct ProcDumpConfiguration g_config; // backbone of the program + +-long HZ; // clock ticks per second +-int MAXIMUM_CPU; // maximum cpu usage percentage (# cores * 100) ++extern long HZ; // clock ticks per second ++extern int MAXIMUM_CPU; // maximum cpu usage percentage (# cores * 100) + + // ------------------- + // Structs +diff --git a/src/ProcDumpConfiguration.c b/src/ProcDumpConfiguration.c +index a428c11..3d07915 100644 +--- a/src/ProcDumpConfiguration.c ++++ b/src/ProcDumpConfiguration.c +@@ -12,6 +12,12 @@ + + struct Handle g_evtConfigurationInitialized = HANDLE_MANUAL_RESET_EVENT_INITIALIZER("ConfigurationInitialized"); + ++pthread_mutex_t LoggerLock; ++struct ProcDumpConfiguration g_config; ++ ++long HZ; ++int MAXIMUM_CPU; ++ + static sigset_t sig_set; + static pthread_t sig_thread_id; + +-- +2.24.1 + diff --git a/procdump.spec b/procdump.spec index 4a6e7ec..f26c315 100644 --- a/procdump.spec +++ b/procdump.spec @@ -3,7 +3,7 @@ Name: procdump Version: 1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Sysinternals process dump utility License: MIT @@ -15,6 +15,10 @@ BuildRequires: make BuildRequires: zlib-devel Requires: gdb >= 7.6.1 +# Fix for GCC 10 (Fedora 32) builds +# https://github.com/microsoft/ProcDump-for-Linux/pull/79 +Patch0: 0001-Fix-for-build-on-GCC-10.patch + %description ProcDump is a command-line utility whose primary purpose is monitoring an application for various resources and generating crash dumps during a spike that @@ -28,7 +32,7 @@ other scripts. %build -%make_build CFLAGS="%{optflags}" +%make_build CFLAGS="%{optflags} -fno-common" %install @@ -45,6 +49,9 @@ other scripts. %changelog +* Thu Feb 20 2020 Matěj Grabovský - 1.1-3 +- Fix build with GCC 10 + * Thu Jan 30 2020 Fedora Release Engineering - 1.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild