Fix building on FC33

Signed-off-by: Andrei Vagin <avagin@gmail.com>
This commit is contained in:
Andrei Vagin 2020-03-28 23:39:06 -07:00
parent 3ebad9ae30
commit 4aee6c5a23
2 changed files with 82 additions and 1 deletions

74
cr-service-fix.patch Normal file
View File

@ -0,0 +1,74 @@
commit af9157ff696c4c7b45d9d4a47f8d7e71fa8c71bc
Author: Sergei Trofimovich <slyfox@gentoo.org>
Date: Sun Feb 2 18:45:59 2020 +0000
criu: fix build failure against gcc-10
On gcc-10 (and gcc-9 -fno-common) build fails as:
```
ld: criu/arch/x86/crtools.o:criu/include/cr_options.h:159:
multiple definition of `rpc_cfg_file'; criu/arch/x86/cpu.o:criu/include/cr_options.h:159: first defined here
make[2]: *** [scripts/nmk/scripts/build.mk:164: criu/arch/x86/crtools.built-in.o] Error 1
```
gcc-10 will change the default from -fcommon to fno-common:
https://gcc.gnu.org/PR85678.
The error also happens if CFLAGS=-fno-common passed explicitly.
Reported-by: Toralf Förster
Bug: https://bugs.gentoo.org/707942
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
diff --git a/criu/config.c b/criu/config.c
index 6fb6bfdff..df5d85162 100644
--- a/criu/config.c
+++ b/criu/config.c
@@ -30,6 +30,7 @@
#include "common/xmalloc.h"
struct cr_options opts;
+char *rpc_cfg_file;
static int count_elements(char **to_count)
{
diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
index a7b040fbf..e02848d2d 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -147,7 +147,7 @@ struct cr_options {
};
extern struct cr_options opts;
-char *rpc_cfg_file;
+extern char *rpc_cfg_file;
extern int parse_options(int argc, char **argv, bool *usage_error, bool *has_exec_cmd, int state);
extern int check_options();
diff --git a/criu/include/pstree.h b/criu/include/pstree.h
index 7303c1fed..61ab0ce0e 100644
--- a/criu/include/pstree.h
+++ b/criu/include/pstree.h
@@ -42,7 +42,7 @@ enum {
};
#define FDS_EVENT (1 << FDS_EVENT_BIT)
-struct pstree_item *current;
+extern struct pstree_item *current;
struct rst_info;
/* See alloc_pstree_item() for details */
diff --git a/criu/include/tun.h b/criu/include/tun.h
index ce0b266a6..b82c445a7 100644
--- a/criu/include/tun.h
+++ b/criu/include/tun.h
@@ -5,7 +5,7 @@
#define TUN_MINOR 200
#endif
-struct ns_id *ns;
+extern struct ns_id *ns;
#include <linux/netlink.h>

View File

@ -12,7 +12,7 @@
Name: criu
Version: 3.13
Release: 6%{?dist}
Release: 7%{?dist}
Provides: crtools = %{version}-%{release}
Obsoletes: crtools <= 1.0-2
Summary: Tool for Checkpoint/Restore in User-space
@ -32,6 +32,8 @@ Source3: compel.1
Patch100: aio-fix.patch
%endif
Patch101: cr-service-fix.patch
Source4: criu-tmpfiles.conf
BuildRequires: gcc
@ -105,6 +107,8 @@ their content in human-readable form.
%patch100 -p1
%endif
%patch101 -p1
%build
# %{?_smp_mflags} does not work
# -fstack-protector breaks build
@ -178,6 +182,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a
%changelog
* Sun Mar 29 2020 Andrei Vagin <avagin@gmail.com> - 3.13-7
- Added patch for gcc-10
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.13-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild