* [Buildroot] [PATCH] make printvars: avoid invalid calls when arguments are missing
@ 2019-02-23 16:11 Martin Kepplinger
2019-02-23 16:41 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Martin Kepplinger @ 2019-02-23 16:11 UTC (permalink / raw)
To: buildroot
during "make printvars > compare" the following error occurs -
reproducible after any "make *_defconfig":
/bin/bash: support/dependencies/check-host-.sh: no such file or directory
/bin/bash: -c: line 0: syntax error: ')' unexpected
/bin/bash: -c: line 0: `set -e; TMP="$(mktemp)"; if () >/dev/null 2>&1; then echo ""; else echo ""; fi;
which is 2 errors, resulting from $(1) arguments being empty, but
called anyway. So this simply skips parts when otherwise we would exit
when wrong scripts are tried be executed.
When comparing the outputs, this _adds_ "host-tar host-xz" to all packages'
*_DEPENDENCIES where until now only "host-lzip" is listed.
Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
---
Hi,
This has been reported by me and others before and this patch might
as well _not_ be the real fix :) I guess $(1) should just never become
empty in the first place, right?
Anyways, I let you decide whether this fixes things (add host-tar dependency
for every package) and how much sense this makes.
Maybe you know what's going on.
thanks,
martin
package/Makefile.in | 2 ++
support/dependencies/dependencies.mk | 2 ++
2 files changed, 4 insertions(+)
diff --git a/package/Makefile.in b/package/Makefile.in
index dc818a2c18..f4f3864e8d 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -232,6 +232,7 @@ HOST_LDFLAGS += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
# Exit code chooses option. "$$TMP" is can be used as temporary file and
# is automatically cleaned up.
+ifneq ($(1),)
try-run = $(shell set -e; \
TMP="$$(mktemp)"; \
if ($(1)) >/dev/null 2>&1; \
@@ -244,6 +245,7 @@ try-run = $(shell set -e; \
# Usage: HOST_FOO_CFLAGS += $(call host-cc-option,-no-pie,)
host-cc-option = $(call try-run,\
$(HOSTCC) $(HOST_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
+endif
# host-intltool should be executed with the system perl, so we save
diff --git a/support/dependencies/dependencies.mk b/support/dependencies/dependencies.mk
index 4fac5c731b..45ecee0645 100644
--- a/support/dependencies/dependencies.mk
+++ b/support/dependencies/dependencies.mk
@@ -14,10 +14,12 @@ else
# can be the candidate to be checked. If not present, the check-host-$(1).sh
# script should use 'which' to find a candidate. The script should return
# the path to the suitable host tool, or nothing if no suitable tool was found.
+ifneq ($(1),)
define suitable-host-package
$(shell support/dependencies/check-host-$(1).sh $(2))
endef
endif
+endif
# host utilities needs host-tar to extract the source code tarballs, so
# ensure check-host-tar.mk is included before the rest
include support/dependencies/check-host-tar.mk
--
2.20.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3616 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190223/54cc3219/attachment.bin>
^ permalink raw reply related [flat|nested] 4+ messages in thread* [Buildroot] [PATCH] make printvars: avoid invalid calls when arguments are missing
2019-02-23 16:11 [Buildroot] [PATCH] make printvars: avoid invalid calls when arguments are missing Martin Kepplinger
@ 2019-02-23 16:41 ` Thomas Petazzoni
2019-02-25 7:09 ` Kepplinger Martin
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2019-02-23 16:41 UTC (permalink / raw)
To: buildroot
Hello Martin,
On Sat, 23 Feb 2019 17:11:08 +0100
Martin Kepplinger <martin.kepplinger@ginzinger.com> wrote:
> diff --git a/package/Makefile.in b/package/Makefile.in
> index dc818a2c18..f4f3864e8d 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -232,6 +232,7 @@ HOST_LDFLAGS += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
> # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
> # Exit code chooses option. "$$TMP" is can be used as temporary file and
> # is automatically cleaned up.
> +ifneq ($(1),)
$(1) only makes sense inside the macro itself. Outside the macro $(1)
does not make sense at all, and will always be empty I believe. Are you
sure your patch is working, and does not break the build ?
Indeed, I believe the two macros you enclose in ifneq tests will in
fact no longer be defined.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] make printvars: avoid invalid calls when arguments are missing
2019-02-23 16:41 ` Thomas Petazzoni
@ 2019-02-25 7:09 ` Kepplinger Martin
2019-02-25 22:00 ` Yann E. MORIN
0 siblings, 1 reply; 4+ messages in thread
From: Kepplinger Martin @ 2019-02-25 7:09 UTC (permalink / raw)
To: buildroot
(sorry for the horrible email format)
my patch does not break the build. In fact, it *adds* host-tar to my build (for the first time
ever it seems because it just downloaded).
My impression is that what's *below* the $(1) expression in support/dependencies/dependencies.mk
didn't get defined... (host-tar).
I've built successfully. Still, the kind of change doesn't look very beautiful.
Maybe there someone who sees the mistake at first sight :)
thanks
martin
Martin Kepplinger | Entwicklung Software
GINZINGER ELECTRONIC SYSTEMS GMBH
Tel.: +43 7723 5422 157
Mail: martin.kepplinger at ginzinger.com
Web: www.ginzinger.com
________________________________________
Von: Thomas Petazzoni [thomas.petazzoni at bootlin.com]
Gesendet: Samstag, 23. Februar 2019 17:41
An: Kepplinger Martin
Cc: buildroot at buildroot.org
Betreff: Re: [Buildroot] [PATCH] make printvars: avoid invalid calls when arguments are missing
Hello Martin,
On Sat, 23 Feb 2019 17:11:08 +0100
Martin Kepplinger <martin.kepplinger@ginzinger.com> wrote:
> diff --git a/package/Makefile.in b/package/Makefile.in
> index dc818a2c18..f4f3864e8d 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -232,6 +232,7 @@ HOST_LDFLAGS += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
> # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
> # Exit code chooses option. "$$TMP" is can be used as temporary file and
> # is automatically cleaned up.
> +ifneq ($(1),)
$(1) only makes sense inside the macro itself. Outside the macro $(1)
does not make sense at all, and will always be empty I believe. Are you
sure your patch is working, and does not break the build ?
Indeed, I believe the two macros you enclose in ifneq tests will in
fact no longer be defined.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
________________________________________
Ginzinger electronic systems GmbH
Gewerbegebiet Pirath 16
4952 Weng im Innkreis
www.ginzinger.com
Firmenbuchnummer: FN 364958d
Firmenbuchgericht: Ried im Innkreis
UID-Nr.: ATU66521089
Diese Nachricht ist vertraulich und darf nicht an andere Personen weitergegeben oder von diesen verwendet werden. Verst?ndigen Sie uns, wenn Sie irrt?mlich eine Mitteilung empfangen haben.
This message is confidential. It may not be disclosed to, or used by, anyone other than the addressee. If you receive this message by mistake, please advise the sender.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3616 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190225/762a5ca4/attachment.bin>
^ permalink raw reply [flat|nested] 4+ messages in thread* [Buildroot] [PATCH] make printvars: avoid invalid calls when arguments are missing
2019-02-25 7:09 ` Kepplinger Martin
@ 2019-02-25 22:00 ` Yann E. MORIN
0 siblings, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2019-02-25 22:00 UTC (permalink / raw)
To: buildroot
Martin, All,
On 2019-02-25 07:09 +0000, Kepplinger Martin spake thusly:
> (sorry for the horrible email format)
>
> my patch does not break the build. In fact, it *adds* host-tar to my build (for the first time
> ever it seems because it just downloaded).
>
> My impression is that what's *below* the $(1) expression in support/dependencies/dependencies.mk
> didn't get defined... (host-tar).
>
> I've built successfully. Still, the kind of change doesn't look very beautiful.
>
> Maybe there someone who sees the mistake at first sight :)
I agree with Thomas: the patch as it is, is not correct. As Thomas
explained, at the exact moment you evaluate $(1) to test if it is empty,
you are outside the macro. However, $(1) only ever makes sense in a
macro, because it is the first parameter of a macro.
So, it means the test will aways fail: $(1) is always empty outside a
macro, so ifneq ($(1),) is always false.
As a consequnce, as Thomas said, the two macros enclosed in the ifneq
will never be defined.
Instead, what you want is to do the test inside the macro, like:
define suitable-host-package
ifneq ($(1),)
$(shell support/dependencies/check-host-$(1).sh $(2))
endif
endef
Or:
try-run = $(if $(1), ...
...
)
And so on...
I've marked the patch as "Changes Requested" in patchwork while waiting
for the next iteration. Thanks! :-)
Regards,
Yann E. MORIN.
> On Sat, 23 Feb 2019 17:11:08 +0100
> Martin Kepplinger <martin.kepplinger@ginzinger.com> wrote:
>
> > diff --git a/package/Makefile.in b/package/Makefile.in
> > index dc818a2c18..f4f3864e8d 100644
> > --- a/package/Makefile.in
> > +++ b/package/Makefile.in
> > @@ -232,6 +232,7 @@ HOST_LDFLAGS += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
> > # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
> > # Exit code chooses option. "$$TMP" is can be used as temporary file and
> > # is automatically cleaned up.
> > +ifneq ($(1),)
>
> $(1) only makes sense inside the macro itself. Outside the macro $(1)
> does not make sense at all, and will always be empty I believe. Are you
> sure your patch is working, and does not break the build ?
>
> Indeed, I believe the two macros you enclose in ifneq tests will in
> fact no longer be defined.
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
>
>
> ________________________________________
>
> Ginzinger electronic systems GmbH
> Gewerbegebiet Pirath 16
> 4952 Weng im Innkreis
> www.ginzinger.com
>
> Firmenbuchnummer: FN 364958d
> Firmenbuchgericht: Ried im Innkreis
> UID-Nr.: ATU66521089
>
>
> Diese Nachricht ist vertraulich und darf nicht an andere Personen weitergegeben oder von diesen verwendet werden. Verst?ndigen Sie uns, wenn Sie irrt?mlich eine Mitteilung empfangen haben.
>
> This message is confidential. It may not be disclosed to, or used by, anyone other than the addressee. If you receive this message by mistake, please advise the sender.
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-25 22:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-23 16:11 [Buildroot] [PATCH] make printvars: avoid invalid calls when arguments are missing Martin Kepplinger
2019-02-23 16:41 ` Thomas Petazzoni
2019-02-25 7:09 ` Kepplinger Martin
2019-02-25 22:00 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox