[PATCH v2 02/16] buildman/toolchain.py: set CROSS_COMPILE only if self.cross is set
Jerome Forissier
jerome.forissier at linaro.org
Fri Aug 30 12:16:45 CEST 2024
In MakeEnvironment(), CROSS_COMPILE is defined to be self.cross (with
or without a full path), optionally prefixed by the toolchain wrapper
defined in ~/.buildman. This is fine when self.cross is not empty, but
it doesn't make sense when it is:
- Either there is no wrapper and we end up with an empty CROSS_COMPILE
which is the same as not defining it (the host compiler will be used),
- Or there is a wrapper and CROSS_COMPILE will contain only the wrapper
which obviously is not a valid compiler, hence an error.
Test case:
$ sudo apt install ccache
$ grep -q toolchain-wrapper ~/.buildman || \
printf "[toolchain-wrapper]\nwrapper = ccache\n" >>~/.buildman
$ make mrproper
$ ./tools/buildman/buildman sandbox_noinst
$ ./tools/buildman/buildman sandbox_noinst
Building current source for 1 boards (1 thread, 24 jobs per thread)
sandbox: + sandbox_noinst
+In file included from boot/bootmeth_efi.c:16:
+include/efi_default_filename.h:20:15: error: operator '==' has no left operand
+ 20 | #if HOST_ARCH == HOST_ARCH_X86_64
+ | ^~
[...]
Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
---
tools/buildman/toolchain.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py
index 324ad0e082..ff987a9eea 100644
--- a/tools/buildman/toolchain.py
+++ b/tools/buildman/toolchain.py
@@ -201,10 +201,10 @@ class Toolchain:
if self.override_toolchain:
# We'll use MakeArgs() to provide this
pass
- elif full_path:
+ elif full_path and self.cross:
env[b'CROSS_COMPILE'] = tools.to_bytes(
wrapper + os.path.join(self.path, self.cross))
- else:
+ elif self.cross:
env[b'CROSS_COMPILE'] = tools.to_bytes(wrapper + self.cross)
env[b'PATH'] = tools.to_bytes(self.path) + b':' + env[b'PATH']
--
2.40.1
More information about the U-Boot
mailing list