[Buildroot] [PATCH v3 1/1] toolchain: handle toolchains with multiple ld*.so.* files

Arnout Vandecappelle arnout at mind.be
Sun Aug 29 17:21:57 UTC 2021



On 26/08/2021 21:34, Jonah Petri wrote:
> Some 3rd party vendor toolchains have multiple files which match
> these glob patterns.  In this case, the shell script failed.
> Switching to use find and xargs solves the issue.
> 
> Signed-off-by: Jonah Petri <jonah at petri.us>
> ---
> Changes:
>   v2: add SOB
>   v3: fix usage of `find`
>     I moved away from -wholename, which seemed needlessly complex, and
> instead I'm using just the base directory and -name.  Tested with
> previously-failing ARM aarch64 external toolchain build.
> 
>  toolchain/helpers.mk | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index dfb2581ed5..cb9ff6479b 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -135,10 +135,8 @@ copy_toolchain_sysroot = \
>  			$(call simplify_symlink,$$i,$(STAGING_DIR)) ; \
>  		done ; \
>  	fi ; \
> -	if [ ! -e $(STAGING_DIR)/lib/ld*.so.* ]; then \
> -		if [ -e $${ARCH_SYSROOT_DIR}/lib/ld*.so.* ]; then \
> -			cp -a $${ARCH_SYSROOT_DIR}/lib/ld*.so.* $(STAGING_DIR)/lib/ ; \
> -		fi ; \
> +	if [[ ! $$(find $(STAGING_DIR)/lib -name 'ld*.so.*' -print -quit) ]]; then \

 I was going to say: don't use [[, it's a bashism. However, we already use it in
helpers.mk, so I guess it's OK. It's up to whoever has a problem with it to get
rid of it :-)

 Therefore, applied to next, thanks.

 Regards,
 Arnout

> +		find $${ARCH_SYSROOT_DIR}/lib -name 'ld*.so.*' -print0 | xargs -0 -I % cp % $(STAGING_DIR)/lib/; \
>  	fi ; \
>  	if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \
>  		if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
> 


More information about the buildroot mailing list