examples: ethtool: Link against librte_pmd_ixgbe if necessary
PATCH 1/1 examples: ethtool: Link against librte_pmd_ixgbe if necessary
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
--- examples/ethtool/ethtool-app/Makefile | 3 +++ 1 file changed, 3 insertions(+)
examples/ethtool/ethtool-app/Makefile +3 -0
@@ -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
Signature · 1 line
2.11.0
Quoted 3 lines · Markos Chandras
The
librte_ethtoollibrary depends onlibrte_pmd_ixgbeif 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
Quoted 11 lines · Remy Horton
Quoted 3 lines · Markos Chandras
The
librte_ethtoollibrary depends onlibrte_pmd_ixgbeif 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.
Signature · 4 lines
markos SUSE LINUX GmbH | GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Maxfeldstr. 5, D-90409, Nürnberg
Quoted 1 line · Markos Chandras
On 02/17/2017 04:11 PM, Remy Horton wrote:
[..]
Quoted 3 lines
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
On 16/02/2017 16:17, Markos Chandras wrote:
[..]
Quoted 2 lines
Cc Nirmoy Das <[email protected]>Signed-off-by Markos Chandras <[email protected]>
2017-02-16 16:17, Markos Chandras:
Quoted 4 lines
The
librte_ethtoollibrary depends onlibrte_pmd_ixgbeif that pmd driver is enabled so we need to link against it when we compile the ethtool application. It fixes the following build problem:
Quoted 8 lines
/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:
Quoted 2 lines
Cc Nirmoy Das <[email protected]>Signed-off-by Markos Chandras <[email protected]>
[...]
examples/ethtool/ethtool-app/Makefile CFLAGS += $(WERROR_FLAGS) · line 55
Quoted 5 lines
examples/ethtool/ethtool-app/Makefile +3
-0+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 ?
Ping
2017-03-09 21:13, Thomas Monjalon:
Quoted 28 lines
2017-02-16 16:17, Markos Chandras:
Quoted 4 lines
The
librte_ethtoollibrary depends onlibrte_pmd_ixgbeif that pmd driver is enabled so we need to link against it when we compile the ethtool application. It fixes the following build problem:Quoted 8 lines
/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 statusWe may add this line:
Fixes 077d223e25c3 ("examples/ethtool: use ixgbe public function")Quoted 2 lines
Cc Nirmoy Das <[email protected]>Signed-off-by Markos Chandras <[email protected]>[...]
examples/ethtool/ethtool-app/Makefile CFLAGS += $(WERROR_FLAGS) · line 55
Quoted 5 lines
examples/ethtool/ethtool-app/Makefile +3
-0+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y) +LDLIBS += -lrte_pmd_ixgbe +endifPlease, could you confirm we can remove the same LDLIBS line from examples/ethtool/lib/Makefile ?
Quoted 1 line · Thomas Monjalon
Ping
[..]
Quoted 8 lines
Quoted 8 lines
examples/ethtool/ethtool-app/Makefile CFLAGS += $(WERROR_FLAGS) · line 55
Quoted 5 lines
examples/ethtool/ethtool-app/Makefile +3
-0+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y) +LDLIBS += -lrte_pmd_ixgbe +endifPlease, 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 M. Redaelli
Acked-byQuoted 9 lines · remy.horton at intel.com (Remy Horton)
Quoted 3 lines · Markos Chandras
The
librte_ethtoollibrary depends onlibrte_pmd_ixgbeif 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.
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 v2 1/1 examples/ethtool: fix link with ixgbe shared lib
In reply to Markos ChandrasFrom: Markos Chandras <[email protected]>
When RTE_DEVEL_BUILD is unset, -rpath is unset. So the ethtool app cannot link with ixgbe shared library which is required by ethtool lib:
warning: librte_pmd_ixgbe.so.1, needed by examples/ethtool/lib/x86_64-native-linuxapp-gcc/lib/librte_ethtool.so, not found (try using -rpath or -rpath-link)
It is fixed by adding the library in the application link.
The library link is also improved to specify that this explicit link to ixgbe is needed only in the shared lib mode.
---
v2: add condition on CONFIG_RTE_BUILD_SHARED_LIB
--- examples/ethtool/ethtool-app/Makefile | 5 +++++ examples/ethtool/lib/Makefile | 2 ++ 2 files changed, 7 insertions(+)
examples/ethtool/ethtool-app/Makefile +5 -0
@@ -50,5 +50,10 @@ CFLAGS += $(WERROR_FLAGS) LDLIBS += -L$(subst ethtool-app,lib,$(RTE_OUTPUT))/lib LDLIBS += -lrte_ethtool +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y) +LDLIBS += -lrte_pmd_ixgbe +endif +endif include $(RTE_SDK)/mk/rte.extapp.mk
examples/ethtool/lib/Makefile +2 -0
@@ -54,8 +54,10 @@ SRCS-y := rte_ethtool.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y) LDLIBS += -lrte_pmd_ixgbe endif +endif include $(RTE_SDK)/mk/rte.extlib.mk
Signature · 1 line
2.12.2
Thomas Monjalon
AppliedRe: [PATCH v2] examples/ethtool: fix link with ixgbe shared lib
01/05/2017 22:10, Thomas Monjalon:
Quoted 15 lines
From: Markos Chandras <[email protected]>
When
RTE_DEVEL_BUILDis unset, -rpath is unset. So the ethtool app cannot link with ixgbe shared library which is required by ethtool lib:warning: librte_pmd_ixgbe.so.1, needed by examples/ethtool/lib/x86_64-native-linuxapp-gcc/lib/librte_ethtool.so, not found (try using -rpath or -rpath-link)
It is fixed by adding the library in the application link.
The library link is also improved to specify that this explicit link to ixgbe is needed only in the shared lib mode.
Quoted 8 lines
Fixes 077d223e25c3 ("examples/ethtool: use ixgbe public function")Signed-off-by Markos Chandras <[email protected]>Acked-by Remy Horton <[email protected]>Acked-by Timothy Redaelli <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>---
v2: add condition onCONFIG_RTE_BUILD_SHARED_LIB
Applied, thanks