From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 3F5022A5E for ; Mon, 3 Oct 2016 19:28:13 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 03 Oct 2016 10:28:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,438,1473145200"; d="scan'208";a="15729998" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga006.fm.intel.com with ESMTP; 03 Oct 2016 10:28:11 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u93HSA0p014334; Mon, 3 Oct 2016 18:28:10 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u93HSAOq025208; Mon, 3 Oct 2016 18:28:10 +0100 Received: (from kananye1@localhost) by sivswdev02.ir.intel.com with œ id u93HSALR025204; Mon, 3 Oct 2016 18:28:10 +0100 From: Konstantin Ananyev To: dev@dpdk.org Cc: Konstantin Ananyev Date: Mon, 3 Oct 2016 18:27:25 +0100 Message-Id: <1475515645-24667-1-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.0.7 To: dev@dpdk.org Subject: [dpdk-dev] [PATCH] eal: fix c++ compilation issue with rte_delay_us() 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: Mon, 03 Oct 2016 17:28:13 -0000 When compiling with C++, it treats void (*rte_delay_us)(unsigned int us); as definition of the global variable. So further linking with librte_eal fails. Fixes: b4d63fb62240 ("eal: customize delay function") Steps to reproduce: $ cat rttm1.cpp #include #include #include using namespace std; int main(int argc, char *argv[]) { int ret = rte_eal_init(argc, argv); rte_delay_us(1); cout << "return code "; cout << ret; return ret; } $ g++ -m64 -I/${RTE_SDK}/${RTE_TARGET}/include -c -o rttm1.o rttm1.cpp $ gcc -m64 -pthread -o rttm1 rttm1.o -ldl -Wl,-lstdc++ \ -L/${RTE_SDK}/${RTE_TARGET}/lib -Wl,-lrte_eal .../librte_eal.a(eal_common_timer.o): (.bss+0x0): multiple definition of `rte_delay_us' rttm1.o:(.bss+0x0): first defined here collect2: error: ld returned 1 exit status $ nm rttm1.o | grep rte_delay_us 0000000000000092 t _GLOBAL__sub_I_rte_delay_us 0000000000000000 B rte_delay_us Signed-off-by: Konstantin Ananyev --- lib/librte_eal/common/include/generic/rte_cycles.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/common/include/generic/rte_cycles.h b/lib/librte_eal/common/include/generic/rte_cycles.h index 96a2da9..00103ca 100644 --- a/lib/librte_eal/common/include/generic/rte_cycles.h +++ b/lib/librte_eal/common/include/generic/rte_cycles.h @@ -188,7 +188,7 @@ rte_get_timer_hz(void) * @param us * The number of microseconds to wait. */ -void +extern void (*rte_delay_us)(unsigned int us); /** -- 2.4.3