fix compile failure by GCC-10
[Why] met multiple definition error Signed-off-by: Lu Weitao <luweitaobe@163.com> (cherry picked from commit 170b36466cc56fc4ad42b72c951782241f74d81d)
This commit is contained in:
parent
cabc0f0de9
commit
ae3502fb28
67
0001-fix-multi-define.patch
Normal file
67
0001-fix-multi-define.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From: Lu Weitao <luweitaobe@163.com>
|
||||
Date: Thu, 12 Aug 2021 15:20:40 +0800
|
||||
Subject: [PATCH 5/5] fix-multi-define
|
||||
|
||||
[Why]
|
||||
met multiple definition as bellow:
|
||||
[ 117s] /usr/bin/ld: test/alloc_benchmark_tbb-load_tbbmalloc_symbols.o:/home/abuild/rpmbuild/BUILD/memkind-1.7.0/test/tbbmalloc.h:28: multiple definition of `scalable_mallo
|
||||
c'; test/alloc_benchmark_tbb-alloc_benchmark.o:/home/abuild/rpmbuild/BUILD/memkind-1.7.0/test/tbbmalloc.h:28: first defined here
|
||||
[ 117s] /usr/bin/ld: test/alloc_benchmark_tbb-load_tbbmalloc_symbols.o:/home/abuild/rpmbuild/BUILD/memkind-1.7.0/test/tbbmalloc.h:29: multiple definition of `scalable_reall
|
||||
oc'; test/alloc_benchmark_tbb-alloc_benchmark.o:/home/abuild/rpmbuild/BUILD/memkind-1.7.0/test/tbbmalloc.h:29: first defined here
|
||||
[ 117s] /usr/bin/ld: test/alloc_benchmark_tbb-load_tbbmalloc_symbols.o:/home/abuild/rpmbuild/BUILD/memkind-1.7.0/test/tbbmalloc.h:30: multiple definition of `scalable_callo
|
||||
c'; test/alloc_benchmark_tbb-alloc_benchmark.o:/home/abuild/rpmbuild/BUILD/memkind-1.7.0/test/tbbmalloc.h:30: first defined here
|
||||
[ 117s] /usr/bin/ld: test/alloc_benchmark_tbb-load_tbbmalloc_symbols.o:/home/abuild/rpmbuild/BUILD/memkind-1.7.0/test/tbbmalloc.h:31: multiple definition of `scalable_free'
|
||||
; test/alloc_benchmark_tbb-alloc_benchmark.o:/home/abuild/rpmbuild/BUILD/memkind-1.7.0/test/tbbmalloc.h:31: first defined here
|
||||
|
||||
Signed-off-by: Lu Weitao <luweitaobe@163.com>
|
||||
---
|
||||
memkind-1.7.0/test/alloc_benchmark.c | 2 ++
|
||||
memkind-1.7.0/test/load_tbbmalloc_symbols.c | 3 +++
|
||||
memkind-1.7.0/test/tbbmalloc.h | 8 ++++----
|
||||
3 files changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/test/alloc_benchmark.c b/test/alloc_benchmark.c
|
||||
--- a/test/alloc_benchmark.c
|
||||
+++ b/test/alloc_benchmark.c
|
||||
@@ -47,6 +47,8 @@
|
||||
|
||||
double ctimer(void);
|
||||
void usage(char * name);
|
||||
+void* (*scalable_malloc)(size_t);
|
||||
+void (*scalable_free)(void*);
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
diff --git a/test/load_tbbmalloc_symbols.c b/test/load_tbbmalloc_symbols.c
|
||||
--- a/test/load_tbbmalloc_symbols.c
|
||||
+++ b/test/load_tbbmalloc_symbols.c
|
||||
@@ -24,6 +24,9 @@
|
||||
|
||||
#include "tbbmalloc.h"
|
||||
|
||||
+void* (*scalable_realloc)(void*, size_t);
|
||||
+void* (*scalable_calloc)(size_t, size_t);
|
||||
+
|
||||
int load_tbbmalloc_symbols()
|
||||
{
|
||||
const char so_name[]="libtbbmalloc.so.2";
|
||||
diff --git a/test/tbbmalloc.h b/test/tbbmalloc.h
|
||||
--- a/test/tbbmalloc.h
|
||||
+++ b/test/tbbmalloc.h
|
||||
@@ -25,9 +25,9 @@
|
||||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
-void* (*scalable_malloc)(size_t);
|
||||
-void* (*scalable_realloc)(void*, size_t);
|
||||
-void* (*scalable_calloc)(size_t, size_t);
|
||||
-void (*scalable_free)(void*);
|
||||
+extern void* (*scalable_malloc)(size_t);
|
||||
+extern void* (*scalable_realloc)(void*, size_t);
|
||||
+extern void* (*scalable_calloc)(size_t, size_t);
|
||||
+extern void (*scalable_free)(void*);
|
||||
|
||||
int load_tbbmalloc_symbols();
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
Name: memkind
|
||||
Summary: Extensible Heap Manager for User
|
||||
Version: 1.7.0
|
||||
Release: 4
|
||||
Release: 5
|
||||
License: BSD
|
||||
URL: http://memkind.github.io/memkind
|
||||
Source0: https://github.com/memkind/memkind/archive/v1.7.0/%{name}-%{version}.tar.gz
|
||||
Patch0001: 0001-fix-multi-define.patch
|
||||
|
||||
BuildRequires: automake libtool numactl-devel systemd gcc gcc-c++
|
||||
ExclusiveArch: x86_64
|
||||
@ -74,5 +75,8 @@ popd
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
||||
* Wed Aug 2 2021 luweitao <luweitaobe@163.com> - 2.7.1-12
|
||||
- fix compile failure by GCC-10
|
||||
|
||||
* Thu Apr 23 2020 leiju <leiju4@huawei.com> - 1.7.0-4
|
||||
- Package init
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user