* [PATCH] libgcc: fix build for baremetal
@ 2026-10-07 5:57 Joerg Vehlow
2026-10-07 20:33 ` [OE-core] " Ryan Eatmon
0 siblings, 1 reply; 3+ messages in thread
From: Joerg Vehlow @ 2026-10-07 5:57 UTC (permalink / raw)
To: openembedded-core; +Cc: denis, richard.purdie, Joerg Vehlow
By removing the erroneous EXTRA_OECONF override in 020d5f0, gcc-cross is now configured with correct sysroot flags, which removes the hosts include directory from the internal paths.
This in turn leads to libgcc not finding libc headers (as it should) and breaks libgcc build.
In order to fix this, libgcc must be built almost like libgcc-initial.
Signed-off-by: Joerg Vehlow <joerg.vehlow@emlix.com>
---
meta/recipes-devtools/gcc/libgcc.inc | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/meta/recipes-devtools/gcc/libgcc.inc b/meta/recipes-devtools/gcc/libgcc.inc
index e92dadf021..93e217f567 100644
--- a/meta/recipes-devtools/gcc/libgcc.inc
+++ b/meta/recipes-devtools/gcc/libgcc.inc
@@ -37,6 +37,16 @@ LICENSE:${PN}-dev = "GPL-3.0-or-later WITH GCC-exception-3.1"
LICENSE:${PN}-dbg = "GPL-3.0-or-later WITH GCC-exception-3.1"
LICENSE:${PN}-src = "GPL-3.0-or-later WITH GCC-exception-3.1"
+# On baremetal there is no libc:
+# configure need limits.h for its sanity check
+# libc dependencies have to be patched out just like in libgcc-initial
+do_configure:prepend:libc-baremetal () {
+ install -d ${STAGING_INCDIR}
+ touch ${STAGING_INCDIR}/limits.h
+ sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars
+ sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile
+}
+
FILES:${PN}-dev = "\
${base_libdir}/libgcc*.so \
${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [OE-core] [PATCH] libgcc: fix build for baremetal
2026-10-07 5:57 [PATCH] libgcc: fix build for baremetal Joerg Vehlow
@ 2026-10-07 20:33 ` Ryan Eatmon
2026-10-08 1:17 ` Denys Dmytriyenko
0 siblings, 1 reply; 3+ messages in thread
From: Ryan Eatmon @ 2026-10-07 20:33 UTC (permalink / raw)
To: joerg.vehlow, openembedded-core; +Cc: denis, richard.purdie
On 10/7/2026 12:57 AM, Joerg Vehlow via lists.openembedded.org wrote:
> By removing the erroneous EXTRA_OECONF override in 020d5f0, gcc-cross is now configured with correct sysroot flags, which removes the hosts include directory from the internal paths.
> This in turn leads to libgcc not finding libc headers (as it should) and breaks libgcc build.
> In order to fix this, libgcc must be built almost like libgcc-initial.
>
> Signed-off-by: Joerg Vehlow <joerg.vehlow@emlix.com>
> ---
> meta/recipes-devtools/gcc/libgcc.inc | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/meta/recipes-devtools/gcc/libgcc.inc b/meta/recipes-devtools/gcc/libgcc.inc
> index e92dadf021..93e217f567 100644
> --- a/meta/recipes-devtools/gcc/libgcc.inc
> +++ b/meta/recipes-devtools/gcc/libgcc.inc
> @@ -37,6 +37,16 @@ LICENSE:${PN}-dev = "GPL-3.0-or-later WITH GCC-exception-3.1"
> LICENSE:${PN}-dbg = "GPL-3.0-or-later WITH GCC-exception-3.1"
> LICENSE:${PN}-src = "GPL-3.0-or-later WITH GCC-exception-3.1"
>
> +# On baremetal there is no libc:
> +# configure need limits.h for its sanity check
> +# libc dependencies have to be patched out just like in libgcc-initial
> +do_configure:prepend:libc-baremetal () {
> + install -d ${STAGING_INCDIR}
> + touch ${STAGING_INCDIR}/limits.h
> + sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars
> + sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile
> +}
> +
> FILES:${PN}-dev = "\
> ${base_libdir}/libgcc*.so \
> ${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
This does fix our build issue. So it should be safe to pick up this
patch and not revert the original change.
--
Ryan Eatmon reatmon@ti.com
-----------------------------------------
Texas Instruments, Inc. - LCPD - MGTS
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [OE-core] [PATCH] libgcc: fix build for baremetal
2026-10-07 20:33 ` [OE-core] " Ryan Eatmon
@ 2026-10-08 1:17 ` Denys Dmytriyenko
0 siblings, 0 replies; 3+ messages in thread
From: Denys Dmytriyenko @ 2026-10-08 1:17 UTC (permalink / raw)
To: Ryan Eatmon; +Cc: joerg.vehlow, openembedded-core, richard.purdie
On Wed, Oct 07, 2026 at 03:33:56PM -0500, Ryan Eatmon wrote:
>
>
> On 10/7/2026 12:57 AM, Joerg Vehlow via lists.openembedded.org wrote:
> >By removing the erroneous EXTRA_OECONF override in 020d5f0, gcc-cross is now configured with correct sysroot flags, which removes the hosts include directory from the internal paths.
> >This in turn leads to libgcc not finding libc headers (as it should) and breaks libgcc build.
> >In order to fix this, libgcc must be built almost like libgcc-initial.
> >
> >Signed-off-by: Joerg Vehlow <joerg.vehlow@emlix.com>
> >---
> > meta/recipes-devtools/gcc/libgcc.inc | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> >diff --git a/meta/recipes-devtools/gcc/libgcc.inc b/meta/recipes-devtools/gcc/libgcc.inc
> >index e92dadf021..93e217f567 100644
> >--- a/meta/recipes-devtools/gcc/libgcc.inc
> >+++ b/meta/recipes-devtools/gcc/libgcc.inc
> >@@ -37,6 +37,16 @@ LICENSE:${PN}-dev = "GPL-3.0-or-later WITH GCC-exception-3.1"
> > LICENSE:${PN}-dbg = "GPL-3.0-or-later WITH GCC-exception-3.1"
> > LICENSE:${PN}-src = "GPL-3.0-or-later WITH GCC-exception-3.1"
> >+# On baremetal there is no libc:
> >+# configure need limits.h for its sanity check
> >+# libc dependencies have to be patched out just like in libgcc-initial
> >+do_configure:prepend:libc-baremetal () {
> >+ install -d ${STAGING_INCDIR}
> >+ touch ${STAGING_INCDIR}/limits.h
> >+ sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars
> >+ sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile
> >+}
> >+
> > FILES:${PN}-dev = "\
> > ${base_libdir}/libgcc*.so \
> > ${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
>
>
> This does fix our build issue. So it should be safe to pick up this
> patch and not revert the original change.
Yes, I can confirm this change fixes all my other test builds for this issue.
--
Denys
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-08 1:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-07 5:57 [PATCH] libgcc: fix build for baremetal Joerg Vehlow
2026-10-07 20:33 ` [OE-core] " Ryan Eatmon
2026-10-08 1:17 ` Denys Dmytriyenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox