[PATCH] Add -fcommon to BUILD_CFLAGS to a number of recipes

daniel
2020-05-03T08:26:50Z

When building on a gcc 10 enabled host distribution (such as Fedora 32),
a number of recipies need explicit treatment to enable '-fcommon' in
BUILD_CFLAGS. There might be more of those fixes needed.

Commit 46827b8616 ("recipes: Use -fcommon explicitly") already addressed
that for some places, but tweaking CFLAGS doesn't seem to suffice.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
If there is a better way of doing this, please let me know. I needed
this patch to get my setup working again to F32.

meta/recipes-bsp/u-boot/u-boot-tools.inc | 2 ++
meta/recipes-bsp/u-boot/u-boot.inc | 2 ++
meta/recipes-devtools/binutils/binutils.inc | 2 ++
meta/recipes-devtools/libcomps/libcomps_git.bb | 1 +
meta/recipes-devtools/pseudo/pseudo.inc | 2 ++
meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb | 1 +
meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb | 2 +-
meta/recipes-kernel/dtc/dtc.inc | 3 ++-
meta/recipes-support/gdbm/gdbm_1.18.1.bb | 2 +-
9 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-bsp/u-boot/u-boot-tools.inc b/meta/recipes-bsp/u-boot/u-boot-tools.inc
index 8ae290acc6..98c47bf399 100644
--- a/meta/recipes-bsp/u-boot/u-boot-tools.inc
+++ b/meta/recipes-bsp/u-boot/u-boot-tools.inc
@@ -11,6 +11,8 @@ RPROVIDES_${PN}-mkimage = "u-boot-mkimage"
RREPLACES_${PN}-mkimage = "u-boot-mkimage"
RCONFLICTS_${PN}-mkimage = "u-boot-mkimage"

+BUILD_CFLAGS += "-fcommon"
+
EXTRA_OEMAKE_class-target = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
EXTRA_OEMAKE_class-native = 'CC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
EXTRA_OEMAKE_class-nativesdk = 'CROSS_COMPILE="${HOST_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
diff --git a/meta/recipes-bsp/u-boot/u-boot.inc b/meta/recipes-bsp/u-boot/u-boot.inc
index 188e5295cf..5fb1ae856a 100644
--- a/meta/recipes-bsp/u-boot/u-boot.inc
+++ b/meta/recipes-bsp/u-boot/u-boot.inc
@@ -9,6 +9,8 @@ inherit uboot-config uboot-extlinux-config uboot-sign deploy cml1 python3native

DEPENDS += "swig-native"

+BUILD_CFLAGS += "-fcommon"
+
EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" V=1'
EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"'
EXTRA_OEMAKE += 'STAGING_INCDIR=${STAGING_INCDIR_NATIVE} STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}'
diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc
index 4119960c63..6d590658f8 100644
--- a/meta/recipes-devtools/binutils/binutils.inc
+++ b/meta/recipes-devtools/binutils/binutils.inc
@@ -71,6 +71,8 @@ python do_package_prepend() {

B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"

+BUILD_CFLAGS += "-fcommon"
+
EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
--disable-werror \
--enable-deterministic-archives \
diff --git a/meta/recipes-devtools/libcomps/libcomps_git.bb b/meta/recipes-devtools/libcomps/libcomps_git.bb
index 40b60159bc..0e893a9b49 100644
--- a/meta/recipes-devtools/libcomps/libcomps_git.bb
+++ b/meta/recipes-devtools/libcomps/libcomps_git.bb
@@ -17,6 +17,7 @@ inherit cmake distutils3-base

DEPENDS += "libxml2 expat libcheck"

+BUILD_CFLAGS += "-fcommon"
EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3"
OECMAKE_SOURCEPATH = "${S}/libcomps"

diff --git a/meta/recipes-devtools/pseudo/pseudo.inc b/meta/recipes-devtools/pseudo/pseudo.inc
index 50e30064bd..751f1815dc 100644
--- a/meta/recipes-devtools/pseudo/pseudo.inc
+++ b/meta/recipes-devtools/pseudo/pseudo.inc
@@ -15,6 +15,8 @@ INSANE_SKIP_${PN}-dbg += "libdir"

PROVIDES += "virtual/fakeroot"

+BUILD_CFLAGS += "-fcommon"
+
MAKEOPTS = ""
MAKEOPTS_class-native = "'RPATH=-Wl,--rpath=XORIGIN/../../../sqlite3-native/usr/lib/'"

diff --git a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
index 9bcf026ce2..3ab9b0f2e5 100644
--- a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
+++ b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
@@ -12,6 +12,7 @@ SRC_URI = "git://github.com/plougher/squashfs-tools.git;protocol=https \

S = "${WORKDIR}/git/squashfs-tools"

+BUILD_CFLAGS += "-fcommon"
EXTRA_OEMAKE = "${PACKAGECONFIG_CONFARGS}"

PACKAGECONFIG ??= "gzip xz lzo lz4 lzma xattr reproducible"
diff --git a/meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb b/meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb
index fc66821ecc..f600430c41 100644
--- a/meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb
+++ b/meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb
@@ -21,7 +21,7 @@ inherit autotools pkgconfig

EXTRA_OECONF = "--disable-gssapi"

-CFLAGS += "-fcommon"
+BUILD_CFLAGS += "-fcommon"

do_install_append() {
chown root:root ${D}${sysconfdir}/netconfig
diff --git a/meta/recipes-kernel/dtc/dtc.inc b/meta/recipes-kernel/dtc/dtc.inc
index 0650e3c82e..6a5b5e5ef1 100644
--- a/meta/recipes-kernel/dtc/dtc.inc
+++ b/meta/recipes-kernel/dtc/dtc.inc
@@ -10,7 +10,8 @@ SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git \
"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"

-EXTRA_OEMAKE='NO_PYTHON=1 PREFIX="${prefix}" LIBDIR="${libdir}" DESTDIR="${D}"'
+EXTRA_CFLAGS += "-fcommon"
+EXTRA_OEMAKE='NO_PYTHON=1 PREFIX="${prefix}" LIBDIR="${libdir}" DESTDIR="${D}" EXTRA_CFLAGS="${EXTRA_CFLAGS}"'

inherit pkgconfig

diff --git a/meta/recipes-support/gdbm/gdbm_1.18.1.bb b/meta/recipes-support/gdbm/gdbm_1.18.1.bb
index 5cb7c558b8..5f55ab0ffb 100644
--- a/meta/recipes-support/gdbm/gdbm_1.18.1.bb
+++ b/meta/recipes-support/gdbm/gdbm_1.18.1.bb
@@ -23,7 +23,7 @@ CACHED_CONFIGUREVARS += "ac_cv_lib_ndbm_main=no ac_cv_lib_dbm_main=no"

BBCLASSEXTEND = "native nativesdk"

-CFLAGS += "-fcommon"
+BUILD_CFLAGS += "-fcommon"

do_install_append () {
# Create a symlink to ndbm.h and gdbm.h in include/gdbm to let other packages to find
--
2.26.2