Message ID | e2f0809aa4b9d81cf1709a6b82d803a21ea1fac7.1725012294.git.jerome.forissier@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | Miscellaneous fixes | expand |
Hi Jerome, On Fri, 30 Aug 2024 at 04:17, Jerome Forissier <jerome.forissier@linaro.org> wrote: > > When CROSS_COMPILE contains multiple words, HOST_ARCH is not properly > detected and the sandbox build fail. It typically happens when using > ccache. For example: > > $ make sandbox_defconfig > $ make CROSS_COMPILE="ccache x86_64-linux-gnu-" \ > CC="ccache x86_64-linux-gnu-gcc" > [...] > In file included from boot/bootmeth_efi.c:16: > include/efi_default_filename.h:33:2: error: #error Unsupported UEFI architecture > 33 | #error Unsupported UEFI architecture > | ^~~~~ > > A similar error occurs when the build is done via buildman and > ~/.buildman contains: > > [toolchain-wrapper] > wrapper = ccache > > Fix the issue by considering only the last word in $(CROSS_COMPILE). > > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> > Reviewed-by: Peter Robinson <pbrobinson@gmail.com> > Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> > --- > Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) This patch[1] seems to fix the problem you mention, for the CC part at least. For the CROSS_COMPILE bit, why is it valid to use a cross compiler on sandbox? > > diff --git a/Makefile b/Makefile > index f90e48f58a..dc7bdd7942 100644 > --- a/Makefile > +++ b/Makefile > @@ -21,7 +21,7 @@ include include/host_arch.h > ifeq ("", "$(CROSS_COMPILE)") > MK_ARCH="${shell uname -m}" > else > - MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}" > + MK_ARCH="${shell echo ${lastword $(CROSS_COMPILE)} | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}" > endif > unexport HOST_ARCH > ifeq ("x86_64", $(MK_ARCH)) > -- > 2.40.1 > Regards, Simon [1] https://patchwork.ozlabs.org/project/uboot/patch/20240815202424.766778-9-sjg@chromium.org/
On 9/1/24 22:09, Simon Glass wrote: > Hi Jerome, > > On Fri, 30 Aug 2024 at 04:17, Jerome Forissier > <jerome.forissier@linaro.org> wrote: >> >> When CROSS_COMPILE contains multiple words, HOST_ARCH is not properly >> detected and the sandbox build fail. It typically happens when using >> ccache. For example: >> >> $ make sandbox_defconfig >> $ make CROSS_COMPILE="ccache x86_64-linux-gnu-" \ >> CC="ccache x86_64-linux-gnu-gcc" >> [...] >> In file included from boot/bootmeth_efi.c:16: >> include/efi_default_filename.h:33:2: error: #error Unsupported UEFI architecture >> 33 | #error Unsupported UEFI architecture >> | ^~~~~ >> >> A similar error occurs when the build is done via buildman and >> ~/.buildman contains: >> >> [toolchain-wrapper] >> wrapper = ccache >> >> Fix the issue by considering only the last word in $(CROSS_COMPILE). >> >> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> >> Reviewed-by: Peter Robinson <pbrobinson@gmail.com> >> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> >> --- >> Makefile | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > This patch[1] seems to fix the problem you mention, for the CC part at least. No, it fails with buildman: $ git log --oneline -n 1 454b2b2e6ed (HEAD) efi: Use the same filename for all sandbox builds jerome@builder:~/work/u-boot ((454b2b2e6ed...))$ ./tools/buildman/buildman sandbox_noinst Building current source for 1 boards (1 thread, 24 jobs per thread) sandbox: + sandbox_noinst +arch/sandbox/lib/reloc_sandbox_efi.c:10:15: error: operator '==' has no left operand + 10 | #if HOST_ARCH == HOST_ARCH_X86_64 + | ^~ [...] > For the CROSS_COMPILE bit, why is it valid to use a cross compiler on sandbox? Why not? "CROSS_COMPILE=x86_64-linux-gnu-" should result in x86_64-linux-gnu-gcc being used which is equivalent to gcc on a x86_64 system. >> >> diff --git a/Makefile b/Makefile >> index f90e48f58a..dc7bdd7942 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -21,7 +21,7 @@ include include/host_arch.h >> ifeq ("", "$(CROSS_COMPILE)") >> MK_ARCH="${shell uname -m}" >> else >> - MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}" >> + MK_ARCH="${shell echo ${lastword $(CROSS_COMPILE)} | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}" >> endif >> unexport HOST_ARCH >> ifeq ("x86_64", $(MK_ARCH)) >> -- >> 2.40.1 >> > > Regards, > Simon > > [1] https://patchwork.ozlabs.org/project/uboot/patch/20240815202424.766778-9-sjg@chromium.org/ Thanks,
Hi Jerome, On Mon, 2 Sept 2024 at 09:21, Jerome Forissier <jerome.forissier@linaro.org> wrote: > > > > On 9/1/24 22:09, Simon Glass wrote: > > Hi Jerome, > > > > On Fri, 30 Aug 2024 at 04:17, Jerome Forissier > > <jerome.forissier@linaro.org> wrote: > >> > >> When CROSS_COMPILE contains multiple words, HOST_ARCH is not properly > >> detected and the sandbox build fail. It typically happens when using > >> ccache. For example: > >> > >> $ make sandbox_defconfig > >> $ make CROSS_COMPILE="ccache x86_64-linux-gnu-" \ > >> CC="ccache x86_64-linux-gnu-gcc" > >> [...] > >> In file included from boot/bootmeth_efi.c:16: > >> include/efi_default_filename.h:33:2: error: #error Unsupported UEFI architecture > >> 33 | #error Unsupported UEFI architecture > >> | ^~~~~ > >> > >> A similar error occurs when the build is done via buildman and > >> ~/.buildman contains: > >> > >> [toolchain-wrapper] > >> wrapper = ccache > >> > >> Fix the issue by considering only the last word in $(CROSS_COMPILE). > >> > >> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> > >> Reviewed-by: Peter Robinson <pbrobinson@gmail.com> > >> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> > >> --- > >> Makefile | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > > > > This patch[1] seems to fix the problem you mention, for the CC part at least. > > No, it fails with buildman: > > $ git log --oneline -n 1 > 454b2b2e6ed (HEAD) efi: Use the same filename for all sandbox builds > jerome@builder:~/work/u-boot ((454b2b2e6ed...))$ ./tools/buildman/buildman sandbox_noinst > Building current source for 1 boards (1 thread, 24 jobs per thread) > sandbox: + sandbox_noinst > +arch/sandbox/lib/reloc_sandbox_efi.c:10:15: error: operator '==' has no left operand > + 10 | #if HOST_ARCH == HOST_ARCH_X86_64 > + | ^~ > [...] Hmm, I can't really dig into that... > > > For the CROSS_COMPILE bit, why is it valid to use a cross compiler on sandbox? > > Why not? "CROSS_COMPILE=x86_64-linux-gnu-" should result in x86_64-linux-gnu-gcc > being used which is equivalent to gcc on a x86_64 system. Because it isn't a cross compiler, is it? Why is CC= not enough? After all, sandbox never cross-compiles. > > >> > >> diff --git a/Makefile b/Makefile > >> index f90e48f58a..dc7bdd7942 100644 > >> --- a/Makefile > >> +++ b/Makefile > >> @@ -21,7 +21,7 @@ include include/host_arch.h > >> ifeq ("", "$(CROSS_COMPILE)") > >> MK_ARCH="${shell uname -m}" > >> else > >> - MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}" > >> + MK_ARCH="${shell echo ${lastword $(CROSS_COMPILE)} | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}" > >> endif > >> unexport HOST_ARCH > >> ifeq ("x86_64", $(MK_ARCH)) > >> -- > >> 2.40.1 > >> > > > > Regards, > > Simon > > > > [1] https://patchwork.ozlabs.org/project/uboot/patch/20240815202424.766778-9-sjg@chromium.org/ Regards, Simon
diff --git a/Makefile b/Makefile index f90e48f58a..dc7bdd7942 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ include include/host_arch.h ifeq ("", "$(CROSS_COMPILE)") MK_ARCH="${shell uname -m}" else - MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}" + MK_ARCH="${shell echo ${lastword $(CROSS_COMPILE)} | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}" endif unexport HOST_ARCH ifeq ("x86_64", $(MK_ARCH))