core/pkg-toolchain-external: quiesce spurious stderr
PATCH v2 1/1 core/pkg-toolchain-external: quiesce spurious stderr
Since 392b0a26f5 (toolchain-external: default BR2_TOOLCHAIN_EXTERNAL_PATH to empty), calling 'make clean' or similar can yield a spurious stderr message:
dirname: missing operand
Try 'dirname --help' for more information.
Which is definitely baffling and unsettling...
It turns out that it is pretty trivial to reproduce, and this defconfig is just enough:
$ cat my-defconfig
BR2_TOOLCHAIN_EXTERNAL=y$ make BR2_DEFCONFIG=$(pwd)/my-defconfig defconfig
$ make clean
dirname: missing operand
Try 'dirname --help' for more information.
[--snip--]This is because the cross-compiler is not found in the PATH (and for good reasons, I don't have it in the PATH, not even at all).
So, when the cross-compiler is not found in the path, we simply continue as if all was good, and postpone the check to much later, when we try to copy the toolchain libs...
So, use a make construct rather than calling to the shell: $(dir ...) does not whine if passed nothing.
---
Changes v1 -> v2:
- use $(dir ...) instead of $(shell dirname ...) (Arnout)
---
Note: it would be good to error out at this point, but as explained in the commit log, we already error out a bit later when copying the toolchain libs, and the check is easier done then than what we could do here, because we'd have to guard with BR_BUILDING, and for good measure, we'd also have to do the check when the tooolchain dir is actually specified. But then this would duplicate the existing (but later) checks, so we just don't bother...
--- toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
toolchain/toolchain-external/pkg-toolchain-external.mk +1 -1
@@ -74,7 +74,7 @@ endif ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_DIR),) ifneq ($(TOOLCHAIN_EXTERNAL_PREFIX),) # if no path set, figure it out from path -TOOLCHAIN_EXTERNAL_BIN := $(shell dirname $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc)) +TOOLCHAIN_EXTERNAL_BIN := $(dir $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc)) endif else TOOLCHAIN_EXTERNAL_BIN := $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/bin
Signature · 1 line
2.11.0
PATCH v2 1/1 core/pkg-toolchain-external: quiesce spurious stderr
Quoted 28 lines · Yann E. MORIN
Since
392b0a26f5(toolchain-external: defaultBR2_TOOLCHAIN_EXTERNAL_PATHto empty), calling 'make clean' or similar can yield a spurious stderr message:
dirname: missing operand
Try 'dirname --help' for more information.Which is definitely baffling and unsettling...
It turns out that it is pretty trivial to reproduce, and this defconfig is just enough:
$ cat my-defconfig BR2_TOOLCHAIN_EXTERNAL=y$ make BR2_DEFCONFIG=$(pwd)/my-defconfig defconfig$ make clean dirname: missing operand Try 'dirname --help' for more information. [--snip--]This is because the cross-compiler is not found in the PATH (and for good reasons, I don't have it in the PATH, not even at all).
So, when the cross-compiler is not found in the path, we simply continue as if all was good, and postpone the check to much later, when we try to copy the toolchain libs...
Quoted 7 lines
So, use a make construct rather than calling to the shell: $(dir ...) does not whine if passed nothing.
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Arnout Vandecappelle <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Thomas Petazzoni
AppliedPATCH v2 1/1 core/pkg-toolchain-external: quiesce spurious stderr
In reply to Yann E. MORINHello,
Quoted 31 lines · Yann E. MORIN
Since
392b0a26f5(toolchain-external: defaultBR2_TOOLCHAIN_EXTERNAL_PATHto empty), calling 'make clean' or similar can yield a spurious stderr message:
dirname: missing operand
Try 'dirname --help' for more information.Which is definitely baffling and unsettling...
It turns out that it is pretty trivial to reproduce, and this defconfig is just enough:
$ cat my-defconfig BR2_TOOLCHAIN_EXTERNAL=y$ make BR2_DEFCONFIG=$(pwd)/my-defconfig defconfig$ make clean dirname: missing operand Try 'dirname --help' for more information. [--snip--]This is because the cross-compiler is not found in the PATH (and for good reasons, I don't have it in the PATH, not even at all).
So, when the cross-compiler is not found in the path, we simply continue as if all was good, and postpone the check to much later, when we try to copy the toolchain libs...
So, use a make construct rather than calling to the shell: $(dir ...) does not whine if passed nothing.
Quoted 8 lines
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Arnout Vandecappelle <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>---
Changes v1 -> v2:
- use $(dir ...) instead of $(shell dirname ...) (Arnout)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com