scripts/trylink CONFIG_EXTRA_LDLIBS quoting issue
Jacob Burkholder
jake.burkholder2 at gmail.com
Mon Apr 7 06:08:51 UTC 2025
Thanks for looking into this, your patch also works.
On Sun, Apr 6, 2025 at 4:06 AM Denys Vlasenko <vda.linux at googlemail.com> wrote:
>
> - "$(CONFIG_EXTRA_LDLIBS)" \
> + $(CONFIG_EXTRA_LDLIBS) \
>
>
> CONFIG_xyz strings already have double quotes: their value
> is '"LIB LIB2"', therefore $(CONFIG_EXTRA_LDLIBS) above must NOT be written
> as "$(CONFIG_EXTRA_LDLIBS)", it would be passed as ""LIB LIB2"",
> and LIB2 would end up in $9, not $8.
>
> On Sun, Feb 23, 2025 at 5:42 PM Jacob Burkholder
> <jake.burkholder2 at gmail.com> wrote:
> >
> > I ran in to an issue with scripts/trylink when CONFIG_EXTRA_LDLIBS
> > contains more than 1 library, the list gets passed to scripts/trylink
> > without quotes so only the first library is used.
> >
> > CONFIG_EXTRA_LDLIBS="$8"
> >
> > The first library is $8, the other ones are $9, etc.
> >
> > I worked around it by putting the libraries in CONFIG_EXTRA_LDFLAGS
> > but this doesn't always work for static linking. I applied this patch
> > which worked without using CONFIG_EXTRA_LDFLAGS. I didn't try to
> > change the quoting in Makefile which may also work.
> >
> > diff -Nru busybox-1.36.1.orig/scripts/trylink busybox-1.36.1/scripts/trylink
> > --- busybox-1.36.1.orig/scripts/trylink 2021-03-01 08:38:12.000000000 -0800
> > +++ busybox-1.36.1/scripts/trylink 2025-02-23 08:16:41.609366567 -0800
> > @@ -84,7 +84,8 @@
> > # a real utmp library in LDLIBS, dropping it "works" but resulting binary
> > # does not work properly).
> > LDLIBS="$7"
> > -CONFIG_EXTRA_LDLIBS="$8"
> > +shift 7
> > +CONFIG_EXTRA_LDLIBS="$*"
> >
> > # The --sort-section option is not supported by older versions of ld
> > SORT_SECTION="-Wl,--sort-section,alignment"
> > _______________________________________________
> > busybox mailing list
> > busybox at busybox.net
> > https://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list