From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 128F31BBE for ; Tue, 26 Apr 2016 11:35:31 +0200 (CEST) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA69BC00F1DF; Tue, 26 Apr 2016 09:35:29 +0000 (UTC) Received: from sopuli.koti.laiskiainen.org (vpn1-5-6.ams2.redhat.com [10.36.5.6]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3Q9ZRRJ024643; Tue, 26 Apr 2016 05:35:28 -0400 To: Tetsuya Mukawa , dev@dpdk.org References: <571DDDD8.6000000@igel.co.jp> <1461649169-13967-1-git-send-email-mukawa@igel.co.jp> Cc: yuanhan.liu@linux.intel.com, huawei.xie@intel.com, Thomas Monjalon From: Panu Matilainen Message-ID: Date: Tue, 26 Apr 2016 12:35:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1461649169-13967-1-git-send-email-mukawa@igel.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Subject: Re: [dpdk-dev] [PATCH v2] vhost: Fix linkage of vhost PMD X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 09:35:31 -0000 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 -