# [SOLVED]"ar: invalid option -- 's'" when compiling kernel

## DeadToRight

I used a different distro to chroot in and build the system and kernel. the kernel still builds inside that chroot, if reopened that way.

 *Quote:*   

> AR       /usr/src/linux-4.17.4-gentoo/tools/objtool/libsubcmd.a
> 
> ar: invalid option -- 's'
> 
> BusyBox v1.28.0 (2018-07-09 07:47:48 EDT) multi-call binary.
> ...

 Last edited by DeadToRight on Mon Jul 09, 2018 7:41 pm; edited 1 time in total

----------

## khayyam

DeadToRight ...

it looks as though the 'ar' within the chroot is a link to busybox ... which doesn't support the '-s' switch. This is probably the result of having run 'busybox --install', which will create symlinks for all busybox commands, and so break your stage3/4.

best ... khay

----------

## DeadToRight

 *khayyam wrote:*   

> DeadToRight ...
> 
> it looks as though the 'ar' within the chroot is a link to busybox ... which doesn't support the '-s' switch. This is probably the result of having run 'busybox --install', which will create symlinks for all busybox commands, and so break your stage3/4.
> 
> best ... khay

 Any suggestions for rebuilding around this? It still performs normally inside a chroot. 

You know what? I'm grabbing a fresh stage3. not yet for reinstalling. but for a template on how to lay out the symlinks. found the one for ar in /usr/bin.

Is there a good list of where to find what all busybox --install overwrites?

----------

## khayyam

 *DeadToRight wrote:*   

> Is there a good list of where to find what all busybox --install overwrites?

 

DeadToRight ... all the 'currently defined functions' listed in 'busybox --help', so all of the following:

```
# for i in $(busybox --help | awk '/^C/{y=1;next};{gsub(/(\,|\[|\])/,"")}y') ; do which "$i" ; done
```

... and note, I'm excluding "[" and "]" in the output (because of how the shell will interpret them), so those also.

HTH & best ... khay

----------

## DeadToRight

 *khayyam wrote:*   

>  *DeadToRight wrote:*   Is there a good list of where to find what all busybox --install overwrites? 
> 
> DeadToRight ... all the 'currently defined functions' listed in 'busybox --help', so all of the following:
> 
> ```
> ...

 that's a fun list to rm. gonna have to install the stage3 from outside the chroot to even be able to... anything, really. and then rebuild... well, less than the whole system at first. better move make.conf first though.

And then:

FEATURES="-collision-detection" emerge -av1 <oh god>

libressl seems a reasonable starting point. Then glib. then @preserved-rebuild. then @system. And then passwd <each user>

And then reboot outta chroot, and try building a test kernel. If such works, I might wanna try something crazy like a emerge -NavuDe @world. or should I consider the ol' bootstrap a la: https://wiki.gentoo.org/wiki/Fix_My_GentooLast edited by DeadToRight on Mon Jul 09, 2018 5:24 pm; edited 1 time in total

----------

## khayyam

DeadToRight ...

you might be better using 'equery' or 'qcheck --badonly' and pass those to emerge, eg: 

```
# emerge --oneshot $(qcheck --badonly --skip-protected --nocolor)
```

best ... khay

----------

## DeadToRight

 *khayyam wrote:*   

> DeadToRight ...
> 
> you might be better using 'equery' or 'qcheck --badonly' and pass those to emerge, eg: 
> 
> ```
> ...

 That... would have been so much easier.

As it is, Im a cringe-story for the toolchain devs. But it boots, it compiles the kernel, its recompiling the rest.

----------

## Hu

 *khayyam wrote:*   

> DeadToRight ... all the 'currently defined functions' listed in 'busybox --help', so all of the following:
> 
> ```
> # for i in $(busybox --help | awk '/^C/{y=1;next};{gsub(/(\,|\[|\])/,"")}y') ; do which "$i" ; done
> ```
> ...

 This can be simplified by using busybox --list instead:

```
busybox --list | xargs -d'\n' which
```

----------

## khayyam

 *khayyam wrote:*   

> 
> 
> ```
> # for i in $(busybox --help | awk '/^C/{y=1;next};{gsub(/(\,|\[|\])/,"")}y') ; do which "$i" ; done
> ```
> ...

 

 *Hu wrote:*   

> This can be simplified by using busybox --list instead:
> 
> ```
> busybox --list | xargs -d'\n' which
> ```
> ...

 

Hu ... tnx, wasn't aware of that option.

best ... khay

----------

## Hu

Me either.  I spent a few minutes trying to rewrite the gawk command to be safe to use with a while read loop, got annoyed at dealing with the whitespace that busybox was generating, and reviewed the help looking for other ways to get the command list in a more usable form.  When I found --list, it did exactly what I needed.

----------

