Issues with scripts/trylink

Denys Vlasenko vda.linux at
Tue Feb 23 11:52:03 UTC 2021

On Tue, Feb 23, 2021 at 12:44 PM Denys Vlasenko
<vda.linux at> wrote:
> On Sat, Feb 13, 2021 at 3:23 PM Laurent Bercot <ska-dietlibc at> wrote:
> >   An example is utmp functionality with the musl C library: musl
> > provides utmpx.h stubs that do nothing, and the utmps library
> > ( ) can be used to implement
> > real utmp functionality on top of musl - but at the moment, busybox
> > cannot be built with utmps, because trylink sees that it links
> > without the "utmps skarnet" arguments (which it reorders as
> > "-lskarnet -lutmps" due to the call to "sort" mentioned above, which
> > would be incorrect even if it kept them), removes them, and makes it
> > impossible to have the desired utmps functionality in the busybox
> > binary.

> The logic to remove libs which are not necessary simplifies cases
> where e.g. -lrt or -lm is necessary on one libc, but not on other.
> (Some newly created libc's include them into main library, and
> libm is just an empty archive, kept to not break link invocations
> with -lm. Google, as usual, decided to be a pain and Android has no
> separate crypt library and they did NOT retain a stub empty archive!).
> With current logic, you do not need to jump through the hoops
> "if FEATURE_AWK_LIBM=y, include -lm, but if it's musl, do not include -lm".
> Just LDLIBS += m, always.
> Maybe we can have LDLIBS_MANDATORY for libs which should not be elided?

Aha. We have CONFIG_EXTRA_LDLIBS. We just need to change the logic
so that it is not appended to LDLIBS, but treated separately,
with no elision.

More information about the busybox mailing list