diff mbox

[4/5] Makefile: do not try to strip inexisting file when stripping libpthread

Message ID 1376996584-4462-5-git-send-email-thomas.petazzoni@free-electrons.com
State Accepted
Commit 52e7073a58409ac09b79865a3ae4332cf01edb58
Headers show

Commit Message

Thomas Petazzoni Aug. 20, 2013, 11:03 a.m. UTC
libpthread.so has a special stripping condition to preserve parts of
it that are needed for debugging. However, due to the usage of 'xargs'
instead of 'xargs -r', the strip command is executed regardless of
whether a libpthread.so file is found or not. This leads to a big
error message being displayed in static-only builds, because strip is
executed without a file argument. Thanks to the '|| true', the build
continues, but still shows a big error message in the middle, which is
not nice.

By using 'xargs -r', we avoid the strip command from being executed
when 'find' doesn't find any match. We also remove the '|| true' to
catch other real errors.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnout Vandecappelle Aug. 21, 2013, 7:33 p.m. UTC | #1
On 20/08/13 13:03, Thomas Petazzoni wrote:
> libpthread.so has a special stripping condition to preserve parts of
> it that are needed for debugging. However, due to the usage of 'xargs'
> instead of 'xargs -r', the strip command is executed regardless of
> whether a libpthread.so file is found or not. This leads to a big
> error message being displayed in static-only builds, because strip is
> executed without a file argument. Thanks to the '|| true', the build
> continues, but still shows a big error message in the middle, which is
> not nice.
>
> By using 'xargs -r', we avoid the strip command from being executed
> when 'find' doesn't find any match. We also remove the '|| true' to
> catch other real errors.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

  I'd find it more natural to use the -exec option of find, but this 
patch solves a real problem so

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

> ---
>   Makefile | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 5d40126..9201f27 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -485,7 +485,7 @@ endif
>   # I set a breakpoint"
>   ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
>   	find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
> -		xargs $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
> +		xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
>   endif
>
>   	mkdir -p $(TARGET_DIR)/etc
>
Peter Korsgaard Sept. 2, 2013, 9:13 p.m. UTC | #2
On Tue, Aug 20, 2013 at 1:03 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> libpthread.so has a special stripping condition to preserve parts of
> it that are needed for debugging. However, due to the usage of 'xargs'
> instead of 'xargs -r', the strip command is executed regardless of
> whether a libpthread.so file is found or not. This leads to a big
> error message being displayed in static-only builds, because strip is
> executed without a file argument. Thanks to the '|| true', the build
> continues, but still shows a big error message in the middle, which is
> not nice.
>
> By using 'xargs -r', we avoid the strip command from being executed
> when 'find' doesn't find any match. We also remove the '|| true' to
> catch other real errors.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Committed, thanks.
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 5d40126..9201f27 100644
--- a/Makefile
+++ b/Makefile
@@ -485,7 +485,7 @@  endif
 # I set a breakpoint"
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
 	find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
-		xargs $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
+		xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
 endif
 
 	mkdir -p $(TARGET_DIR)/etc