From f8904424faebf1018fd8c6b30a9cb8b47d893cc6 Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkränzer Date: Thu, 18 Mar 2021 16:04:08 +0100 Subject: Fix building ltp and logrotate with clang 12 (and gcc >= 10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modern compilers default to -fno-common -- fixing the way in which multiply defined symbols are handled. Some code needs to be adapted. Signed-off-by: Bernhard Rosenkränzer --- .../logrotate/logrotate-3.15.1-fno-common.patch | 30 ++++++++++++++++++++++ recipes-extended/logrotate/logrotate_%.bbappend | 2 ++ recipes-extended/ltp/ltp_%.bbappend | 4 +++ 3 files changed, 36 insertions(+) create mode 100644 recipes-extended/logrotate/logrotate/logrotate-3.15.1-fno-common.patch create mode 100644 recipes-extended/logrotate/logrotate_%.bbappend create mode 100644 recipes-extended/ltp/ltp_%.bbappend diff --git a/recipes-extended/logrotate/logrotate/logrotate-3.15.1-fno-common.patch b/recipes-extended/logrotate/logrotate/logrotate-3.15.1-fno-common.patch new file mode 100644 index 0000000..a5bb8de --- /dev/null +++ b/recipes-extended/logrotate/logrotate/logrotate-3.15.1-fno-common.patch @@ -0,0 +1,30 @@ +This patch fixes building logrotate 3.15.1 with modern compilers +that default to -fno-common (such as clang >= 10, gcc >= 10) + +Signed-off-by: Bernhard Rosenkraenzer + +diff -up logrotate-3.15.1/logrotate.h.omv~ logrotate-3.15.1/logrotate.h +--- logrotate-3.15.1/logrotate.h.omv~ 2021-03-18 13:48:57.662529086 +0100 ++++ logrotate-3.15.1/logrotate.h 2021-03-18 13:49:28.983736070 +0100 +@@ -89,7 +89,8 @@ struct logInfo { + TAILQ_ENTRY(logInfo) list; + }; + +-TAILQ_HEAD(logInfoHead, logInfo) logs; ++TAILQ_HEAD(logInfoHead, logInfo); ++extern struct logInfoHead logs; + + extern int numLogs; + extern int debug; +diff -up logrotate-3.15.1/config.c.omv~ logrotate-3.15.1/config.c +--- logrotate-3.15.1/config.c.omv~ 2021-03-18 18:22:09.897571389 +0100 ++++ logrotate-3.15.1/config.c 2021-03-18 18:22:24.023660076 +0100 +@@ -32,6 +32,8 @@ + #include "log.h" + #include "logrotate.h" + ++struct logInfoHead logs; ++ + #if !defined(GLOB_ABORTED) && defined(GLOB_ABEND) + #define GLOB_ABORTED GLOB_ABEND + #endif diff --git a/recipes-extended/logrotate/logrotate_%.bbappend b/recipes-extended/logrotate/logrotate_%.bbappend new file mode 100644 index 0000000..884c4df --- /dev/null +++ b/recipes-extended/logrotate/logrotate_%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI_append = " file://logrotate-3.15.1-fno-common.patch" diff --git a/recipes-extended/ltp/ltp_%.bbappend b/recipes-extended/ltp/ltp_%.bbappend new file mode 100644 index 0000000..e9ff911 --- /dev/null +++ b/recipes-extended/ltp/ltp_%.bbappend @@ -0,0 +1,4 @@ +# Old versions of ltp assume the compiler defaults to -fcommon +# This can be removed when moving to a newer version of ltp. +# The fix is also needed when building with gcc >= 10. +CFLAGS_append = " -fcommon" -- cgit v1.2.3-54-g00ecf