From e619065b0c21ed516890f996e0d543a890c16d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8B=87?= Date: Wed, 4 Aug 2021 10:49:57 +0800 Subject: [PATCH] fix failure caused by GCC upgrade to GCC-10 --- Fix-pcp-gcc10.patch | 94 +++++++++++++++++++++++++++++++++++++++++++++ pcp.spec | 7 +++- 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 Fix-pcp-gcc10.patch diff --git a/Fix-pcp-gcc10.patch b/Fix-pcp-gcc10.patch new file mode 100644 index 0000000..75ad945 --- /dev/null +++ b/Fix-pcp-gcc10.patch @@ -0,0 +1,94 @@ +diff --git a/src/external/sds.h b/src/external/sds.h +index 1bdb60d..adcc12c 100644 +--- a/src/external/sds.h ++++ b/src/external/sds.h +@@ -34,7 +34,7 @@ + #define __SDS_H + + #define SDS_MAX_PREALLOC (1024*1024) +-const char *SDS_NOINIT; ++extern const char *SDS_NOINIT; + + #include + #include +diff --git a/src/pmdas/cifs/pmda.c b/src/pmdas/cifs/pmda.c +index 84fb50f..9240e3d 100644 +--- a/src/pmdas/cifs/pmda.c ++++ b/src/pmdas/cifs/pmda.c +@@ -25,8 +25,8 @@ static int _isDSO = 1; /* for local contexts */ + + static char *cifs_procfsdir = "/proc/fs/cifs"; + static char *cifs_statspath = ""; +-unsigned int global_version_major; +-unsigned int global_version_minor; ++extern unsigned int global_version_major; ++extern unsigned int global_version_minor; + + pmdaIndom indomtable[] = { + { .it_indom = CIFS_FS_INDOM }, +diff --git a/src/pmdas/perfevent/configparser.h b/src/pmdas/perfevent/configparser.h +index 4f504ea..c6726f2 100644 +--- a/src/pmdas/perfevent/configparser.h ++++ b/src/pmdas/perfevent/configparser.h +@@ -69,9 +69,9 @@ typedef struct configuration { + pmcdynamic_t *dynamicpmc; + } configuration_t; + +-int context_newpmc; +-int context_derived; /* A flag to check the current pmc */ +-int context_dynamic; /* check the current dynamic pmc */ ++extern int context_newpmc; ++extern int context_derived; /* A flag to check the current pmc */ ++extern int context_dynamic; /* check the current dynamic pmc */ + + /* \brief parse the perf event configuration file + * This function allocates memory. The returned object should be passed to +diff --git a/src/pmdas/perfevent/configparser.l b/src/pmdas/perfevent/configparser.l +index bb139fe..fbdaeca 100644 +--- a/src/pmdas/perfevent/configparser.l ++++ b/src/pmdas/perfevent/configparser.l +@@ -20,6 +20,10 @@ + %{ + #include "configparser.h" + ++int context_newpmc; ++int context_derived; ++int context_dynamic; ++ + static int is_derived(char *name) + { + char *str = NULL; +diff --git a/src/pmdas/perfevent/parse_events.c b/src/pmdas/perfevent/parse_events.c +index efe356f..f6d1a7b 100644 +--- a/src/pmdas/perfevent/parse_events.c ++++ b/src/pmdas/perfevent/parse_events.c +@@ -18,6 +18,8 @@ + #include "parse_events.h" + #include "perfinterface.h" + ++char dev_dir[PATH_MAX]; /* Optional path prefix for the PMU devices */ ++ + static void cleanup_property(struct property *prop) + { + if (!prop) +diff --git a/src/pmdas/perfevent/parse_events.h b/src/pmdas/perfevent/parse_events.h +index 4e09496..8f7a393 100644 +--- a/src/pmdas/perfevent/parse_events.h ++++ b/src/pmdas/perfevent/parse_events.h +@@ -80,11 +80,11 @@ struct software_event { + unsigned long long config; + }; + +-char dev_dir[PATH_MAX]; /* Optional path prefix for the PMU devices */ ++extern char dev_dir[]; /* Optional path prefix for the PMU devices */ + +-int init_dynamic_events(struct pmu **pmu_list); +-void setup_cpu_config(struct pmu *pmu_ptr, int *ncpus, int **cpuarr); +-int get_file_string(char *path, char *buf); +-void cleanup_pmu_list(struct pmu *pmu); ++extern int init_dynamic_events(struct pmu **pmu_list); ++extern void setup_cpu_config(struct pmu *pmu_ptr, int *ncpus, int **cpuarr); ++extern int get_file_string(char *path, char *buf); ++extern void cleanup_pmu_list(struct pmu *pmu); + + #endif /* PARSE_EVENTS_H_ */ diff --git a/pcp.spec b/pcp.spec index cc7753d..1eb0c72 100644 --- a/pcp.spec +++ b/pcp.spec @@ -11,7 +11,7 @@ Name: pcp Version: 4.1.3 Summary: System-level performance monitoring and performance management -Release: 15 +Release: 16 License: GPLv2+ and LGPLv2.1+ and CC-BY URL: https://pcp.io Source0: https://dl.bintray.com/pcp/source/pcp-4.1.3.tar.gz @@ -26,6 +26,7 @@ Patch9000: 9000-fix-new-function-not-found-when-Install.patch Patch9001: 0002-fix-some-pcp-pidstat-bugs.patch Patch9002: 0003-fix-pcp-pidstat-bug.patch Patch9003: 0004-modify-python2-to-python3.patch +Patch9004: Fix-pcp-gcc10.patch BuildRequires: gcc gcc-c++ procps autoconf bison flex nss-devel rpm-devel avahi-devel xz-devel zlib-devel BuildRequires: python3-devel ncurses-devel readline-devel cyrus-sasl-devel papi-devel libpfm-devel >= 4 @@ -865,6 +866,7 @@ This package installs selinux support files for PCP. %patch9001 -p1 %patch9002 -p1 %patch9003 -p1 +%patch9004 -p1 %build @@ -2218,6 +2220,9 @@ fi %config(noreplace) /etc/pcp/pmrep/* %changelog +* Wed Aug 04 2021 wangyong - 4.1.3-16 +- Fix build error caused by GCC upgrade to GCC-10 + * Mon Nov 09 2020 lingsheng - 4.1.3-15 - Change require to python3-bpfcc