Message ID | 1468835025-3333-1-git-send-email-thomas.monjalon@6wind.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 01FAC2C07; Mon, 18 Jul 2016 11:44:20 +0200 (CEST) Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 6CD272C07 for <dev@dpdk.org>; Mon, 18 Jul 2016 11:44:18 +0200 (CEST) Received: by mail-wm0-f44.google.com with SMTP id o80so108007244wme.1 for <dev@dpdk.org>; Mon, 18 Jul 2016 02:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=am3IGrezSEGXRDyugMHojKCTq0g2DfTT3UFMSzfPj0M=; b=AXHXeqhBEFgmvqtmXTLh/2rTqWjaphR6jPrQrBegciDhYOz+fdYxPN6a9GWEIug3QT /aZ7P2ncCRGOPRvcX64ld348ENsoR5z+W4nox154OHvl7pn6MTi1ngmdNGYSrR8dIXsr X4WgqcZRYpsyMSSz8rvPbze0gEzSE85LannEA8SQ6HM9VMyR2a0zZN5nrcec58Om7uGg X7uUMLk3s3Y8VDuGnK4R6akQsfpE0ugpvEU0ke+p3UlcsUbPwukxmllPTXeKA0yRBHee EZkpuptxGTRiic+aXVRi7nX8CGd65VG1ZOsMwAWY2JO8RA53k0lRDYOH6etrjkGS/+09 x2cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=am3IGrezSEGXRDyugMHojKCTq0g2DfTT3UFMSzfPj0M=; b=XQXzngFMSy9EEPH8c+tiLbRwVxTwEzuQepzewx/rh86KES8sOV9BtU3SCwJytjM7Ov xQxG2REdsnzWILey2oQhKLBow+t0KQB/NgoY4225jp57ugeMVOSkNxUoI8zJpTgfbd7A ljmlSxzgcvUwQHvUphrtwdi8n1Jpx1N0pRwxYMWuTDbvxYpIJdjn+83MyZCJm3yEImgI r1RFF5K887mxjKPovdrikNoBx9uTTqhNU+mgb1EVivnV1o1lDalDMV/VnsO8HjVf6hkF xC0Owv9TpeJ3YJnWbqGqAMXwGMbfHqcG/rISgy+CIcelMGVIo28aq5xwRzGHqwtVtWcm 8ctw== X-Gm-Message-State: ALyK8tKh4pgA6fMhfl1/7/ZEawtlzJpNFhgn+KBMyfRA63+U7J3kuHXdN/SG2d2iPF8g3LW7 X-Received: by 10.194.62.74 with SMTP id w10mr267583wjr.50.1468835058017; Mon, 18 Jul 2016 02:44:18 -0700 (PDT) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id kj4sm279205wjb.12.2016.07.18.02.44.16 for <dev@dpdk.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 02:44:17 -0700 (PDT) From: Thomas Monjalon <thomas.monjalon@6wind.com> To: dev@dpdk.org Date: Mon, 18 Jul 2016 11:43:45 +0200 Message-Id: <1468835025-3333-1-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 Subject: [dpdk-dev] [PATCH] mk: fix static link with glibc < 2.17 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Thomas Monjalon
July 18, 2016, 9:43 a.m. UTC
There is an error when linking static EAL library with an application:
eal_alarm.c:(.text+0xd7): undefined reference to `clock_gettime'
eal_alarm.c:(.text+0x20f): undefined reference to `clock_gettime'
eal_timer.c:(.text+0x108): undefined reference to `clock_gettime'
eal_timer.c:(.text+0x146): undefined reference to `clock_gettime'
The function clock_gettime() is in librt for old glibc.
Fixes: 281948b4753e ("mk: fix missing librt dependencies")
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
mk/rte.app.mk | 1 +
1 file changed, 1 insertion(+)
Comments
Tested-by: Yongjie Gu <yongjiex.gu@intel.com> - Check patch: success - Apply patch: success - compilation: success OS: fedora20 GCC: gcc_x86-64, 4.8.3 ICC: 16.0.2 Commit: 608487f3fc96704271c624d0f3fe9d7fb2187aea<http://dpdk.org/browse/dpdk/commit/?id=608487f3fc96704271c624d0f3fe9d7fb2187aea> i686-native-linuxapp-icc: compile pass x86_64-native-linuxapp-gcc-combined: compile pass i686-native-linuxapp-gcc: compile pass x86_64-native-linuxapp-gcc: compile pass x86_64-native-linuxapp-icc: compile pass x86_64-native-linuxapp-gcc-debug: compile pass x86_64-native-linuxapp-gcc-shared: compile pass x86_64-native-linuxapp-clang: compile pass OS: UB1204 GCC: 4.6.3 Kernel: 3.8.0-29 Commit: 608487f3fc96704271c624d0f3fe9d7fb2187aea<http://dpdk.org/browse/dpdk/commit/?id=608487f3fc96704271c624d0f3fe9d7fb2187aea> X86_64-ivshmem-linuxapp-gcc: compile pass Thanks Yongjie -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon Sent: Monday, July 18, 2016 5:44 PM To: dev@dpdk.org Subject: [dpdk-dev] [PATCH] mk: fix static link with glibc < 2.17 There is an error when linking static EAL library with an application: eal_alarm.c:(.text+0xd7): undefined reference to `clock_gettime' eal_alarm.c:(.text+0x20f): undefined reference to `clock_gettime' eal_timer.c:(.text+0x108): undefined reference to `clock_gettime' eal_timer.c:(.text+0x146): undefined reference to `clock_gettime' The function clock_gettime() is in librt for old glibc. Fixes: 281948b4753e ("mk: fix missing librt dependencies") Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com<mailto:thomas.monjalon@6wind.com>> --- mk/rte.app.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 886dbdd..eb28e11 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -151,6 +151,7 @@ _LDLIBS-y += --no-whole-archive ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # The static libraries do not know their dependencies. # So linking with static library requires explicit dependencies. +_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrt _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lm -- 2.7.0
> Tested-by: Yongjie Gu <yongjiex.gu@intel.com>
Applied
> > Tested-by: Yongjie Gu <yongjiex.gu@intel.com> > > Applied OS: UB1204 GCC: 4.6.4 Kernel: 3.13.0-45 glibc 2.15 x86_64-native-linuxapp-gcc: FAIL
2016-07-22 13:38, Azarewicz, PiotrX T: > > > Tested-by: Yongjie Gu <yongjiex.gu@intel.com> > > > > Applied > > OS: UB1204 > GCC: 4.6.4 > Kernel: 3.13.0-45 > glibc 2.15 > > x86_64-native-linuxapp-gcc: FAIL Please don't be a bot and explain us the error you see.
> > > > Tested-by: Yongjie Gu <yongjiex.gu@intel.com> > > > > > > Applied > > > > OS: UB1204 > > GCC: 4.6.4 > > Kernel: 3.13.0-45 > > glibc 2.15 > > > > x86_64-native-linuxapp-gcc: FAIL > > Please don't be a bot and explain us the error you see. I was trying rc3 + fix and latest (today) dpdk version. The same fail message: /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_timer.o): In function `get_tsc_freq': eal_timer.c:(.text+0x128): undefined reference to `clock_gettime' eal_timer.c:(.text+0x166): undefined reference to `clock_gettime' /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_alarm.o): In function `eal_alarm_callback': eal_alarm.c:(.text+0xda): undefined reference to `clock_gettime' /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_alarm.o): In function `rte_eal_alarm_set': eal_alarm.c:(.text+0x211): undefined reference to `clock_gettime'
2016-07-22 14:07, Azarewicz, PiotrX T: > > > > > Tested-by: Yongjie Gu <yongjiex.gu@intel.com> > > > > > > > > Applied > > > > > > OS: UB1204 > > > GCC: 4.6.4 > > > Kernel: 3.13.0-45 > > > glibc 2.15 > > > > > > x86_64-native-linuxapp-gcc: FAIL > > > > Please don't be a bot and explain us the error you see. > > I was trying rc3 + fix and latest (today) dpdk version. The same fail message: > > /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_timer.o): In function `get_tsc_freq': > eal_timer.c:(.text+0x128): undefined reference to `clock_gettime' > eal_timer.c:(.text+0x166): undefined reference to `clock_gettime' > /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_alarm.o): In function `eal_alarm_callback': > eal_alarm.c:(.text+0xda): undefined reference to `clock_gettime' > /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_alarm.o): In function `rte_eal_alarm_set': > eal_alarm.c:(.text+0x211): undefined reference to `clock_gettime' Interesting. Could check the command line in verbose mode to see where is -lrt please?
> > > > > > Tested-by: Yongjie Gu <yongjiex.gu@intel.com> > > > > > > > > > > Applied > > > > > > > > OS: UB1204 > > > > GCC: 4.6.4 > > > > Kernel: 3.13.0-45 > > > > glibc 2.15 > > > > > > > > x86_64-native-linuxapp-gcc: FAIL > > > > > > Please don't be a bot and explain us the error you see. > > > > I was trying rc3 + fix and latest (today) dpdk version. The same fail > message: > > > > /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_timer.o): In function > `get_tsc_freq': > > eal_timer.c:(.text+0x128): undefined reference to `clock_gettime' > > eal_timer.c:(.text+0x166): undefined reference to `clock_gettime' > > /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_alarm.o): In function > `eal_alarm_callback': > > eal_alarm.c:(.text+0xda): undefined reference to `clock_gettime' > > /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_alarm.o): In function > `rte_eal_alarm_set': > > eal_alarm.c:(.text+0x211): undefined reference to `clock_gettime' > > Interesting. > Could check the command line in verbose mode to see where is -lrt please? Here you are. -lrt is in separate line: gcc -o test -m64 -pthread -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -I/home/ptazarex/dpdk_master/x86_64-native-linuxapp-gcc/include -include /home/ptazarex/dpdk_master/x86_64-native-linuxapp-gcc/include/rte_config.h -O3 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Werror -Wno-missing-field-initializers -Wno-uninitialized -D_GNU_SOURCE commands.o test.o resource.o test_resource.o test_resource_c.res.o test_prefetch.o test_byteorder.o test_per_lcore.o test_atomic.o test_malloc.o test_cycles.o test_spinlock.o test_memory.o test_memzone.o test_ring.o test_ring_perf.o test_pmd_perf.o test_table.o test_table_pipeline.o test_table_tables.o test_table_ports.o test_table_combined.o test_table_acl.o test_rwlock.o test_timer.o test_timer_perf.o test_timer_racecond.o test_mempool.o test_mempool_perf.o test_mbuf.o test_logs.o test_memcpy.o test_memcpy_perf.o test_hash.o test_thash.o test_hash_perf.o test_hash_functions.o test_hash_scaling.o test_hash_multiwriter.o test_lpm.o test_lpm_perf.o test_lpm6.o test_lpm6_perf.o test_debug.o test_errno.o test_tailq.o test_string_fns.o test_cpuflags.o test_mp_secondary.o test_eal_flags.o test_eal_fs.o test_alarm.o test_interrupts.o test_version.o test_func_reentrancy.o test_cmdline.o test_cmdline_num.o test_cmdline_etheraddr.o test_cmdline_portlist.o test_cmdline_ipaddr.o test_cmdline_cirbuf.o test_cmdline_string.o test_cmdline_lib.o test_red.o test_sched.o test_meter.o test_kni.o test_power.o test_power_acpi_cpufreq.o test_power_kvm_vm.o test_common.o test_distributor.o test_distributor_perf.o test_reorder.o test_devargs.o virtual_pmd.o packet_burst_generator.o test_acl.o test_link_bonding.o test_link_bonding_mode4.o test_link_bonding_rssconf.o test_pmd_ring.o test_pmd_ring_perf.o test_cryptodev_aes.o test_cryptodev_perf.o test_cryptodev.o test_kvargs.o -Wl, -lrt -Wl,-lm -L/home/ptazarex/dpdk_master/x86_64-native-linuxapp-gcc/lib -Wl,-lrte_kni -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_pdump -Wl,-lrte_distributor -Wl,-lrte_reorder -Wl,-lrte_ip_frag -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lrte_lpm -Wl,--whole-archive -Wl,-lrte_acl -Wl,--no-whole-archive -Wl,-lrte_jobstats -Wl,-lrte_power -Wl,--whole-archive -Wl,-lrte_timer -Wl,-lrte_hash -Wl,-lrte_vhost -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lethdev -Wl,-lrte_cryptodev -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrte_pmd_af_packet -Wl,-lrte_pmd_bnxt -Wl,-lrte_pmd_cxgbe -Wl,-lrte_pmd_e1000 -Wl,-lrte_pmd_ena -Wl,-lrte_pmd_enic -Wl,-lrte_pmd_fm10k -Wl,-lrte_pmd_i40e -Wl,-lrte_pmd_ixgbe -Wl,-lrte_pmd_null -Wl,-lrte_pmd_ring -Wl,-lrte_pmd_virtio -Wl,-lrte_pmd_vhost -Wl,-lrte_pmd_vmxnet3_uio -Wl,-lrte_pmd_null_crypto -Wl,--no-whole-archive -Wl,-ldl -Wl,-export-dynamic -Wl,-export-dynamic -Wl,-export-dynamic -L/home/ptazarex/dpdk_master/x86_64-native-linuxapp-gcc/lib -Wl,--as-needed -Wl,-Map=test.map -Wl,--cref /home/ptazarex/dpdk_master/x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_timer.o): In function `get_tsc_freq': eal_timer.c:(.text+0x128): undefined reference to `clock_gettime'
2016-07-22 14:47, Azarewicz, PiotrX T: > > > I was trying rc3 + fix and latest (today) dpdk version. The same fail > > message: > > > > > > /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_timer.o): In function > > `get_tsc_freq': > > > eal_timer.c:(.text+0x128): undefined reference to `clock_gettime' > > > eal_timer.c:(.text+0x166): undefined reference to `clock_gettime' > > > /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_alarm.o): In function > > `eal_alarm_callback': > > > eal_alarm.c:(.text+0xda): undefined reference to `clock_gettime' > > > /x86_64-native-linuxapp-gcc/lib/librte_eal.a(eal_alarm.o): In function > > `rte_eal_alarm_set': > > > eal_alarm.c:(.text+0x211): undefined reference to `clock_gettime' > > > > Interesting. > > Could check the command line in verbose mode to see where is -lrt please? > > Here you are. > -lrt is in separate line: > > gcc -o test -m64 -pthread -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 [...] > test_cryptodev_aes.o test_cryptodev_perf.o test_cryptodev.o test_kvargs.o -Wl, > -lrt > -Wl,-lm -L/home/ptazarex/dpdk_master/x86_64-native-linuxapp-gcc/lib -Wl,-lrte_kni -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_pdump -Wl,-lrte_distributor -Wl,-lrte_reorder -Wl,-lrte_ip_frag -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lrte_lpm -Wl,--whole-archive -Wl,-lrte_acl -Wl,--no-whole-archive -Wl,-lrte_jobstats -Wl,-lrte_power -Wl,--whole-archive -Wl,-lrte_timer -Wl,-lrte_hash -Wl,-lrte_vhost -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lethdev -Wl,-lrte_cryptodev -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond - [...] The problem is that -lrt appears before -lrte_eal. The question is: where does it come from? It is even before _LDLIBS-y += -L$(RTE_SDK_BIN)/lib... mystery
> The problem is that -lrt appears before -lrte_eal. > The question is: where does it come from? > It is even before _LDLIBS-y += -L$(RTE_SDK_BIN)/lib... mystery root cause: commit c7cda4d8b4ea9cb0f209dda36882d225354b1db9 and my workaround is: /app/test/Makefile ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y) -LDLIBS += -lrt SRCS-y += test_red.c SRCS-y += test_sched.c endif
2016-07-25 11:13, Azarewicz, PiotrX T: > > The problem is that -lrt appears before -lrte_eal. > > The question is: where does it come from? > > It is even before _LDLIBS-y += -L$(RTE_SDK_BIN)/lib... mystery > > root cause: > commit c7cda4d8b4ea9cb0f209dda36882d225354b1db9 The error is seen after this commit, yes. But I would not say it is the root cause. The root cause is adding -lrt before other libs: 281948b4753e ("mk: fix missing librt dependencies") > and my workaround is: > /app/test/Makefile > > ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y) > -LDLIBS += -lrt > SRCS-y += test_red.c > SRCS-y += test_sched.c > endif Yes it is what I've done in this patch: http://dpdk.org/patch/15008
> > > The problem is that -lrt appears before -lrte_eal. > > > The question is: where does it come from? > > > It is even before _LDLIBS-y += -L$(RTE_SDK_BIN)/lib... mystery > > > > root cause: > > commit c7cda4d8b4ea9cb0f209dda36882d225354b1db9 > > The error is seen after this commit, yes. > But I would not say it is the root cause. Yes, you are right. > The root cause is adding -lrt before other libs: > 281948b4753e ("mk: fix missing librt dependencies") > > > and my workaround is: > > /app/test/Makefile > > > > ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y) > > -LDLIBS += -lrt > > SRCS-y += test_red.c > > SRCS-y += test_sched.c > > endif > > Yes it is what I've done in this patch: > http://dpdk.org/patch/15008 Great, thanks.
diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 886dbdd..eb28e11 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -151,6 +151,7 @@ _LDLIBS-y += --no-whole-archive ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # The static libraries do not know their dependencies. # So linking with static library requires explicit dependencies. +_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrt _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lm