diff mbox series

[scarthgap,18/25] classes/base: prefer gnu-prefixed HOSTTOOLS

Message ID b797cc729f6e6951baa988e1c04bac9fb8183a1c.1780698373.git.yoann.congal@smile.fr
State New
Headers show
Series [scarthgap,01/25] cargo: set CVE_PRODUCT | expand

Commit Message

Yoann Congal June 5, 2026, 10:34 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

Ubuntu 25.10 has changed the default coreutils implementation from GNU
coreutils to uutils/coreutils. Unfortunately this causes build problems:

  couldn't allocate absolute path for 'null'.
  tail: cannot open 'standard input' for reading: No such file or directory
  install: failed to chown '...': Invalid argument (os error 22)

Clear build failures happen in 'install' and 'tail', but there may be
further breakage.

Luckily, Ubuntu also installs GNU coreutils with a binary prefix of
'gnu', so whilst these issues are root-caused and fixed in either pseudo
or uutils we can prefer the gnu-prefixed binaries where they are present.

[ YOCTO #16028 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 16f2684ebeffa72b5d90525cf9102751b68c298e)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 meta/classes-global/base.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index ecf0fd711f7..edf2149e6f1 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -111,7 +111,11 @@  def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
             # clean up dead symlink
             if os.path.islink(desttool):
                 os.unlink(desttool)
-            srctool = bb.utils.which(path, tool, executable=True)
+
+            # Prefer gnu-prefixed binaries, if available
+            srctool = (bb.utils.which(path, "gnu" + tool, executable=True) or
+                       bb.utils.which(path, tool, executable=True))
+
             # gcc/g++ may link to ccache on some hosts, e.g.,
             # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc)
             # would return /usr/local/bin/ccache/gcc, but what we need is