[dpdk-dev] app/testpmd: fix static build link ordering

Message ID 20170113032155.GA31838@localhost.localdomain (mailing list archive)
State Not Applicable, archived
Headers

Checks

Context Check Description
ci/Intel compilation fail apply patch file failure

Commit Message

Jerin Jacob Jan. 13, 2017, 3:21 a.m. UTC
  On Thu, Jan 12, 2017 at 03:27:30PM +0000, Ferruh Yigit wrote:
> On 1/12/2017 1:58 PM, Jerin Jacob wrote:
> > On Thu, Jan 12, 2017 at 10:26:08AM +0100, Thomas Monjalon wrote:
> >> 2017-01-12 13:16, Jerin Jacob:
> >>> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> >>>  _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> >>> +endif
> >>
> >> _LDLIBS is an internal variable of rte.app.mk.
> >> Please could you check that there is no issue when using LDLIBS instead
> >> of _LDLIBS?
> > 
> > Tested it. Suggested change has issue in shared lib configuration.
> > 
> > [dpdk-master] $ git diff
> > diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
> > index 050663a..27cadd5 100644
> > --- a/app/test-pmd/Makefile
> > +++ b/app/test-pmd/Makefile
> > @@ -59,9 +59,7 @@ SRCS-y += csumonly.c
> >  SRCS-y += icmpecho.c
> >  SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
> >  
> > -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> > -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> > -endif
> > +LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> 
> It is LDLIBS instead of LDLIBS-y, following may work:

LDLIBS is not helping the situation as LDLIBS comes before the _LDLIBS-y
mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)

But moving to EXTRA_LDLIBS looks OK.But it has to be under CONFIG_RTE_LIBRTE_IXGBE_PMD

Thomas, Ferruh
Let me know if you have any objection on below mentioned diff

[master] $ git diff
app/test-pmd/Makefile 


> 
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
> +LDLIBS += -lrte_pmd_ixgbe
> +endif
> +endif
> 
> 
> Also using EXTRA_LDLIBS instead of LDLIBS may remove the requirement of
> the SHARED_LIB check, because of where it is located, but this seems
> just coincidental.
> 
> 
>
  

Comments

Thomas Monjalon Jan. 13, 2017, 3:53 p.m. UTC | #1
2017-01-13 08:51, Jerin Jacob:
> On Thu, Jan 12, 2017 at 03:27:30PM +0000, Ferruh Yigit wrote:
> > On 1/12/2017 1:58 PM, Jerin Jacob wrote:
> > > On Thu, Jan 12, 2017 at 10:26:08AM +0100, Thomas Monjalon wrote:
> > >> 2017-01-12 13:16, Jerin Jacob:
> > >>> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> > >>>  _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> > >>> +endif
> > >>
> > >> _LDLIBS is an internal variable of rte.app.mk.
> > >> Please could you check that there is no issue when using LDLIBS instead
> > >> of _LDLIBS?
> > > 
> LDLIBS is not helping the situation as LDLIBS comes before the _LDLIBS-y
> mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
> 
> But moving to EXTRA_LDLIBS looks OK.But it has to be under CONFIG_RTE_LIBRTE_IXGBE_PMD
> 
> Thomas, Ferruh
> Let me know if you have any objection on below mentioned diff
> 
> -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
> +EXTRA_LDLIBS += -lrte_pmd_ixgbe
>  endif

You need to keep the shared lib check.
Anyway, EXTRA_LDLIBS should be reserved to users and not used in a Makefile.
I prefer your initial patch using _LDLIBS.

Any objection to merge initial proposal?
  
Ferruh Yigit Jan. 13, 2017, 3:57 p.m. UTC | #2
On 1/13/2017 3:53 PM, Thomas Monjalon wrote:
> 2017-01-13 08:51, Jerin Jacob:
>> On Thu, Jan 12, 2017 at 03:27:30PM +0000, Ferruh Yigit wrote:
>>> On 1/12/2017 1:58 PM, Jerin Jacob wrote:
>>>> On Thu, Jan 12, 2017 at 10:26:08AM +0100, Thomas Monjalon wrote:
>>>>> 2017-01-12 13:16, Jerin Jacob:
>>>>>> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
>>>>>>  _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
>>>>>> +endif
>>>>>
>>>>> _LDLIBS is an internal variable of rte.app.mk.
>>>>> Please could you check that there is no issue when using LDLIBS instead
>>>>> of _LDLIBS?
>>>>
>> LDLIBS is not helping the situation as LDLIBS comes before the _LDLIBS-y
>> mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
>>
>> But moving to EXTRA_LDLIBS looks OK.But it has to be under CONFIG_RTE_LIBRTE_IXGBE_PMD
>>
>> Thomas, Ferruh
>> Let me know if you have any objection on below mentioned diff
>>
>> -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
>> -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
>> +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
>> +EXTRA_LDLIBS += -lrte_pmd_ixgbe
>>  endif
> 
> You need to keep the shared lib check.
> Anyway, EXTRA_LDLIBS should be reserved to users and not used in a Makefile.
> I prefer your initial patch using _LDLIBS.
> 
> Any objection to merge initial proposal?
> 

