All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] core/pkg-toolchain-external: quiesce spurious stderr
@ 2017-08-15 15:03 Yann E. MORIN
  2017-08-15 15:32 ` Arnout Vandecappelle
  0 siblings, 1 reply; 3+ messages in thread
From: Yann E. MORIN @ 2017-08-15 15:03 UTC (permalink / raw)
  To: buildroot

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 truns 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...

We just quiesce the spurious message by consigning stderr to oblivion.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>

---
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(-)

diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 23cdf30b9f..b139638100 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -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 := $(shell dirname $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc) 2>/dev/null)
 endif
 else
 TOOLCHAIN_EXTERNAL_BIN := $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/bin
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] core/pkg-toolchain-external: quiesce spurious stderr
  2017-08-15 15:03 [Buildroot] [PATCH] core/pkg-toolchain-external: quiesce spurious stderr Yann E. MORIN
@ 2017-08-15 15:32 ` Arnout Vandecappelle
  2017-08-15 15:41   ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Arnout Vandecappelle @ 2017-08-15 15:32 UTC (permalink / raw)
  To: buildroot



On 15-08-17 17:03, Yann E. MORIN wrote:
[snip]
> ---
>  toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index 23cdf30b9f..b139638100 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -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 := $(shell dirname $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc) 2>/dev/null)

 How about

TOOLCHAIN_EXTERNAL_BIN := $(dir $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc))

? Or is there some fundamental reason why $(dir ...) doesn't work here?

 For reference: this construct was introduced by Peter in 85dc57f6fd27 when he
added the toolchain wrapper. Before that time, the external-toolchain-from-path
was implicit because it would be used directly in TARGET_CC. The commit contains
no explanation as to why it needs to be 'shell dirname' instead of the make
function 'dir'.

 Regards,
 Arnout
-- 
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] core/pkg-toolchain-external: quiesce spurious stderr
  2017-08-15 15:32 ` Arnout Vandecappelle
@ 2017-08-15 15:41   ` Yann E. MORIN
  0 siblings, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2017-08-15 15:41 UTC (permalink / raw)
  To: buildroot

Arnout, All,

On 2017-08-15 17:32 +0200, Arnout Vandecappelle spake thusly:
> On 15-08-17 17:03, Yann E. MORIN wrote:
> [snip]
> > ---
> >  toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> > index 23cdf30b9f..b139638100 100644
> > --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> > +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> > @@ -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 := $(shell dirname $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc) 2>/dev/null)
> 
>  How about
> 
> TOOLCHAIN_EXTERNAL_BIN := $(dir $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc))
> 
> ? Or is there some fundamental reason why $(dir ...) doesn't work here?

As far as I can see from my tests, it does work.

>  For reference: this construct was introduced by Peter in 85dc57f6fd27 when he
> added the toolchain wrapper. Before that time, the external-toolchain-from-path
> was implicit because it would be used directly in TARGET_CC. The commit contains
> no explanation as to why it needs to be 'shell dirname' instead of the make
> function 'dir'.

Oh, I just CCd you because you were the author of 392b0a26f5, which exhibits
the problem. ;-)

I'll send a v2 using $(dir ...)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-15 15:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-15 15:03 [Buildroot] [PATCH] core/pkg-toolchain-external: quiesce spurious stderr Yann E. MORIN
2017-08-15 15:32 ` Arnout Vandecappelle
2017-08-15 15:41   ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.