From a4fd0aed2986fc4f58560ac650ad42c06b08215a Mon Sep 17 00:00:00 2001 From: liu-yinsi Date: Wed, 4 Aug 2021 20:59:17 +0800 Subject: [PATCH] define variables only in one .c file to fix multiple definition add CFLAGS="$CLASS -fcommon" in libmemcached.spec is bad to fix multiple definition, it only masks error messages, but define variables only in one .c file is better choice. Signed-off-by: liu-yinsi --- libmemcached-fix-multiple-definition.patch | 32 ++++++++++++++++++++++ libmemcached.spec | 8 ++++-- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 libmemcached-fix-multiple-definition.patch diff --git a/libmemcached-fix-multiple-definition.patch b/libmemcached-fix-multiple-definition.patch new file mode 100644 index 0000000..6a51bf3 --- /dev/null +++ b/libmemcached-fix-multiple-definition.patch @@ -0,0 +1,32 @@ +--- a/clients/ms_memslap.h 2021-08-04 20:25:20.314194660 +0800 ++++ b/clients/ms_memslap.h 2021-08-04 20:26:01.154700115 +0800 +@@ -117,13 +117,13 @@ + } ms_global_t; + + /* global structure */ +-ms_global_t ms_global; ++extern ms_global_t ms_global; + + /* global stats information structure */ +-ms_stats_t ms_stats; ++extern ms_stats_t ms_stats; + + /* global statistic structure */ +-ms_statistic_t ms_statistic; ++extern ms_statistic_t ms_statistic; + + #ifdef __cplusplus + } +--- a/clients/ms_sigsegv.c 2014-02-09 19:52:42.000000000 +0800 ++++ b/clients/ms_sigsegv.c 2021-08-04 20:35:49.725984452 +0800 +@@ -21,6 +21,10 @@ + #include + + #include "ms_memslap.h" ++ms_global_t ms_global; ++ms_stats_t ms_stats; ++ms_statistic_t ms_statistic; ++ + #include "ms_setting.h" + + /* prototypes */ diff --git a/libmemcached.spec b/libmemcached.spec index bde36f9..013f25f 100644 --- a/libmemcached.spec +++ b/libmemcached.spec @@ -1,7 +1,7 @@ Name: libmemcached Summary: Client library and command line tools for memcached server Version: 1.0.18 -Release: 18 +Release: 19 License: BSD URL: http://libmemcached.org/ #origin source:https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz @@ -19,6 +19,7 @@ Patch0001: libmemcached-fix-linking-with-libpthread.patch Patch0002: libmemcached-build.patch Patch0003: libmemcached-fix-memdump-version.patch Patch0004: libmemcached-Ignore-specific-errors-from-memcached_dump.patch +Patch0005: libmemcached-fix-multiple-definition.patch %description @@ -54,7 +55,7 @@ cp -p tests/*.{cc,h} examples/ %configure \ --with-memcached=%{_bindir}/memcached \ --enable-sasl --enable-libmemcachedprotocol \ - --enable-memaslap --enable-dtrace --disable-static CFLAGS="$CLASS -fcommon" + --enable-memaslap --enable-dtrace --disable-static %make_build V=1 @@ -100,6 +101,9 @@ make test %{_mandir}/man3/hashkit* %changelog +* Web Aug 04 2021 Liu Yinsi - 1.0.18-19 +- fix multiple definition to support gcc 10 + * Mon Aug 02 2021 Liu Yinsi - 1.0.18-18 - compile with -fcommon to support gcc 10