From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v3 1/3] mk: clear up libm and librt linkage confusion Date: Mon, 14 Mar 2016 16:44:09 +0000 Message-ID: <56E6EA59.2010300@intel.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: Panu Matilainen To: dev@dpdk.org Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B49B437A6 for ; Mon, 14 Mar 2016 17:44:11 +0100 (CET) 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 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. >=20 > 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(-) >=20 > 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 +=3D $(WERROR_FLAGS) > =20 > CFLAGS +=3D -D_GNU_SOURCE > =20 > +LDLIBS +=3D -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 +=3D $(WERROR_FLAGS) > =20 > CFLAGS_rte_red.o :=3D -D_GNU_SOURCE > =20 > +LDLIBS +=3D -lm > +LDLIBS +=3D -lrt > + > EXPORT_MAP :=3D rte_sched_version.map > =20 > LIBABIVER :=3D 1 > diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rt= e.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 =3D --no-as-needed > =20 > -EXECENV_LDLIBS =3D -lrt -lm > +EXECENV_LDLIBS =3D > EXECENV_ASFLAGS =3D > =20 > 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) +=3D -lr= te_lpm > _LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) +=3D -lrte_power > _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) +=3D -lrte_acl > _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) +=3D -lrte_meter > - > _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) +=3D -lrte_sched > -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) +=3D -lm > -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) +=3D -lrt > - > _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) +=3D -lrte_vhost > =20 > ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y) > @@ -104,6 +100,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) +=3D -l= xenstore > _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) +=3D -lgxio > # QAT PMD has a dependency on libcrypto (from openssl) for calculating= HMAC precomputes > _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) +=3D -lcrypto > +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) +=3D -lm > +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) +=3D -lrt > endif # !CONFIG_RTE_BUILD_SHARED_LIBS > =20 > _LDLIBS-y +=3D --start-group >=20 This is causing a shared library compilation error with gcc: " =3D=3D 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. Regards, ferruh