From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tetsuya Mukawa Subject: Re: [PATCH v2] vhost: Fix linkage of vhost PMD Date: Wed, 27 Apr 2016 10:38:46 +0900 Message-ID: <57201826.30504@igel.co.jp> References: <571DDDD8.6000000@igel.co.jp> <1461649169-13967-1-git-send-email-mukawa@igel.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: yuanhan.liu@linux.intel.com, huawei.xie@intel.com, Thomas Monjalon To: Panu Matilainen , dev@dpdk.org Return-path: Received: from mail-pf0-f176.google.com (mail-pf0-f176.google.com [209.85.192.176]) by dpdk.org (Postfix) with ESMTP id B02202BAF for ; Wed, 27 Apr 2016 03:38:51 +0200 (CEST) Received: by mail-pf0-f176.google.com with SMTP id 206so13881481pfu.0 for ; Tue, 26 Apr 2016 18:38:51 -0700 (PDT) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 2016/04/26 18:35, Panu Matilainen wrote: > 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 >> Acked-by: Panu Matilainen >> --- >> 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 - Thanks for catching it. It seems I've already installed DPDK libraries in /usr/local/lib/. Then , I could not catch this error. I've confirmed your solution works fine. Thanks, Tetsuya