[dpdk-dev] examples: ethtool: Link against librte_pmd_ixgbe if necessary

Message ID 20170216161731.4590-1-mchandras@suse.de (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Markos Chandras Feb. 16, 2017, 4:17 p.m. UTC
  The librte_ethtool library depends on librte_pmd_ixgbe if that
pmd driver is enabled so we need to link against it when we compile
the ethtool application. It fixes the following build problem:

/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld:
warning: librte_pmd_ixgbe.so.1, needed by /home/abuild/rpmbuild/BUILD/
dpdk-17.02/examples/ethtool/lib/x86_64-native-linuxapp-gcc/lib/
librte_ethtool.so, not found (try using -rpath or -rpath-link)
/home/abuild/rpmbuild/BUILD/dpdk-17.02/examples/ethtool/lib/
x86_64-native-linuxapp-gcc/lib/librte_ethtool.so: undefined reference to
`rte_pmd_ixgbe_set_vf_rxmode@DPDK_17.02'
collect2: error: ld returned 1 exit status

Cc: Nirmoy Das <ndas@suse.de>
Signed-off-by: Markos Chandras <mchandras@suse.de>
---
 examples/ethtool/ethtool-app/Makefile | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Remy Horton Feb. 17, 2017, 4:11 p.m. UTC | #1
On 16/02/2017 16:17, Markos Chandras wrote:
> The librte_ethtool library depends on librte_pmd_ixgbe if that
> pmd driver is enabled so we need to link against it when we compile
> the ethtool application. It fixes the following build problem:

For some reason this is not an issue with my Fedora box, so I'm guessing 
SUSE is stricter with sub-depenencies of libraries. Does this affect any 
of the OpenSUSE Linux distributions?

..Remy
  
Markos Chandras Feb. 17, 2017, 4:27 p.m. UTC | #2
On 02/17/2017 04:11 PM, Remy Horton wrote:
> 
> On 16/02/2017 16:17, Markos Chandras wrote:
>> The librte_ethtool library depends on librte_pmd_ixgbe if that
>> pmd driver is enabled so we need to link against it when we compile
>> the ethtool application. It fixes the following build problem:
> 
> For some reason this is not an issue with my Fedora box, so I'm guessing
> SUSE is stricter with sub-depenencies of libraries. Does this affect any
> of the OpenSUSE Linux distributions?
> 
> ..Remy

Hi Remy,

Yeah I am seen this problem in the openSUSE Tumbleweed distribution. I
think Nirmoy may have seen that in openSUSE Leap but I will let him
confirm that.
  
Remy Horton Feb. 20, 2017, 2:06 p.m. UTC | #3
On 17/02/2017 16:27, Markos Chandras wrote:
> On 02/17/2017 04:11 PM, Remy Horton wrote:
[..]
> Yeah I am seen this problem in the openSUSE Tumbleweed distribution. I
> think Nirmoy may have seen that in openSUSE Leap but I will let him
> confirm that.

Tried Tumbleweed (version 13.3 I think) but haven't been able to 
replicate the problem. Patch doesn't break anything so it seems OK for 
it to go in.

..Remy
  
Remy Horton Feb. 20, 2017, 2:06 p.m. UTC | #4
On 16/02/2017 16:17, Markos Chandras wrote:
[..]
> Cc: Nirmoy Das <ndas@suse.de>
> Signed-off-by: Markos Chandras <mchandras@suse.de>

Acked-by: Remy Horton <remy.horton@intel.com>
  
Thomas Monjalon March 9, 2017, 8:13 p.m. UTC | #5
2017-02-16 16:17, Markos Chandras:
> The librte_ethtool library depends on librte_pmd_ixgbe if that
> pmd driver is enabled so we need to link against it when we compile
> the ethtool application. It fixes the following build problem:
> 
> /usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld:
> warning: librte_pmd_ixgbe.so.1, needed by /home/abuild/rpmbuild/BUILD/
> dpdk-17.02/examples/ethtool/lib/x86_64-native-linuxapp-gcc/lib/
> librte_ethtool.so, not found (try using -rpath or -rpath-link)
> /home/abuild/rpmbuild/BUILD/dpdk-17.02/examples/ethtool/lib/
> x86_64-native-linuxapp-gcc/lib/librte_ethtool.so: undefined reference to
> `rte_pmd_ixgbe_set_vf_rxmode@DPDK_17.02'
> collect2: error: ld returned 1 exit status

We may add this line:
Fixes: 077d223e25c3 ("examples/ethtool: use ixgbe public function")

> Cc: Nirmoy Das <ndas@suse.de>
> Signed-off-by: Markos Chandras <mchandras@suse.de>
[...]
> --- a/examples/ethtool/ethtool-app/Makefile
> +++ b/examples/ethtool/ethtool-app/Makefile
> +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
> +LDLIBS += -lrte_pmd_ixgbe
> +endif

Please, could you confirm we can remove the same LDLIBS line from
examples/ethtool/lib/Makefile ?
  
Thomas Monjalon April 4, 2017, 10:15 a.m. UTC | #6
Ping

2017-03-09 21:13, Thomas Monjalon:
> 2017-02-16 16:17, Markos Chandras:
> > The librte_ethtool library depends on librte_pmd_ixgbe if that
> > pmd driver is enabled so we need to link against it when we compile
> > the ethtool application. It fixes the following build problem:
> > 
> > /usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld:
> > warning: librte_pmd_ixgbe.so.1, needed by /home/abuild/rpmbuild/BUILD/
> > dpdk-17.02/examples/ethtool/lib/x86_64-native-linuxapp-gcc/lib/
> > librte_ethtool.so, not found (try using -rpath or -rpath-link)
> > /home/abuild/rpmbuild/BUILD/dpdk-17.02/examples/ethtool/lib/
> > x86_64-native-linuxapp-gcc/lib/librte_ethtool.so: undefined reference to
> > `rte_pmd_ixgbe_set_vf_rxmode@DPDK_17.02'
> > collect2: error: ld returned 1 exit status
> 
> We may add this line:
> Fixes: 077d223e25c3 ("examples/ethtool: use ixgbe public function")
> 
> > Cc: Nirmoy Das <ndas@suse.de>
> > Signed-off-by: Markos Chandras <mchandras@suse.de>
> [...]
> > --- a/examples/ethtool/ethtool-app/Makefile
> > +++ b/examples/ethtool/ethtool-app/Makefile
> > +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
> > +LDLIBS += -lrte_pmd_ixgbe
> > +endif
> 
> Please, could you confirm we can remove the same LDLIBS line from
> examples/ethtool/lib/Makefile ?
  
Remy Horton April 4, 2017, 11:12 a.m. UTC | #7
On 04/04/2017 11:15, Thomas Monjalon wrote:
> Ping
[..]
>>> --- a/examples/ethtool/ethtool-app/Makefile
>>> +++ b/examples/ethtool/ethtool-app/Makefile
>>> +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
>>> +LDLIBS += -lrte_pmd_ixgbe
>>> +endif
>>
>> Please, could you confirm we can remove the same LDLIBS line from
>> examples/ethtool/lib/Makefile ?

Did a quick smoke test and looks like it needs to be in lib/Makefile as 
well, at least for shared builds on Fedora. Not sure why though..

[ ethtool]$ make
== lib
   LD librte_ethtool.so.1
rte_ethtool.o: In function `rte_ethtool_net_set_rx_mode':
rte_ethtool.c:(.text+0x667): undefined reference to 
`rte_pmd_ixgbe_set_vf_rxmode'
collect2: error: ld returned 1 exit status
  
Timothy Redaelli April 7, 2017, 1:15 p.m. UTC | #8
On 02/17/2017 05:11 PM, remy.horton at intel.com (Remy Horton) wrote:
> 
> On 16/02/2017 16:17, Markos Chandras wrote:
>> The librte_ethtool library depends on librte_pmd_ixgbe if that
>> pmd driver is enabled so we need to link against it when we compile
>> the ethtool application. It fixes the following build problem:
> 
> For some reason this is not an issue with my Fedora box, so I'm guessing
> SUSE is stricter with sub-depenencies of libraries. Does this affect any
> of the OpenSUSE Linux distributions?

Hi,
I found that the issue is only present if you compile *without* .git
directory present.
If you have .git directoy RTE_DEVEL_BUILD is set to y (see
mk/rte.var.mk) and this adds -rpath=$(RTE_SDK_BIN)/lib (see
mk/rte.app.mk) that "hides" the problem, since the linker finds
"librte_pmd_ixgbe.so" inside the $(RTE_SDK_BIN)/lib directory.

So if you want to replicate it, you can delete the .git directory, use a
snapshot (for example http://dpdk.org/browse/dpdk/snapshot/master.tar.xz
or http://dpdk.org/browse/dpdk/snapshot/dpdk-17.05-rc1.tar.xz) or export
RTE_DEVEL_BUILD=n.

I confirm that this commit fixes the problem.
Obliviously the problem is *only* present while using shared libraries.


Acked-by: Timothy Redaelli <tredaelli@redhat.com>


You may use the following commands to replicate the problem:

--8<--------------------------cut here-------------------------->8--

unset RTE_SDK RTE_INCLUDE RTE_TARGET
export RTE_DEVEL_BUILD=n

rm -rf x86_64-native-linuxapp-gcc
make O=x86_64-native-linuxapp-gcc T=x86_64-native-linuxapp-gcc
-j$(nproc) config
sed -i 's/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/'
x86_64-native-linuxapp-gcc/.config
make O=x86_64-native-linuxapp-gcc -j$(nproc)
make O=x86_64-native-linuxapp-gcc/examples T=x86_64-native-linuxapp-gcc
examples
  

Patch

diff --git a/examples/ethtool/ethtool-app/Makefile b/examples/ethtool/ethtool-app/Makefile
index 09c66ad19..9382ca7c3 100644
--- a/examples/ethtool/ethtool-app/Makefile
+++ b/examples/ethtool/ethtool-app/Makefile
@@ -50,5 +50,8 @@  CFLAGS += $(WERROR_FLAGS)
 LDLIBS += -L$(subst ethtool-app,lib,$(RTE_OUTPUT))/lib
 LDLIBS += -lrte_ethtool
 
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
 
 include $(RTE_SDK)/mk/rte.extapp.mk