public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 1/5] libcap: Pass OE defined BUILD_CC and BUILD_LDFLAGS
@ 2025-10-22  5:08 Khem Raj
  2025-10-22  5:08 ` [PATCH 2/5] gcc: Pin native toolchain to GCC as well Khem Raj
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Khem Raj @ 2025-10-22  5:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

This ensures that, native pieces in target builds
are build with correct flags to be able to run on build host

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...Add-build-ldflags-to-_makenames-rule.patch | 29 +++++++++++++++++++
 meta/recipes-support/libcap/libcap_2.76.bb    |  6 +++-
 2 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/libcap/files/0001-libcap-Add-build-ldflags-to-_makenames-rule.patch

diff --git a/meta/recipes-support/libcap/files/0001-libcap-Add-build-ldflags-to-_makenames-rule.patch b/meta/recipes-support/libcap/files/0001-libcap-Add-build-ldflags-to-_makenames-rule.patch
new file mode 100644
index 00000000000..10ddf649359
--- /dev/null
+++ b/meta/recipes-support/libcap/files/0001-libcap-Add-build-ldflags-to-_makenames-rule.patch
@@ -0,0 +1,29 @@
+From e52d3232882c263f5bd4b1980195ac633d706a53 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 21 Oct 2025 18:27:51 -0700
+Subject: [PATCH] libcap: Add build ldflags to _makenames rule
+
+its calling compiler and linker in single step
+ensure that build ldflags are respected as it
+might have important information like which runtime
+to use.
+
+Upstream-Status: Backport [https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=c3ddf45d9afaab85d3b7db0dc7bfd1aafb8fde50]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ libcap/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libcap/Makefile b/libcap/Makefile
+index e90a950..f0eb87e 100644
+--- a/libcap/Makefile
++++ b/libcap/Makefile
+@@ -80,7 +80,7 @@ $(PSXTITLE).pc: $(PSXTITLE).pc.in
+ 		$< >$@
+
+ _makenames: _makenames.c cap_names.list.h
+-	$(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
++	$(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@ $(BUILD_LDFLAGS)
+
+ cap_names.h: _makenames
+ 	./_makenames > cap_names.h
diff --git a/meta/recipes-support/libcap/libcap_2.76.bb b/meta/recipes-support/libcap/libcap_2.76.bb
index c842246fc09..27093ff3e72 100644
--- a/meta/recipes-support/libcap/libcap_2.76.bb
+++ b/meta/recipes-support/libcap/libcap_2.76.bb
@@ -12,7 +12,9 @@ LIC_FILES_CHKSUM = "file://License;md5=2965a646645b72ecee859b43c592dcaa \
 
 DEPENDS = "hostperl-runtime-native gperf-native"
 
-SRC_URI = "${KERNELORG_MIRROR}/linux/libs/security/linux-privs/${BPN}2/${BPN}-${PV}.tar.xz"
+SRC_URI = "${KERNELORG_MIRROR}/linux/libs/security/linux-privs/${BPN}2/${BPN}-${PV}.tar.xz \
+           file://0001-libcap-Add-build-ldflags-to-_makenames-rule.patch \
+		   "
 SRC_URI:append:class-nativesdk = " \
            file://0001-nativesdk-libcap-Raise-the-size-of-arrays-containing.patch \
            "
@@ -37,6 +39,8 @@ EXTRA_OEMAKE = " \
 do_compile() {
 	oe_runmake \
 		AR="${AR}" \
+		BUILD_CC="${BUILD_CC}" \
+		BUILD_LDFLAGS="${BUILD_LDFLAGS}" \
 		CC="${CC}" \
 		RANLIB="${RANLIB}" \
 		OBJCOPY="${OBJCOPY}"


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/5] gcc: Pin native toolchain to GCC as well
  2025-10-22  5:08 [PATCH 1/5] libcap: Pass OE defined BUILD_CC and BUILD_LDFLAGS Khem Raj
@ 2025-10-22  5:08 ` Khem Raj
  2025-10-22  5:08 ` [PATCH 3/5] pseudo: Pin native compiler to gcc " Khem Raj
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Khem Raj @ 2025-10-22  5:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

GCC is not buildable with clang and when using clang
for native compiler this fails to build native parts

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-15.2.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-devtools/gcc/gcc-15.2.inc b/meta/recipes-devtools/gcc/gcc-15.2.inc
index 575987b6433..d178b254878 100644
--- a/meta/recipes-devtools/gcc/gcc-15.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-15.2.inc
@@ -11,6 +11,7 @@ BINV = "15.2.0"
 FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:"
 
 TOOLCHAIN = "gcc"
+TOOLCHAIN_NATIVE = "gcc"
 
 DEPENDS =+ "mpfr gmp libmpc zlib zstd flex-native"
 NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native"


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] pseudo: Pin native compiler to gcc as well
  2025-10-22  5:08 [PATCH 1/5] libcap: Pass OE defined BUILD_CC and BUILD_LDFLAGS Khem Raj
  2025-10-22  5:08 ` [PATCH 2/5] gcc: Pin native toolchain to GCC as well Khem Raj
@ 2025-10-22  5:08 ` Khem Raj
  2025-10-22  5:08 ` [PATCH 4/5] pkgconfig: Always use gcc for native compiler Khem Raj
  2025-10-22  5:08 ` [PATCH 5/5] elfutils: " Khem Raj
  3 siblings, 0 replies; 9+ messages in thread
From: Khem Raj @ 2025-10-22  5:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

pseudo does not build with clang

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/pseudo/pseudo_git.bb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index e10abd126bf..c18318bd538 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -31,3 +31,4 @@ COMPATIBLE_HOST:libc-musl = 'null'
 #| ./ports/linux/pseudo_wrappers.c:80:57: error: use of unknown builtin '__builtin_apply_args' [-Wimplicit-function-declaration]
 #|         void *res = __builtin_apply((void (*)()) real_syscall, __builtin_apply_args(), sizeof(long) * 7);
 TOOLCHAIN = "gcc"
+TOOLCHAIN_NATIVE = "gcc"


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] pkgconfig: Always use gcc for native compiler
  2025-10-22  5:08 [PATCH 1/5] libcap: Pass OE defined BUILD_CC and BUILD_LDFLAGS Khem Raj
  2025-10-22  5:08 ` [PATCH 2/5] gcc: Pin native toolchain to GCC as well Khem Raj
  2025-10-22  5:08 ` [PATCH 3/5] pseudo: Pin native compiler to gcc " Khem Raj
@ 2025-10-22  5:08 ` Khem Raj
  2025-10-23 12:16   ` [OE-core] " Ross Burton
  2025-10-22  5:08 ` [PATCH 5/5] elfutils: " Khem Raj
  3 siblings, 1 reply; 9+ messages in thread
From: Khem Raj @ 2025-10-22  5:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

It has build errors with clang especially on native builds.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/pkgconfig/pkgconfig_git.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
index f537c635ef2..103b3e042a0 100644
--- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
+++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
@@ -20,6 +20,8 @@ SRC_URI = "git://gitlab.freedesktop.org/pkg-config/pkg-config.git;branch=master;
 
 inherit autotools
 
+TOOLCHAIN_NATIVE = "gcc"
+
 # Because of a faulty test, the current auto mode always evaluates to no,
 # so just continue that behaviour.
 #


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] elfutils: Always use gcc for native compiler
  2025-10-22  5:08 [PATCH 1/5] libcap: Pass OE defined BUILD_CC and BUILD_LDFLAGS Khem Raj
                   ` (2 preceding siblings ...)
  2025-10-22  5:08 ` [PATCH 4/5] pkgconfig: Always use gcc for native compiler Khem Raj
@ 2025-10-22  5:08 ` Khem Raj
  2025-10-23 12:16   ` [OE-core] " Ross Burton
  3 siblings, 1 reply; 9+ messages in thread
From: Khem Raj @ 2025-10-22  5:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

Clang can not compile full elfutils for build host.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/elfutils/elfutils_0.193.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-devtools/elfutils/elfutils_0.193.bb b/meta/recipes-devtools/elfutils/elfutils_0.193.bb
index 29a8ee5af63..b4498fa76ed 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.193.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.193.bb
@@ -33,6 +33,8 @@ EXTRA_OECONF = "--program-prefix=eu-"
 # Only used at runtime for make check but we want deterministic makefiles for ptest so hardcode
 CACHED_CONFIGUREVARS += "ac_cv_prog_HAVE_BUNZIP2=yes"
 
+TOOLCHAIN_NATIVE = "gcc"
+
 BUILD_CFLAGS += "-Wno-error=stringop-overflow"
 
 DEPENDS_BZIP2 = "bzip2-replacement-native"


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH 4/5] pkgconfig: Always use gcc for native compiler
  2025-10-22  5:08 ` [PATCH 4/5] pkgconfig: Always use gcc for native compiler Khem Raj
@ 2025-10-23 12:16   ` Ross Burton
  2025-10-24  2:24     ` Khem Raj
  0 siblings, 1 reply; 9+ messages in thread
From: Ross Burton @ 2025-10-23 12:16 UTC (permalink / raw)
  To: raj.khem@gmail.com; +Cc: openembedded-core@lists.openembedded.org

On 22 Oct 2025, at 06:08, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> 
> It has build errors with clang especially on native builds.
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> meta/recipes-devtools/pkgconfig/pkgconfig_git.bb | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> index f537c635ef2..103b3e042a0 100644
> --- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> +++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> @@ -20,6 +20,8 @@ SRC_URI = "git://gitlab.freedesktop.org/pkg-config/pkg-config.git;branch=master;
> 
> inherit autotools
> 
> +TOOLCHAIN_NATIVE = "gcc"

How does target pkgconfig build with clang, but not pkgconfig-native?

Ross



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH 5/5] elfutils: Always use gcc for native compiler
  2025-10-22  5:08 ` [PATCH 5/5] elfutils: " Khem Raj
@ 2025-10-23 12:16   ` Ross Burton
  2025-10-24  2:25     ` Khem Raj
  0 siblings, 1 reply; 9+ messages in thread
From: Ross Burton @ 2025-10-23 12:16 UTC (permalink / raw)
  To: raj.khem@gmail.com; +Cc: openembedded-core@lists.openembedded.org

On 22 Oct 2025, at 06:08, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> +TOOLCHAIN_NATIVE = “gcc”

Can you add a comment showing what the error is so that we can test it in the future?

Ross

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH 4/5] pkgconfig: Always use gcc for native compiler
  2025-10-23 12:16   ` [OE-core] " Ross Burton
@ 2025-10-24  2:24     ` Khem Raj
  0 siblings, 0 replies; 9+ messages in thread
From: Khem Raj @ 2025-10-24  2:24 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-core@lists.openembedded.org

On Thu, Oct 23, 2025 at 5:17 AM Ross Burton <Ross.Burton@arm.com> wrote:
>
> On 22 Oct 2025, at 06:08, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> >
> > It has build errors with clang especially on native builds.
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> > meta/recipes-devtools/pkgconfig/pkgconfig_git.bb | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> > index f537c635ef2..103b3e042a0 100644
> > --- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> > +++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> > @@ -20,6 +20,8 @@ SRC_URI = "git://gitlab.freedesktop.org/pkg-config/pkg-config.git;branch=master;
> >
> > inherit autotools
> >
> > +TOOLCHAIN_NATIVE = "gcc"
>
> How does target pkgconfig build with clang, but not pkgconfig-native?

We do not build them the same way, e.g. native is built with
--with-internal-glib and that causes additional sources to compile
I did not note down the compiler error which I should have noted the
error messages but the build is not gone. I will re-create the env.

>
> Ross
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH 5/5] elfutils: Always use gcc for native compiler
  2025-10-23 12:16   ` [OE-core] " Ross Burton
@ 2025-10-24  2:25     ` Khem Raj
  0 siblings, 0 replies; 9+ messages in thread
From: Khem Raj @ 2025-10-24  2:25 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-core@lists.openembedded.org

On Thu, Oct 23, 2025 at 5:17 AM Ross Burton <Ross.Burton@arm.com> wrote:
>
> On 22 Oct 2025, at 06:08, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> > +TOOLCHAIN_NATIVE = “gcc”
>
> Can you add a comment showing what the error is so that we can test it in the future?

sure. I think it will be good to fix them but until then some comments wont hurt

>
> Ross


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-10-24  2:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22  5:08 [PATCH 1/5] libcap: Pass OE defined BUILD_CC and BUILD_LDFLAGS Khem Raj
2025-10-22  5:08 ` [PATCH 2/5] gcc: Pin native toolchain to GCC as well Khem Raj
2025-10-22  5:08 ` [PATCH 3/5] pseudo: Pin native compiler to gcc " Khem Raj
2025-10-22  5:08 ` [PATCH 4/5] pkgconfig: Always use gcc for native compiler Khem Raj
2025-10-23 12:16   ` [OE-core] " Ross Burton
2025-10-24  2:24     ` Khem Raj
2025-10-22  5:08 ` [PATCH 5/5] elfutils: " Khem Raj
2025-10-23 12:16   ` [OE-core] " Ross Burton
2025-10-24  2:25     ` Khem Raj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox