[Buildroot] [/bin/sh which ar] should be [/bin/sh -c "which ar"]

2 messages, 2 authors, 2007-07-08 · open the first message on its own page

[Buildroot] [/bin/sh which ar] should be [/bin/sh -c "which ar"]

From: Ulf Samuelsson <hidden>
Date: 2007-07-08 04:35:39

When the host tools are determined in the top Makefile
(every time make us run) 
this fails 5 times with the error message:

/usr/bin/which: /usr/bin/which: cannot execute binary file

What happens inside the Makefile is that a command is run:
$ /bin/sh which ar
and the bash shell does not like this on my OpenSuSE 10.2 system
$ /bin/sh -c "which ar"
will do what we want, so I would like to apply the following patch
Any comments?

Index: Makefile
===================================================================
--- Makefile    (revision 19026)
+++ Makefile    (arbetskopia)
@@ -78,11 +78,11 @@
 ifndef HOSTLD
 HOSTLD:=ld
 endif
-HOSTAR:=$(shell $(CONFIG_SHELL) which $(HOSTAR) || type -p $(HOSTAR) ||
echo ar)
-HOSTAS:=$(shell $(CONFIG_SHELL) which $(HOSTAS) || type -p $(HOSTAS) ||
echo as)
-HOSTCC:=$(shell $(CONFIG_SHELL) which $(HOSTCC) || type -p $(HOSTCC) ||
echo gcc)
-HOSTCXX:=$(shell $(CONFIG_SHELL) which $(HOSTCXX) || type -p $(HOSTCXX)
|| echo g++)
-HOSTLD:=$(shell $(CONFIG_SHELL) which $(HOSTLD) || type -p $(HOSTLD) ||
echo ld)
+HOSTAR :=$(shell $(CONFIG_SHELL) -c "which $(HOSTAR)"  || type -p
$(HOSTAR)  || echo ar)
+HOSTAS :=$(shell $(CONFIG_SHELL) -c "which $(HOSTAS)"  || type -p
$(HOSTAS)  || echo as)
+HOSTCC :=$(shell $(CONFIG_SHELL) -c "which $(HOSTCC)"  || type -p
$(HOSTCC)  || echo gcc)
+HOSTCXX:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCXX)" || type -p
$(HOSTCXX) || echo g++)
+HOSTLD :=$(shell $(CONFIG_SHELL) -c "which $(HOSTLD)"  || type -p
$(HOSTLD)  || echo ld)
 ifndef CFLAGS_FOR_BUILD
 CFLAGS_FOR_BUILD:=-g -O2
 endif

Best Regards
Ulf Samuelsson

[Buildroot] [/bin/sh which ar] should be [/bin/sh -c "which ar"]

From: Bernhard Fischer <hidden>
Date: 2007-07-08 10:28:17

On Sun, Jul 08, 2007 at 06:35:39AM +0200, Ulf Samuelsson wrote:
When the host tools are determined in the top Makefile
(every time make us run) 
this fails 5 times with the error message:

/usr/bin/which: /usr/bin/which: cannot execute binary file

What happens inside the Makefile is that a command is run:
$ /bin/sh which ar
and the bash shell does not like this on my OpenSuSE 10.2 system
$ /bin/sh -c "which ar"
will do what we want, so I would like to apply the following patch
Any comments?
ok, please apply.

Thanks,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help