From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7FF14A04AD; Fri, 1 May 2020 16:00:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ECDFC1DAA8; Fri, 1 May 2020 15:59:44 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 023EF1DA96 for ; Fri, 1 May 2020 15:59:43 +0200 (CEST) IronPort-SDR: FNTX212tei/qPYVcfJd0B3cJLyoLCXB8qyWXfn6d/GE9xfvfSQ+QHbd5+7pyyLAcJ7+MMi8zjw pFZlWfGGGugA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 06:59:43 -0700 IronPort-SDR: LU58bzzstVcYyHQ2h8/m6lhy9U25He5WFYFlMirS+8X/UIAnNeQAzWSKXjiMO7BtPiwjcFk12Y wC/I0TZs/2Uw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,339,1583222400"; d="scan'208";a="433318923" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga005.jf.intel.com with ESMTP; 01 May 2020 06:59:42 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, bluca@debian.org, david.marchand@redhat.com, ktraynor@redhat.com, Bruce Richardson Date: Fri, 1 May 2020 14:54:01 +0100 Message-Id: <20200501135401.28124-8-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200501135401.28124-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200501135401.28124-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 7/7] build/pkg-config: prevent overlinking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add the --as-needed linker flag to the DPDK library list in the pkg-config file so as to prevent overlinking. Without this flag, when linking statically using flags from $(pkg-config --static --libs libdpdk), all DPDK drivers and libs were statically linked in, but the binary was also requiring all the shared versions be present to run. The real root-cause of this issue is that the DPDK libraries need to be duplicated in the linker command when doing static linking, due to the behaviour of pkg-config, but since that behaviour cannot be easily changed, this is a simple workaround to avoid problems. Signed-off-by: Bruce Richardson --- V2: expand commit log to explain that pkg-config behaviour of part of the problem. --- buildtools/pkg-config/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build index e043c5ee1..5c1e31c4d 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -23,7 +23,7 @@ Use libdpdk.pc instead of this file to query DPDK compile/link arguments''', version: meson.project_version(), subdirs: [get_option('include_subdir_arch'), '.'], extra_cflags: pkg_extra_cflags, - libraries: dpdk_libraries, + libraries: ['-Wl,--as-needed'] + dpdk_libraries, libraries_private: dpdk_extra_ldflags) pkg.generate(name: 'DPDK', # main DPDK pkgconfig file -- 2.20.1