[LEDE-DEV] [PATCH] iptables: link extension libraries with -lm

Alin Năstac alin.nastac at gmail.com
Mon Apr 30 01:11:23 PDT 2018


On Mon, Apr 30, 2018 at 7:58 AM, John Crispin <john at phrozen.org> wrote:
>
>
> On 27/04/18 16:05, Alin Năstac wrote:
>>
>> According to "Automatic variables" chapter of make manual, $* expands
>> to the pattern matched by % in an implicit rule.
>> However, the make rules in which this patch use the $* variable is an
>> explicit rule, hence $* expansion will be empty.
>>
>>
>> On Fri, Apr 27, 2018 at 8:41 AM, John Crispin <john at phrozen.org> wrote:
>>>
>>>
>>> On 24/04/18 10:05, Alin Nastac wrote:
>>>>
>>>> This fixes an iptables link error when kernel config include
>>>>     CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
>>>> related to the missing -lm argument on the linker command line. Error is
>>>> caused by
>>>> the odd looking linker argument ${$*_LIBADD} which get expanded to an
>>>> empty string.
>>>
>>>
>>> Hi,
>>> the $* usage is correct
>>>
>>> src/%.c:
>>>      echo $*
>>>
>>> ->src/example (bei src/example.c)
>>>
>>> please provide your diffconfig so i can reproduce your issue locally.
>>>
>>>      John
>>>
>
> Hi,
> please try not to top post. and see if this fixes your issue please. -->
>
> https://pastebin.com/qbMfwGer
>
>
>     John

Your solution works and is indeed a better solution.
Don't forget to replace all
package/network/utils/iptables/patches/600-shared-libext.patch
occurrences of the expression ${$*_LIBADD}.

>>>
>>>
>>>> Signed-off-by: Alin Nastac <alin.nastac at gmail.com>
>>>> ---
>>>>    package/network/utils/iptables/patches/600-shared-libext.patch | 10
>>>> +++++-----
>>>>    1 file changed, 5 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git
>>>> a/package/network/utils/iptables/patches/600-shared-libext.patch
>>>> b/package/network/utils/iptables/patches/600-shared-libext.patch
>>>> index a906d40..17e7fbe 100644
>>>> --- a/package/network/utils/iptables/patches/600-shared-libext.patch
>>>> +++ b/package/network/utils/iptables/patches/600-shared-libext.patch
>>>> @@ -28,27 +28,27 @@
>>>>    -libext.a: initext.o ${libext_objs}
>>>>    -     ${AM_VERBOSE_AR} ${AR} crs $@ $^;
>>>>    +libiptext.so: initext.o ${libext_objs}
>>>> -+      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
>>>> ++      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${xt_statistic_LIBADD}
>>>> ${xt_connlabel_LIBADD};
>>>>       -libext_ebt.a: initextb.o ${libext_ebt_objs}
>>>>    -     ${AM_VERBOSE_AR} ${AR} crs $@ $^;
>>>>    +libiptext_ebt.so: initextb.o ${libext_ebt_objs}
>>>> -+      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
>>>> ++      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${xt_statistic_LIBADD}
>>>> ${xt_connlabel_LIBADD};
>>>>       -libext_arpt.a: initexta.o ${libext_arpt_objs}
>>>>    -     ${AM_VERBOSE_AR} ${AR} crs $@ $^;
>>>>    +libiptext_arpt.so: initexta.o ${libext_arpt_objs}
>>>> -+      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
>>>> ++      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${xt_statistic_LIBADD}
>>>> ${xt_connlabel_LIBADD};
>>>>       -libext4.a: initext4.o ${libext4_objs}
>>>>    -     ${AM_VERBOSE_AR} ${AR} crs $@ $^;
>>>>    +libiptext4.so: initext4.o ${libext4_objs}
>>>> -+      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
>>>> ++      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${xt_statistic_LIBADD}
>>>> ${xt_connlabel_LIBADD};
>>>>       -libext6.a: initext6.o ${libext6_objs}
>>>>    -     ${AM_VERBOSE_AR} ${AR} crs $@ $^;
>>>>    +libiptext6.so: initext6.o ${libext6_objs}
>>>> -+      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
>>>> ++      ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o
>>>> $@
>>>> $^ -L../libxtables/.libs -lxtables ${xt_statistic_LIBADD}
>>>> ${xt_connlabel_LIBADD};
>>>>        initext_func  := $(addprefix xt_,${pfx_build_static})
>>>>     initextb_func := $(addprefix ebt_,${pfb_build_static})
>>>
>>>
>



More information about the Lede-dev mailing list