Bug 10646

Summary: Build fails with busybox provided `ar`
Product: Busybox Reporter: jmcclure <jesse>
Component: Standard ComplianceAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description jmcclure 2018-01-11 16:30:53 UTC
Current snapshots fail to build when /bin/sh is busybox's ash and presumably would also fail on any system where `ar` is the busybox provided `ar` with the following error from `make CC=musl-gcc`

>   LD      archival/built-in.o
> ar: unrecognized option: s
> BusyBox v1.28.0.git (2017-12-19 11:32:01 EST) multi-call binary.
> 
> Usage: ar [-o] [-v] [-p] [-t] [-x] ARCHIVE FILES
> 
> Extract or list FILES from an ar archive
> 
>         -o      Preserve original dates
>         -p      Extract to stdout
>         -t      List
>         -x      Extract
>         -v      Verbose
> make[1]: *** [scripts/Makefile.build:264: archival/built-in.o] Error 1
> make: *** [Makefile:743: archival] Error 2

Line 295 of the top-level Makefile sets the build variable AR as follows:

> LD   = $(CROSS_COMPILE)ar

Changing this to the following was a functional workaround for me as /bin/ar is still provided by gnu-coreutils on my system:

> LD   = $(CROSS_COMPILE)/bin/ar

I've confirmed also that setting `CONFIG_CROSS_COMPILER_PREFIX="/bin/"` in .config works - though this seems like worse of a workaround.

However, if /bin/ar was a link to busybox, the build would fail regardless.

Potential solutions would be to remove the offending parameter from the build process if it is not necessary, or to implement that parameter in busybox's `ar`.