LDLIBS should be OK, as long as wrapped with SHARED check. Is following
not working:

-_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif
  
Jerin Jacob Jan. 13, 2017, 4:01 p.m. UTC | #3
On Fri, Jan 13, 2017 at 03:57:59PM +0000, Ferruh Yigit wrote:
> On 1/13/2017 3:53 PM, Thomas Monjalon wrote:
> > 2017-01-13 08:51, Jerin Jacob:
> >> On Thu, Jan 12, 2017 at 03:27:30PM +0000, Ferruh Yigit wrote:
> >>> On 1/12/2017 1:58 PM, Jerin Jacob wrote:
> >>>> On Thu, Jan 12, 2017 at 10:26:08AM +0100, Thomas Monjalon wrote:
> >>>>> 2017-01-12 13:16, Jerin Jacob:
> >>>>>> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> >>>>>>  _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> >>>>>> +endif
> >>>>>
> >>>>> _LDLIBS is an internal variable of rte.app.mk.
> >>>>> Please could you check that there is no issue when using LDLIBS instead
> >>>>> of _LDLIBS?
> >>>>
> >> LDLIBS is not helping the situation as LDLIBS comes before the _LDLIBS-y
> >> mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
> >>
> >> But moving to EXTRA_LDLIBS looks OK.But it has to be under CONFIG_RTE_LIBRTE_IXGBE_PMD
> >>
> >> Thomas, Ferruh
> >> Let me know if you have any objection on below mentioned diff
> >>
> >> -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> >> -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> >> +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
> >> +EXTRA_LDLIBS += -lrte_pmd_ixgbe
> >>  endif
> > 
> > You need to keep the shared lib check.
> > Anyway, EXTRA_LDLIBS should be reserved to users and not used in a Makefile.
> > I prefer your initial patch using _LDLIBS.
> > 
> > Any objection to merge initial proposal?
> > 
> 
> LDLIBS should be OK, as long as wrapped with SHARED check. Is following
> not working:

No, due to the following line
mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)

Again -lrte_pmd_ixgbe comes first.

> 
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
> +LDLIBS += -lrte_pmd_ixgbe
> +endif
> +endif
  
Jerin Jacob Jan. 13, 2017, 4:02 p.m. UTC | #4
On Fri, Jan 13, 2017 at 04:53:46PM +0100, Thomas Monjalon wrote:
> 2017-01-13 08:51, Jerin Jacob:
> > On Thu, Jan 12, 2017 at 03:27:30PM +0000, Ferruh Yigit wrote:
> > > On 1/12/2017 1:58 PM, Jerin Jacob wrote:
> > > > On Thu, Jan 12, 2017 at 10:26:08AM +0100, Thomas Monjalon wrote:
> > > >> 2017-01-12 13:16, Jerin Jacob:
> > > >>> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> > > >>>  _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> > > >>> +endif
> > > >>
> > > >> _LDLIBS is an internal variable of rte.app.mk.
> > > >> Please could you check that there is no issue when using LDLIBS instead
> > > >> of _LDLIBS?
> > > > 
> > LDLIBS is not helping the situation as LDLIBS comes before the _LDLIBS-y
> > mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
> > 
> > But moving to EXTRA_LDLIBS looks OK.But it has to be under CONFIG_RTE_LIBRTE_IXGBE_PMD
> > 
> > Thomas, Ferruh
> > Let me know if you have any objection on below mentioned diff
> > 
> > -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> > -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> > +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
> > +EXTRA_LDLIBS += -lrte_pmd_ixgbe
> >  endif
> 
> You need to keep the shared lib check.
> Anyway, EXTRA_LDLIBS should be reserved to users and not used in a Makefile.
> I prefer your initial patch using _LDLIBS.
> 
> Any objection to merge initial proposal?

from my side, No
  
