From 4aee6c5a232dc534611350a4922f7a29ba9a2b93 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 28 Mar 2020 23:39:06 -0700 Subject: [PATCH] Fix building on FC33 Signed-off-by: Andrei Vagin --- cr-service-fix.patch | 74 ++++++++++++++++++++++++++++++++++++++++++++ criu.spec | 9 +++++- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 cr-service-fix.patch diff --git a/cr-service-fix.patch b/cr-service-fix.patch new file mode 100644 index 0000000..020c40b --- /dev/null +++ b/cr-service-fix.patch @@ -0,0 +1,74 @@ +commit af9157ff696c4c7b45d9d4a47f8d7e71fa8c71bc +Author: Sergei Trofimovich +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 + +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 + diff --git a/criu.spec b/criu.spec index c448646..869b9d5 100644 --- a/criu.spec +++ b/criu.spec @@ -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 - 3.13-7 +- Added patch for gcc-10 + * Tue Jan 28 2020 Fedora Release Engineering - 3.13-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild