Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] barebox-tools: fix host contamination on libyaml
@ 2025-04-07  8:09 Hongxu Jia
  2025-04-07 10:27 ` [OE-core] " Alexander Kanavin
  0 siblings, 1 reply; 4+ messages in thread
From: Hongxu Jia @ 2025-04-07  8:09 UTC (permalink / raw)
  To: openembedded-core

The barebox-tools uses host gcc to build dtc tools, and test the existence
of /usr/include/yaml.h to build with/without libyaml

It caused host contamination if /usr/include/yaml.h existed on host.
| tmp/work/core2-64-wrs-linux/barebox-tools/2025.02.0/barebox-2025.02.0/scripts/
dtc/yamltree.c:9:10: fatal error: yaml.h: No such file or directory
|     9 | #include <yaml.h>

Explicitly define NO_YAML = 1 to disable libyaml for host dtc

No regression because the host dtc was not shipped to target or native sysroot

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/recipes-bsp/barebox/barebox-tools.bb     |  5 +++
 ...01-fix-host-contamination-on-libyaml.patch | 38 +++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-bsp/barebox/files/0001-fix-host-contamination-on-libyaml.patch

diff --git a/meta/recipes-bsp/barebox/barebox-tools.bb b/meta/recipes-bsp/barebox/barebox-tools.bb
index 2a117bc9c08..50660bdf5c8 100644
--- a/meta/recipes-bsp/barebox/barebox-tools.bb
+++ b/meta/recipes-bsp/barebox/barebox-tools.bb
@@ -2,6 +2,10 @@ SUMMARY = "barebox bootloader tools"
 
 require barebox-common.inc
 
+SRC_URI += " \
+    file://0001-fix-host-contamination-on-libyaml.patch \
+"
+
 LICENSE = "GPL-2.0-only"
 
 DEPENDS = "bison-native flex-native libusb1"
@@ -17,6 +21,7 @@ EXTRA_OEMAKE = " \
   CROSS_PKG_CONFIG=pkg-config \
   CC='${CC}' \
   LD='${LD}' \
+  NO_YAML=1 \
   "
 
 do_compile:class-target () {
diff --git a/meta/recipes-bsp/barebox/files/0001-fix-host-contamination-on-libyaml.patch b/meta/recipes-bsp/barebox/files/0001-fix-host-contamination-on-libyaml.patch
new file mode 100644
index 00000000000..e24e47a9cfc
--- /dev/null
+++ b/meta/recipes-bsp/barebox/files/0001-fix-host-contamination-on-libyaml.patch
@@ -0,0 +1,38 @@
+From f6b529fd13af7e05bfed4471d160f1119308db2a Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Mon, 7 Apr 2025 13:13:14 +0800
+Subject: [PATCH] fix host contamination on libyaml
+
+The barebox-tools uses host gcc to build dtc tools, and test the existence
+of /usr/include/yaml.h to build with/without libyaml
+
+It caused host contamination if /usr/include/yaml.h existed on host.
+| tmp/work/core2-64-wrs-linux/barebox-tools/2025.02.0/barebox-2025.02.0/scripts/
+dtc/yamltree.c:9:10: fatal error: yaml.h: No such file or directory
+|     9 | #include <yaml.h>
+
+Explicitly define NO_YAML = 1 to disable libyaml for host dtc
+
+Upstream-Status: Inappropriate [Yocto specific]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ scripts/dtc/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
+index 721e8e2b..b7bfee1b 100644
+--- a/scripts/dtc/Makefile
++++ b/scripts/dtc/Makefile
+@@ -16,7 +16,7 @@ fdtget-objs    += fdtget.o $(libfdt-objs) util.o
+ # Source files need to get at the userspace version of libfdt_env.h to compile
+ HOST_EXTRACFLAGS += -I$(src)/libfdt
+ 
+-ifeq ($(wildcard /usr/include/yaml.h),)
++ifeq ($(NO_YAML), 1)
+ ifneq ($(CHECK_DTBS),)
+ $(error dtc needs libyaml for DT schema validation support. \
+ 	Install the necessary libyaml development package.)
+-- 
+2.34.1
+
-- 
2.34.1



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

end of thread, other threads:[~2025-04-07 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07  8:09 [PATCH] barebox-tools: fix host contamination on libyaml Hongxu Jia
2025-04-07 10:27 ` [OE-core] " Alexander Kanavin
2025-04-07 11:21   ` Enrico Jörns
2025-04-07 15:11     ` hongxu

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