[dpdk-dev] [PATCH v2] vhost: Fix linkage of vhost PMD
Panu Matilainen
pmatilai at redhat.com
Tue Apr 26 11:35:27 CEST 2016
On 04/26/2016 08:39 AM, Tetsuya Mukawa wrote:
> Currently, vhost PMD doesn't have linkage for librte_vhost, even though
> it depends on librte_vhost APIs. This causes a linkage error if below
> conditions are fulfilled.
>
> - DPDK libraries are compiled as shared libraries.
> - DPDK application doesn't link librte_vhost.
> - Above application tries to link vhost PMD using '-d' DPDK option.
>
> The patch adds linkage for librte_vhost to vhost PMD not to cause an
> above error.
>
> Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp>
> Acked-by: Panu Matilainen <pmatilai at redhat.com>
> ---
> drivers/net/vhost/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile
> index f49a69b..30b91a0 100644
> --- a/drivers/net/vhost/Makefile
> +++ b/drivers/net/vhost/Makefile
> @@ -38,6 +38,7 @@ LIB = librte_pmd_vhost.a
>
> CFLAGS += -O3
> CFLAGS += $(WERROR_FLAGS)
> +LDLIBS += -lrte_vhost
>
> EXPORT_MAP := rte_pmd_vhost_version.map
>
>
Hmm, turns out this isn't quite enough, simply because its the first of
its kind (first internal dependency between libraries), at least I'm
getting:
== Build drivers/net/vhost
gcc -m64
-Wl,--version-script=/srv/work/dist/dpdk/dpdk-16.04/drivers/net/vhost/rte_pmd_vhost_version.map
-shared rte_eth_vhost.o -lrte_vhost -Wl,-soname,librte_pmd_vhost.so.1
-o librte_pmd_vhost.so.1
/usr/bin/ld: cannot find -lrte_vhost
collect2: error: ld returned 1 exit status
/srv/work/dist/dpdk/dpdk-16.04/mk/rte.lib.mk:127: recipe for target
'librte_pmd_vhost.so.1' failed
So it'll need something like this as a pre-requisite to add the internal
libraries to the linker path:
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 8f7e021..f5d7b04 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -86,7 +86,7 @@ O_TO_A_DO = @set -e; \
$(O_TO_A) && \
echo $(O_TO_A_CMD) > $(call exe2cmd,$(@))
-O_TO_S = $(LD) $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS) -shared $(OBJS-y)
$(LDLIBS) \
+O_TO_S = $(LD) -L$(RTE_OUTPUT)/lib $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS)
-shared $(OBJS-y) $(LDLIBS) \
-Wl,-soname,$(LIB) -o $(LIB)
O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")
I can submit an official patch for this later but I'm not exactly
feeling like the sharpest knife in the drawer today so if somebody beats
me to it, feel free.
- Panu -
More information about the dev
mailing list