Skip to contentSkip to conversation

Add -fcommon to BUILD_CFLAGS to a number of recipes

PATCH Superseded [email protected] 4 participants 5 messages May 3, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add -fcommon to BUILD_CFLAGS to a number of recipes

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.

---
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(-)
meta/recipes-bsp/u-boot/u-boot-tools.inc +2 -0
index 8ae290acc6..98c47bf399 100644
@@ -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'
meta/recipes-bsp/u-boot/u-boot.inc +2 -0
index 188e5295cf..5fb1ae856a 100644
@@ -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}'
meta/recipes-devtools/binutils/binutils.inc +2 -0
index 4119960c63..6d590658f8 100644
@@ -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 \
meta/recipes-devtools/libcomps/libcomps_git.bb +1 -0
index 40b60159bc..0e893a9b49 100644
@@ -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"
 
meta/recipes-devtools/pseudo/pseudo.inc +2 -0
index 50e30064bd..751f1815dc 100644
@@ -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/'"
 
meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb +1 -0
index 9bcf026ce2..3ab9b0f2e5 100644
@@ -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"
meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb +1 -1
index fc66821ecc..f600430c41 100644
@@ -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
meta/recipes-kernel/dtc/dtc.inc +2 -1
index 0650e3c82e..6a5b5e5ef1 100644
@@ -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
 
meta/recipes-support/gdbm/gdbm_1.18.1.bb +1 -1
index 5cb7c558b8..5f55ab0ffb 100644
@@ -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
Signature · 1 line
2.26.2
#1 lore raw

✗ patchtest: failure for Add -fcommon to BUILD_CFLAGS to a number of recipes

== Series Details ==

Series: Add -fcommon to BUILD_CFLAGS to a number of recipes
Revision: 1
URL : https://patchwork.openembedded.org/series/23916/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at e44ca998c2)

* Patch            Add -fcommon to BUILD_CFLAGS to a number of recipes
 Issue             Shortlog does not follow expected format [test_shortlog_format] 
  Suggested fix    Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
#2 lore raw
In reply to [email protected]
Quoted 8 lines · Daniel Mack

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.

Thanks for this, its definitely something we need to fid.

The work in the previous patch was fixing gcc 10 target builds, not host. Your patch changes CFLAGS to BUILD_CFLAGS in places which means when we upgrade to gcc 10 things will break.

Basically:

CFLAGS should cover build and target
TARGET_CFLAGS should cover target builds (gcc cross as gcc 10) BUILD_CFLAGS should cover host tools (gcc 10 on the host)

so the correct place should be CFLAGS which should cover target and build (host).

Its possible that some recipes build native and target components in which case they might use CFLAGS and BUILD_CFLAGS. Based on what you say in the commit message, there might be a bug and we might be missing injecting CFLAGS into BUILD_CFLAGS.

I think this is going to need a little more investigation to get it right.

Cheers,

Richard

#3 lore raw

Hi Richard,

Thanks a lot for checking!

Quoted 10 lines · Richard Purdie
Quoted 8 lines · Daniel Mack

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.

Quoted 5 lines

Thanks for this, its definitely something we need to fid.

The work in the previous patch was fixing gcc 10 target builds, not host. Your patch changes CFLAGS to BUILD_CFLAGS in places which means when we upgrade to gcc 10 things will break.

Ah, I wasn't aware that cross-compilation is ready for gcc 10 yet. Okay, that makes sense.

Quoted 8 lines

Basically:

CFLAGS should cover build and target
TARGET_CFLAGS should cover target builds (gcc cross as gcc 10) BUILD_CFLAGS should cover host tools (gcc 10 on the host)

so the correct place should be CFLAGS which should cover target and build (host).

I assumed that, yes, but at least for the recipes I addressed in my patch, that doesn't cut it.

That said, there is also another patch needed for syslinux that doesn't seem to allow injecting CFLAGS externally.

Quoted 7 lines

Its possible that some recipes build native and target components in which case they might use CFLAGS and BUILD_CFLAGS. Based on what you say in the commit message, there might be a bug and we might be missing injecting CFLAGS into BUILD_CFLAGS.

I think this is going to need a little more investigation to get it right.

Alright. I'm happy to respin my patch or test alternative approaches. After all, gcc 10 will have more exposure very soon with more distributions are picking it up as default compiler.

Thanks,
Daniel

#4 lore raw
In reply to [email protected]
Quoted 4 lines · Daniel Mack

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.
...

These are not fixes, just workarounds.
Adding upstream fixes would be preferable to adding workarounds.

meta/recipes-devtools/pseudo/pseudo.inc INSANE_SKIP_${PN}-dbg += "libdir" · line 19

Quoted 9 lines
meta/recipes-devtools/pseudo/pseudo.inc +2 -0
@@ -15,6 +15,8 @@ INSANE_SKIP_${PN}-dbg += "libdir"
 
 PROVIDES += "virtual/fakeroot"
 
+BUILD_CFLAGS += "-fcommon"
+
...

Yocto is upstream for pseudo, is there anything non-trivial required for a proper fix?

meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb SRC_URI = "git://github.com/plougher/squashfs-tools.git;protocol=https \ · line 15

Quoted 8 lines
meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb +1 -0
@@ -12,6 +12,7 @@ SRC_URI = "git://github.com/plougher/squashfs-tools.git;protocol=https \
 
 S = "${WORKDIR}/git/squashfs-tools"
 
+BUILD_CFLAGS += "-fcommon"
...

The upstream fix is a trivial one-liner that should be backported instead:
https://github.com/plougher/squashfs-tools/commit/fe2f5da4b0f8994169c53e84b7cb8a0feefc97b5

cu
Adrian