Ferruh Yigit Jan. 13, 2017, 4:12 p.m. UTC | #5
On 1/13/2017 4:01 PM, Jerin Jacob wrote:
> On Fri, Jan 13, 2017 at 03:57:59PM +0000, Ferruh Yigit wrote:
>> On 1/13/2017 3:53 PM, Thomas Monjalon wrote:
>>> 2017-01-13 08:51, Jerin Jacob:
>>>> On Thu, Jan 12, 2017 at 03:27:30PM +0000, Ferruh Yigit wrote:
>>>>> On 1/12/2017 1:58 PM, Jerin Jacob wrote:
>>>>>> On Thu, Jan 12, 2017 at 10:26:08AM +0100, Thomas Monjalon wrote:
>>>>>>> 2017-01-12 13:16, Jerin Jacob:
>>>>>>>> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
>>>>>>>>  _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
>>>>>>>> +endif
>>>>>>>
>>>>>>> _LDLIBS is an internal variable of rte.app.mk.
>>>>>>> Please could you check that there is no issue when using LDLIBS instead
>>>>>>> of _LDLIBS?
>>>>>>
>>>> LDLIBS is not helping the situation as LDLIBS comes before the _LDLIBS-y
>>>> mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
>>>>
>>>> But moving to EXTRA_LDLIBS looks OK.But it has to be under CONFIG_RTE_LIBRTE_IXGBE_PMD
>>>>
>>>> Thomas, Ferruh
>>>> Let me know if you have any objection on below mentioned diff
>>>>
>>>> -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
>>>> -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
>>>> +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
>>>> +EXTRA_LDLIBS += -lrte_pmd_ixgbe
>>>>  endif
>>>
>>> You need to keep the shared lib check.
>>> Anyway, EXTRA_LDLIBS should be reserved to users and not used in a Makefile.
>>> I prefer your initial patch using _LDLIBS.
>>>
>>> Any objection to merge initial proposal?
>>>
>>
>> LDLIBS should be OK, as long as wrapped with SHARED check. Is following
>> not working:
> 
> No, due to the following line
> mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
> 
> Again -lrte_pmd_ixgbe comes first.

You are right.

No objection to initial proposal.
  
Ferruh Yigit Jan. 31, 2017, 10:58 a.m. UTC | #6
On 1/13/2017 4:12 PM, Ferruh Yigit wrote:
> On 1/13/2017 4:01 PM, Jerin Jacob wrote:
>> On Fri, Jan 13, 2017 at 03:57:59PM +0000, Ferruh Yigit wrote:
>>> On 1/13/2017 3:53 PM, Thomas Monjalon wrote:
>>>> 2017-01-13 08:51, Jerin Jacob:
>>>>> On Thu, Jan 12, 2017 at 03:27:30PM +0000, Ferruh Yigit wrote:
>>>>>> On 1/12/2017 1:58 PM, Jerin Jacob wrote:
>>>>>>> On Thu, Jan 12, 2017 at 10:26:08AM +0100, Thomas Monjalon wrote:
>>>>>>>> 2017-01-12 13:16, Jerin Jacob:
>>>>>>>>> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
>>>>>>>>>  _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
>>>>>>>>> +endif
>>>>>>>>
>>>>>>>> _LDLIBS is an internal variable of rte.app.mk.
>>>>>>>> Please could you check that there is no issue when using LDLIBS instead
>>>>>>>> of _LDLIBS?
>>>>>>>
>>>>> LDLIBS is not helping the situation as LDLIBS comes before the _LDLIBS-y
>>>>> mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
>>>>>
>>>>> But moving to EXTRA_LDLIBS looks OK.But it has to be under CONFIG_RTE_LIBRTE_IXGBE_PMD
>>>>>
>>>>> Thomas, Ferruh
>>>>> Let me know if you have any objection on below mentioned diff
>>>>>
>>>>> -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
>>>>> -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
>>>>> +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
>>>>> +EXTRA_LDLIBS += -lrte_pmd_ixgbe
>>>>>  endif
>>>>
>>>> You need to keep the shared lib check.
>>>> Anyway, EXTRA_LDLIBS should be reserved to users and not used in a Makefile.
>>>> I prefer your initial patch using _LDLIBS.
>>>>
>>>> Any objection to merge initial proposal?
>>>>
>>>
>>> LDLIBS should be OK, as long as wrapped with SHARED check. Is following
>>> not working:
>>
>> No, due to the following line
>> mk/rte.app.mk:LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
>>
>> Again -lrte_pmd_ixgbe comes first.
> 
> You are right.

After second thought.
-lrte_pmd_ixgbe coming first is problem for static compilation, but
these libraries used only for dynamic compilation. And locations
shouldn't matter with dynamic compilation.

Can you please try converting to the following, that should work:

+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif

I will send a patch for this.

> 
> No objection to initial proposal.
>
  

Patch

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 050663a..2be8c50 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -59,8 +59,8 @@  SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
-ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
-_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+EXTRA_LDLIBS += -lrte_pmd_ixgbe
 endif
 
 CFLAGS_cmdline.o := -D_GNU_SOURCE