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 D649D2B9E for ; Tue, 15 Mar 2016 07:24:11 +0100 (CET) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 22FD2D3C38; Tue, 15 Mar 2016 06:24:11 +0000 (UTC) Received: from sopuli.koti.laiskiainen.org (vpn1-6-63.ams2.redhat.com [10.36.6.63]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2F6O9Uv025204; Tue, 15 Mar 2016 02:24:10 -0400 To: Ferruh Yigit , dev@dpdk.org References: <56E6EA59.2010300@intel.com> From: Panu Matilainen Message-ID: <56E7AA89.9000107@redhat.com> Date: Tue, 15 Mar 2016 08:24:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56E6EA59.2010300@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 15 Mar 2016 06:24:11 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH v3 1/3] mk: clear up libm and librt linkage confusion 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, 15 Mar 2016 06:24:12 -0000 On 03/14/2016 06:44 PM, Ferruh Yigit wrote: > On 3/10/2016 1:15 PM, Panu Matilainen wrote: >> There are two places that need -lm (test app and librte_sched) and >> exactly one that needs -lrt (librte_sched). Add the relevant >> DT_NEEDED entries to both, and eliminate the bogus discrepancy >> between Linux and BSD EXECENV_LDLIBS wrt these libs. >> >> Signed-off-by: Panu Matilainen >> --- >> app/test/Makefile | 2 ++ >> lib/librte_sched/Makefile | 3 +++ >> mk/exec-env/linuxapp/rte.vars.mk | 2 +- >> mk/rte.app.mk | 6 ++---- >> 4 files changed, 8 insertions(+), 5 deletions(-) >> >> diff --git a/app/test/Makefile b/app/test/Makefile >> index ec33e1a..00e4df2 100644 >> --- a/app/test/Makefile >> +++ b/app/test/Makefile >> @@ -160,6 +160,8 @@ CFLAGS += $(WERROR_FLAGS) >> >> CFLAGS += -D_GNU_SOURCE >> >> +LDLIBS += -lm >> + >> # Disable VTA for memcpy test >> ifeq ($(CC), gcc) >> ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1) >> diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile >> index b1cb285..4d631f6 100644 >> --- a/lib/librte_sched/Makefile >> +++ b/lib/librte_sched/Makefile >> @@ -41,6 +41,9 @@ CFLAGS += $(WERROR_FLAGS) >> >> CFLAGS_rte_red.o := -D_GNU_SOURCE >> >> +LDLIBS += -lm >> +LDLIBS += -lrt >> + >> EXPORT_MAP := rte_sched_version.map >> >> LIBABIVER := 1 >> diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk >> index 5fd7d85..d51bd17 100644 >> --- a/mk/exec-env/linuxapp/rte.vars.mk >> +++ b/mk/exec-env/linuxapp/rte.vars.mk >> @@ -48,7 +48,7 @@ endif >> # Workaround lack of DT_NEEDED entry >> EXECENV_LDFLAGS = --no-as-needed >> >> -EXECENV_LDLIBS = -lrt -lm >> +EXECENV_LDLIBS = >> EXECENV_ASFLAGS = >> >> ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) >> diff --git a/mk/rte.app.mk b/mk/rte.app.mk >> index daac09f..cadc7ab 100644 >> --- a/mk/rte.app.mk >> +++ b/mk/rte.app.mk >> @@ -77,11 +77,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm >> _LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power >> _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl >> _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter >> - >> _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched >> -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm >> -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt >> - >> _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost >> >> ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y) >> @@ -104,6 +100,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore >> _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lgxio >> # QAT PMD has a dependency on libcrypto (from openssl) for calculating HMAC precomputes >> _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lcrypto >> +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm >> +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt >> endif # !CONFIG_RTE_BUILD_SHARED_LIBS >> >> _LDLIBS-y += --start-group >> > This is causing a shared library compilation error with gcc: > > " > == Build app/test-acl > LD testacl > /root/dpdk/build/lib/librte_meter.so: error: undefined reference to 'ceil' > collect2: error: ld returned 1 exit status > " > > There is an indirect libm dependency from test-acl. Adding -lm fixes the > issue. > > But this issue not seen by everybody, not sure why I am getting this but > not others. > > Also clang compiles fine, only fails with gcc. > I am using Fedora 23, gcc version: > gcc (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2) > > I will dig some more. Right, librte_meter indeed has a dependency on libm that I've missed. The curious thing is why is it not failing everywhere - I cannot reproduce that at all on Fedora 23. Poking around in math.h leads to bits/mathlinline.h where the answer probably lies: ceil() is typically provided by inline code, but for one reason or another that is not available in your setup. Anyway, I'll send a patch to add the missing dependency, thanks for spotting and reporting! - Panu - > Regards, > ferruh > > > >