tools: Override makefile ARCH variable if defined, but empty
PATCH 1/1 tools: Override makefile ARCH variable if defined, but empty
From: Björn Töpel <[email protected]>
There are a number of tools (bpftool, selftests), that require a "bootstrap" build. Here, a bootstrap build is a build host variant of a target. E.g., assume that you're performing a bpftool cross-build on x86 to riscv, a bootstrap build would then be an x86 variant of bpftool. The typical way to perform the host build variant, is to pass "ARCH=" in a sub-make. However, if a variable has been set with a command argument, then ordinary assignments in the makefile are ignored.
This side-effect results in that ARCH, and variables depending on ARCH are not set.
Workaround by overriding ARCH to the host arch, if ARCH is empty.
--- tools/scripts/Makefile.arch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/scripts/Makefile.arch +2 -2
@@ -7,8 +7,8 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/) -ifndef ARCH -ARCH := $(HOSTARCH) +ifeq ($(strip $(ARCH)),) +override ARCH := $(HOSTARCH) endif SRCARCH := $(ARCH)
base-commit: 7758b206117dab9894f0bcb8333f8e4731c5065a
Signature · 1 line
2.45.2
Quoted 11 lines · Björn Töpel
From: Björn Töpel <[email protected]>
There are a number of tools (bpftool, selftests), that require a "bootstrap" build. Here, a bootstrap build is a build host variant of a target. E.g., assume that you're performing a bpftool cross-build on x86 to riscv, a bootstrap build would then be an x86 variant of bpftool. The typical way to perform the host build variant, is to pass "ARCH=" in a sub-make. However, if a variable has been set with a command argument, then ordinary assignments in the makefile are ignored.
Quoted 7 lines
This side-effect results in that ARCH, and variables depending on ARCH are not set.
Workaround by overriding ARCH to the host arch, if ARCH is empty.
Fixes 8859b0da5aac ("tools/bpftool: Fix cross-build")Signed-off-by Björn Töpel <[email protected]>
Quoted 24 lines
--- tools/scripts/Makefile.arch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/scripts/Makefile.arch +2
-2@@ -7,8 +7,8 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/) -ifndef ARCH -ARCH := $(HOSTARCH) +ifeq ($(strip $(ARCH)),) +override ARCH := $(HOSTARCH) endif SRCARCH := $(ARCH)base-commit:
7758b206117dab9894f0bcb8333f8e4731c5065aSignature · 1 line
2.45.2
Alexandre Ghiti
Tested-byHi Björn,
Quoted 41 lines · Jean-Philippe Brucker
Quoted 11 lines · Björn Töpel
From: Björn Töpel <[email protected]>
There are a number of tools (bpftool, selftests), that require a "bootstrap" build. Here, a bootstrap build is a build host variant of a target. E.g., assume that you're performing a bpftool cross-build on x86 to riscv, a bootstrap build would then be an x86 variant of bpftool. The typical way to perform the host build variant, is to pass "ARCH=" in a sub-make. However, if a variable has been set with a command argument, then ordinary assignments in the makefile are ignored.
Quoted 7 lines
This side-effect results in that ARCH, and variables depending on ARCH are not set.
Workaround by overriding ARCH to the host arch, if ARCH is empty.
Fixes 8859b0da5aac ("tools/bpftool: Fix cross-build")Signed-off-by Björn Töpel <[email protected]>Reviewed-by Jean-Philippe Brucker <[email protected]>Quoted 18 lines
--- tools/scripts/Makefile.arch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/scripts/Makefile.arch +2
-2@@ -7,8 +7,8 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/) -ifndef ARCH -ARCH := $(HOSTARCH) +ifeq ($(strip $(ARCH)),) +override ARCH := $(HOSTARCH) endif
Quoted 6 lines
Quoted 6 lines
tools/scripts/Makefile.arch +0
-0SRCARCH := $(ARCH)base-commit:
7758b206117dab9894f0bcb8333f8e4731c5065a--
2.45.2
You can add:
Thanks,
Alex
Quoted 11 lines · Björn Töpel
From: Björn Töpel <[email protected]>
There are a number of tools (bpftool, selftests), that require a "bootstrap" build. Here, a bootstrap build is a build host variant of a target. E.g., assume that you're performing a bpftool cross-build on x86 to riscv, a bootstrap build would then be an x86 variant of bpftool. The typical way to perform the host build variant, is to pass "ARCH=" in a sub-make. However, if a variable has been set with a command argument, then ordinary assignments in the makefile are ignored.
Quoted 7 lines
This side-effect results in that ARCH, and variables depending on ARCH are not set.
Workaround by overriding ARCH to the host arch, if ARCH is empty.
Fixes 8859b0da5aac ("tools/bpftool: Fix cross-build")Signed-off-by Björn Töpel <[email protected]>
Arnaldo/Palmer/Quentin:
A bit unsure what tree this patch should go. It's very important for the RISC-V builds, so maybe via Palmer's RISC-V tree?
Opinions? Just want to make sure it doesn't fall between any chairs! :-)
Björn
Namhyung Kim
Reviewed-byQuoted 13 lines · Björn Töpel
Quoted 11 lines · Björn Töpel
From: Björn Töpel <[email protected]>
There are a number of tools (bpftool, selftests), that require a "bootstrap" build. Here, a bootstrap build is a build host variant of a target. E.g., assume that you're performing a bpftool cross-build on x86 to riscv, a bootstrap build would then be an x86 variant of bpftool. The typical way to perform the host build variant, is to pass "ARCH=" in a sub-make. However, if a variable has been set with a command argument, then ordinary assignments in the makefile are ignored.
Quoted 7 lines
Quoted 7 lines
This side-effect results in that ARCH, and variables depending on ARCH are not set.
Workaround by overriding ARCH to the host arch, if ARCH is empty.
Fixes 8859b0da5aac ("tools/bpftool: Fix cross-build")Signed-off-by Björn Töpel <[email protected]>
Quoted 5 lines
Arnaldo/Palmer/Quentin:
A bit unsure what tree this patch should go. It's very important for the RISC-V builds, so maybe via Palmer's RISC-V tree?
I think it'd be best to route this through the bpf tree as it seems the main target is bpftool. But given the size and the scope of the change, it should be fine with perf-tools or RISC-V tree.
Thanks,
Namhyung
Quoted 6 lines
Opinions? Just want to make sure it doesn't fall between any chairs! :-)
Björn
Quentin Monnet
Acked-by2024-11-20 22:04 UTC-0800 ~ Namhyung Kim <[email protected]>
Quoted 17 lines · Björn Töpel
Quoted 16 lines
Quoted 14 lines · Björn Töpel
From: Björn Töpel <[email protected]>
There are a number of tools (bpftool, selftests), that require a "bootstrap" build. Here, a bootstrap build is a build host variant of a target. E.g., assume that you're performing a bpftool cross-build on x86 to riscv, a bootstrap build would then be an x86 variant of bpftool. The typical way to perform the host build variant, is to pass "ARCH=" in a sub-make. However, if a variable has been set with a command argument, then ordinary assignments in the makefile are ignored.
This side-effect results in that ARCH, and variables depending on ARCH are not set.
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Workaround by overriding ARCH to the host arch, if ARCH is empty.
Fixes 8859b0da5aac ("tools/bpftool: Fix cross-build")Signed-off-by Björn Töpel <[email protected]>Reviewed-by Namhyung Kim <[email protected]>
Quoted 8 lines
Quoted 4 lines
Arnaldo/Palmer/Quentin:
A bit unsure what tree this patch should go. It's very important for the RISC-V builds, so maybe via Palmer's RISC-V tree?
I think it'd be best to route this through the bpf tree as it seems the main target is bpftool. But given the size and the scope of the change, it should be fine with perf-tools or RISC-V tree.
The bpf tree would make sense to me as well (but I don't merge patches myself; let me Cc BPF maintainers).
Quentin
Quoted 35 lines · Quentin Monnet
2024-11-20 22:04 UTC-0800 ~ Namhyung Kim <[email protected]>
Quoted 17 lines · Björn Töpel
Quoted 16 lines
Quoted 14 lines · Björn Töpel
From: Björn Töpel <[email protected]>
There are a number of tools (bpftool, selftests), that require a "bootstrap" build. Here, a bootstrap build is a build host variant of a target. E.g., assume that you're performing a bpftool cross-build on x86 to riscv, a bootstrap build would then be an x86 variant of bpftool. The typical way to perform the host build variant, is to pass "ARCH=" in a sub-make. However, if a variable has been set with a command argument, then ordinary assignments in the makefile are ignored.
This side-effect results in that ARCH, and variables depending on ARCH are not set.
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Workaround by overriding ARCH to the host arch, if ARCH is empty.
Fixes 8859b0da5aac ("tools/bpftool: Fix cross-build")Signed-off-by Björn Töpel <[email protected]>Reviewed-by Namhyung Kim <[email protected]>Acked-by Quentin Monnet <[email protected]>Quoted 5 lines
Quoted 4 lines
Arnaldo/Palmer/Quentin:
A bit unsure what tree this patch should go. It's very important for the RISC-V builds, so maybe via Palmer's RISC-V tree?
Quoted 7 lines
Quoted 3 lines
I think it'd be best to route this through the bpf tree as it seems the main target is bpftool. But given the size and the scope of the change, it should be fine with perf-tools or RISC-V tree.
The bpf tree would make sense to me as well (but I don't merge patches myself; let me Cc BPF maintainers).
Doesn't seem like this file is owned by anyone specific, I guess it's fine to route it through BPF due to bpftool? Should this be bpf or bpf-next? Also, please resend targeting the right tree, so BPF CI can test this.
Quoted 2 lines
Quentin