sys-apps/openrc: tweak for gcc-10, bug #705868
authorSergei Trofimovich <slyfox@gentoo.org>
Sat, 21 Mar 2020 20:35:01 +0000 (20:35 +0000)
committerSergei Trofimovich <slyfox@gentoo.org>
Sat, 21 Mar 2020 20:35:13 +0000 (20:35 +0000)
Closes: https://bugs.gentoo.org/705868
Package-Manager: Portage-2.3.94, Repoman-2.3.21
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
sys-apps/openrc/files/openrc-0.42.1-gcc-10.patch [new file with mode: 0644]
sys-apps/openrc/openrc-0.42.1.ebuild

diff --git a/sys-apps/openrc/files/openrc-0.42.1-gcc-10.patch b/sys-apps/openrc/files/openrc-0.42.1-gcc-10.patch
new file mode 100644 (file)
index 0000000..ce2fd10
--- /dev/null
@@ -0,0 +1,48 @@
+https://bugs.gentoo.org/705868
+
+From 375ef42393f3dc6edbaa2cb70c79b2366072db38 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sun, 19 Jan 2020 15:24:20 +0000
+Subject: [PATCH] src/rc/rc-logger.h: fix build failure against gcc-10
+
+On gcc-10 (and gcc-9 -fno-common) build fails as:
+
+```
+cc  -L../librc -L../libeinfo -O2 -g -std=c99 -Wall -Wextra -Wimplicit -Wshadow \
+  -Wformat=2 -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn \
+  -Wmissing-format-attribute -Wnested-externs -Winline -Wwrite-strings \
+  -Wcast-align -Wcast-qual -Wpointer-arith -Wdeclaration-after-statement \
+  -Wsequence-point -Werror=implicit-function-declaration    \
+  -Wl,-rpath=/lib   -o openrc rc.o rc-logger.o rc-misc.o rc-plugin.o _usage.o -lutil -lrc -leinfo -Wl,-Bdynamic -ldl
+ld: rc-logger.o:/home/slyfox/dev/git/openrc/src/rc/rc-logger.h:16:
+  multiple definition of `rc_logger_pid'; rc.o:openrc/src/rc/rc-logger.h:16: first defined here
+ld: rc-logger.o:/home/slyfox/dev/git/openrc/src/rc/rc-logger.h:17:
+  multiple definition of `rc_logger_tty'; rc.o:openrc/src/rc/rc-logger.h:17: first defined here
+```
+
+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.
+
+This fixes #348.
+---
+ src/rc/rc-logger.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/src/rc/rc-logger.h
++++ b/src/rc/rc-logger.h
+@@ -13,8 +13,8 @@
+ #ifndef RC_LOGGER_H
+ #define RC_LOGGER_H
+-pid_t rc_logger_pid;
+-int rc_logger_tty;
++extern pid_t rc_logger_pid;
++extern int rc_logger_tty;
+ extern bool rc_in_logger;
+ void rc_logger_open(const char *runlevel);
+-- 
+2.25.2
+
index 3a80774a11dec0cadedaa41d39b047e36966e352..46f3497690d5fb3d3af4b80043283fb3b9e47308 100644 (file)
@@ -56,6 +56,8 @@ RDEPEND="${COMMON_DEPEND}
 
 PDEPEND="netifrc? ( net-misc/netifrc )"
 
+PATCHES=("${FILESDIR}"/${PN}-0.42.1-gcc-10.patch)
+
 src_prepare() {
        default
        if [[ ${PV} == "9999" ]] ; then