From patchwork Tue Jun 30 14:14:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 72457 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 131ADA0350; Tue, 30 Jun 2020 16:15:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A75BC1BFAD; Tue, 30 Jun 2020 16:14:57 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 512E51BFA2 for ; Tue, 30 Jun 2020 16:14:56 +0200 (CEST) IronPort-SDR: qPZLxgRowsD5JUunfxO9FBSF45lEe4mOV7wP9ioK2RlaFx01T2744DbCpC7Y1+dVndQwZlCNZe ASIaCfgPGruA== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="207754231" X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="207754231" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 07:14:55 -0700 IronPort-SDR: yA3iDZM9Qmw7OXA3uTIYNhdp4n/N1nGud91LV1I4xwnLFPt9Dg3Fgjwx9nTi9xHS4Yr11iX7eM zZDXsKW3WZeQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="303471423" Received: from silpixa00399126.ir.intel.com ([10.237.222.84]) by fmsmga004.fm.intel.com with ESMTP; 30 Jun 2020 07:14:52 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, ktraynor@redhat.com, bluca@debian.org, sunil.pai.g@intel.com, Bruce Richardson , Andrzej Ostruszka Date: Tue, 30 Jun 2020 15:14:27 +0100 Message-Id: <20200630141433.818517-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630141433.818517-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200630141433.818517-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 1/7] build: always link-whole DPDK static libraries 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" To ensure all constructors are included in static build, we need to pass the --whole-archive flag when linking, which is used with the "link_whole" meson option. Since we use link_whole for all libs, we no longer need to track the lib as part of the static dependency, just the path to the headers for compiling. After this patch is applied, all DPDK .a files are inside --whole-archive/--no-whole-archive flags, but external dependencies and shared libs being linked against remain outside. Signed-off-by: Bruce Richardson Tested-by: Andrzej Ostruszka Acked-by: Luca Boccassi Acked-by: Sunil Pai G Acked-by: Thomas Monjalon --- app/test/meson.build | 2 +- drivers/meson.build | 2 +- examples/meson.build | 6 +++--- lib/meson.build | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/test/meson.build b/app/test/meson.build index 5233ead46..b2a1c1273 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -415,7 +415,7 @@ test_dep_objs += cc.find_library('execinfo', required: false) link_libs = [] link_nodes = [] if get_option('default_library') == 'static' - link_libs = dpdk_drivers + link_libs = dpdk_static_libraries + dpdk_drivers link_nodes = dpdk_graph_nodes endif diff --git a/drivers/meson.build b/drivers/meson.build index 01c860c06..e78c76c55 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -200,7 +200,7 @@ foreach class:dpdk_driver_classes shared_dep = declare_dependency(link_with: shared_lib, include_directories: includes, dependencies: shared_deps) - static_dep = declare_dependency(link_with: static_lib, + static_dep = declare_dependency( include_directories: includes, dependencies: static_deps) diff --git a/examples/meson.build b/examples/meson.build index 3b540012f..120eebf71 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,10 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation -driver_libs = [] +link_whole_libs = [] node_libs = [] if get_option('default_library') == 'static' - driver_libs = dpdk_drivers + link_whole_libs = dpdk_static_libraries + dpdk_drivers node_libs = dpdk_graph_nodes endif @@ -101,7 +101,7 @@ foreach example: examples endif executable('dpdk-' + name, sources, include_directories: includes, - link_whole: driver_libs + node_libs, + link_whole: link_whole_libs + node_libs, link_args: dpdk_extra_ldflags, c_args: cflags, dependencies: dep_objs) diff --git a/lib/meson.build b/lib/meson.build index 4cbbca041..c1b9e1633 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -134,7 +134,7 @@ foreach l:libraries dependencies: static_deps, include_directories: includes, install: true) - static_dep = declare_dependency(link_with: static_lib, + static_dep = declare_dependency( include_directories: includes, dependencies: static_deps) From patchwork Tue Jun 30 14:14:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 72458 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3D92EA0350; Tue, 30 Jun 2020 16:15:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DCFB41BF9D; Tue, 30 Jun 2020 16:15:05 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id EFAA21BF80 for ; Tue, 30 Jun 2020 16:15:03 +0200 (CEST) IronPort-SDR: OCzjTnaAio6FkO8Sjv5US6KR2gbL7K+CITbcFIRn10Fl6dgCkTVhKEESbR0oX5LmsQPDjqgSfV Mcq9aBmaOwuQ== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="231109463" X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="231109463" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 07:15:03 -0700 IronPort-SDR: 1d8uBq3L+PKlvP9/tUsabMJymtOAjeDaM1uEVtVGYchckdI8PzU/aYHSfiXU1NWF9vfflj2MAR CM805PjVU7PA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="303471482" Received: from silpixa00399126.ir.intel.com ([10.237.222.84]) by fmsmga004.fm.intel.com with ESMTP; 30 Jun 2020 07:15:01 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, ktraynor@redhat.com, bluca@debian.org, sunil.pai.g@intel.com, Bruce Richardson Date: Tue, 30 Jun 2020 15:14:28 +0100 Message-Id: <20200630141433.818517-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630141433.818517-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200630141433.818517-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 2/7] build: remove unnecessary variable 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" Since all libraries are explicitly linked as part of a build, we no longer need to track ones that should be always included for linking against apps. Previously telemetry was special-cased for linking as it was not directly needed by the linker when linking the apps, since they never called into it directly. This meant that it could be forgotten when specifying the app dependencies, and so the telemetry support would not work. This special-casing was never needed for make as it always linked in all libraries, as meson does now. Signed-off-by: Bruce Richardson Acked-by: Luca Boccassi Acked-by: Sunil Pai G --- app/meson.build | 2 +- meson.build | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/meson.build b/app/meson.build index 408676b06..585b90832 100644 --- a/app/meson.build +++ b/app/meson.build @@ -37,7 +37,7 @@ foreach app:apps # use "deps" for internal DPDK dependencies, and "ext_deps" for # external package/library requirements ext_deps = [] - deps = dpdk_app_link_libraries + deps = [] subdir(name) diff --git a/meson.build b/meson.build index 750fdeab1..d6ca58b85 100644 --- a/meson.build +++ b/meson.build @@ -20,7 +20,6 @@ dpdk_graph_nodes = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = [] -dpdk_app_link_libraries = [] dpdk_libs_disabled = [] dpdk_drvs_disabled = [] abi_version_file = files('ABI_VERSION') From patchwork Tue Jun 30 14:14:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 72459 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CCA43A0350; Tue, 30 Jun 2020 16:15:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 48E1B1BFD4; Tue, 30 Jun 2020 16:15:15 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id A21F81BFBB for ; Tue, 30 Jun 2020 16:15:09 +0200 (CEST) IronPort-SDR: ykALDyIYRSvPnAAG1BXOLSZ6g+IvPsnqFybonr9TiUaFuFAwxE3ynawNLLhKnS1FFzgervfCMO jbcRP7kUYf3A== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="231109487" X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="231109487" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 07:15:09 -0700 IronPort-SDR: z7cH5VfKl2tjFBN+jin9on4NvNas+lsnZb2BCMUdg/PoagQdE2VH8fmwvLSOdXc1nK/tR+BzgS jpWkifcNifOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="303471518" Received: from silpixa00399126.ir.intel.com ([10.237.222.84]) by fmsmga004.fm.intel.com with ESMTP; 30 Jun 2020 07:15:07 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, ktraynor@redhat.com, bluca@debian.org, sunil.pai.g@intel.com, Bruce Richardson Date: Tue, 30 Jun 2020 15:14:29 +0100 Message-Id: <20200630141433.818517-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630141433.818517-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200630141433.818517-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 3/7] devtools/test-meson-builds.sh: add pkg-config static builds 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" The pkg-config file was tested by building some of the examples using make, pulling the cflags and ldflags from the pkg-config file for DPDK. However, this only tested the shared library linkage, and not the static, so this patch updates it to test both. Signed-off-by: Bruce Richardson Acked-by: Luca Boccassi Acked-by: Sunil Pai G --- devtools/test-meson-builds.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh index 64a022ccf..d96d1af5f 100755 --- a/devtools/test-meson-builds.sh +++ b/devtools/test-meson-builds.sh @@ -238,6 +238,6 @@ if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then export PKGCONF="pkg-config --define-prefix" for example in cmdline helloworld l2fwd l3fwd skeleton timer; do echo "## Building $example" - $MAKE -C $DESTDIR/usr/local/share/dpdk/examples/$example clean all + $MAKE -C $DESTDIR/usr/local/share/dpdk/examples/$example clean shared static done fi From patchwork Tue Jun 30 14:14:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 72460 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4B0D2A0350; Tue, 30 Jun 2020 16:16:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A85BC1BFE6; Tue, 30 Jun 2020 16:15:20 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id CCA571BF8D for ; Tue, 30 Jun 2020 16:15:18 +0200 (CEST) IronPort-SDR: 7YNjTL2LgtxW6KLPN3KvPsMNW5LeMQ11cDRLhm4yEbRjmAuhxfAZprm6fLMz18IktfcntoO6to Ze6opZqHvOVw== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="147784748" X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="147784748" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 07:15:17 -0700 IronPort-SDR: UOs225pdoTFzrPrZvjw2ms+WkYETibOJXOdIhSdgi6feFAMwQXrgRH/iexLM+VmFHj0Igvu7eB jEALbJl+dc9A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="303471536" Received: from silpixa00399126.ir.intel.com ([10.237.222.84]) by fmsmga004.fm.intel.com with ESMTP; 30 Jun 2020 07:15:15 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, ktraynor@redhat.com, bluca@debian.org, sunil.pai.g@intel.com, Bruce Richardson Date: Tue, 30 Jun 2020 15:14:30 +0100 Message-Id: <20200630141433.818517-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630141433.818517-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200630141433.818517-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 4/7] build: move pkg-config creation to separate file 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" Ahead of changes to rework the file, move the pkg-config file generation to a new directory under buildtools. This allows the meson code to be separated out from the main meson.build for simplicity, and also allows any additional scripts for working with the pkg-config files to be placed there too. Signed-off-by: Bruce Richardson Acked-by: Luca Boccassi Acked-by: Sunil Pai G --- buildtools/pkg-config/meson.build | 26 ++++++++++++++++++++++++++ meson.build | 25 ++----------------------- 2 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 buildtools/pkg-config/meson.build diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build new file mode 100644 index 000000000..85d59972d --- /dev/null +++ b/buildtools/pkg-config/meson.build @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +# for static builds, include the drivers as libs and we need to "whole-archive" +# them. +dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive'] + +pkg = import('pkgconfig') +pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args +if is_freebsd + pkg_extra_cflags += ['-D__BSD_VISIBLE'] +endif +pkg.generate(name: meson.project_name(), + filebase: 'lib' + meson.project_name().to_lower(), + version: meson.project_version(), + libraries: dpdk_libraries, + libraries_private: dpdk_drivers + dpdk_static_libraries + + ['-Wl,-Bdynamic'] + dpdk_extra_ldflags, + requires: libbsd, # apps using rte_string_fns.h may need this if enabled + # if libbsd is not enabled, then this is blank + description: '''The Data Plane Development Kit (DPDK). +Note that CFLAGS might contain an -march flag higher than typical baseline. +This is required for a number of static inline functions in the public headers.''', + subdirs: [get_option('include_subdir_arch'), '.'], + extra_cflags: pkg_extra_cflags +) diff --git a/meson.build b/meson.build index d6ca58b85..d21adfd30 100644 --- a/meson.build +++ b/meson.build @@ -70,29 +70,8 @@ configure_file(output: build_cfg, install_dir: join_paths(get_option('includedir'), get_option('include_subdir_arch'))) -# for static builds, include the drivers as libs and we need to "whole-archive" -# them. -dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive'] - -pkg = import('pkgconfig') -pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args -if is_freebsd - pkg_extra_cflags += ['-D__BSD_VISIBLE'] -endif -pkg.generate(name: meson.project_name(), - filebase: 'lib' + meson.project_name().to_lower(), - version: meson.project_version(), - libraries: dpdk_libraries, - libraries_private: dpdk_drivers + dpdk_static_libraries + - ['-Wl,-Bdynamic'] + dpdk_extra_ldflags, - requires: libbsd, # apps using rte_string_fns.h may need this if enabled - # if libbsd is not enabled, then this is blank - description: '''The Data Plane Development Kit (DPDK). -Note that CFLAGS might contain an -march flag higher than typical baseline. -This is required for a number of static inline functions in the public headers.''', - subdirs: [get_option('include_subdir_arch'), '.'], - extra_cflags: pkg_extra_cflags -) +# build pkg-config files for dpdk +subdir('buildtools/pkg-config') # final output, list all the libs and drivers to be built # this does not affect any part of the build, for information only. From patchwork Tue Jun 30 14:14:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 72461 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97DA7A0350; Tue, 30 Jun 2020 16:16:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E360D1C000; Tue, 30 Jun 2020 16:15:23 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id AB49D1BFFE for ; Tue, 30 Jun 2020 16:15:22 +0200 (CEST) IronPort-SDR: A5VqR/OvYFdHOMhDda/zg+OxHn3lxN/LQUHCBiBrceok+MMM4HD7gXFkP+r98SDQI2jhH9sU5Z +L2zTK43lQ/Q== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="147784758" X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="147784758" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 07:15:22 -0700 IronPort-SDR: poTPPBE64p38EQVnUwx/YKOKzB05aYtdCDglIkn1RSKC1tBiXna/7rvzkPsOK/Zuy+DrOLTaIX /61yDsoFIPvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="303471550" Received: from silpixa00399126.ir.intel.com ([10.237.222.84]) by fmsmga004.fm.intel.com with ESMTP; 30 Jun 2020 07:15:20 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, ktraynor@redhat.com, bluca@debian.org, sunil.pai.g@intel.com, Bruce Richardson Date: Tue, 30 Jun 2020 15:14:31 +0100 Message-Id: <20200630141433.818517-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630141433.818517-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200630141433.818517-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 5/7] build/pkg-config: output driver libs first for static build 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" When calling pkg-config --static --libs, pkg-config will always output the regular libs first, and then the extra libs from libraries.private field, since the assumption is that those are additional dependencies for building statically that the .a files depend upon. However, for DPDK, we only link the driver files for static builds, and those need to come *before* the regular libraries. To get this result, we need two pkgconfig files for DPDK, one for the shared libs, and a second for the static libs and drivers, which depends upon the first. Using a dependency means that the shared libs are printed only after the libraries.private field rather than before. Without this patch, the linking works in DPDK because in all cases we specify the libraries after the drivers in the Libs.private line, ensuring that the references to the libs from the drivers can be resolved. The current output is therefore of the form, "(shared)libs, drivers, (static)libs", while after this patch the output is, "drivers, (static)libs, (shared)libs". The former case will not work if we use the --whole-archive flag on the static libs as it will lead to duplicate definitions due to some references having been previously resolved from the shared libraries. By ensuring the shared libraries come last in the link link, this issue does not occur, as duplicate references when linking the shared libs will be ignored. Signed-off-by: Bruce Richardson Acked-by: Luca Boccassi Acked-by: Sunil Pai G --- buildtools/pkg-config/meson.build | 33 +++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build index 85d59972d..aabd00eed 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -10,17 +10,34 @@ pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args if is_freebsd pkg_extra_cflags += ['-D__BSD_VISIBLE'] endif -pkg.generate(name: meson.project_name(), - filebase: 'lib' + meson.project_name().to_lower(), + +# When calling pkg-config --static --libs, pkg-config will always output the +# regular libs first, and then the extra libs from libraries.private field, +# since the assumption is that those are additional dependencies for building +# statically that the .a files depend upon. However, for DPDK, we only link +# the driver files for static builds, and those need to come *before* the +# regular libraries. To get this result, we need two pkgconfig files for DPDK, +# one for the shared libs, and a second for the static libs and drivers, which +# depends upon the first. Using a dependency means that the shared libs are +# printed only after the libraries.private field rather than before. +pkg.generate(name: 'dpdk-libs', + filebase: 'libdpdk-libs', + description: '''Internal-only DPDK pkgconfig file. Not for direct use. +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_private: dpdk_drivers + dpdk_static_libraries + - ['-Wl,-Bdynamic'] + dpdk_extra_ldflags, - requires: libbsd, # apps using rte_string_fns.h may need this if enabled - # if libbsd is not enabled, then this is blank + libraries_private: dpdk_extra_ldflags) + +pkg.generate(name: 'DPDK', # main DPDK pkgconfig file + filebase: 'libdpdk', + version: meson.project_version(), description: '''The Data Plane Development Kit (DPDK). Note that CFLAGS might contain an -march flag higher than typical baseline. This is required for a number of static inline functions in the public headers.''', - subdirs: [get_option('include_subdir_arch'), '.'], - extra_cflags: pkg_extra_cflags + requires: ['libdpdk-libs', libbsd], # may need libbsd for string funcs + # if libbsd is not enabled, then this is blank + libraries_private: dpdk_drivers + dpdk_static_libraries + + ['-Wl,-Bdynamic'] ) From patchwork Tue Jun 30 14:14:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 72462 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59AEAA0350; Tue, 30 Jun 2020 16:16:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9CCB91BFD1; Tue, 30 Jun 2020 16:15:30 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 02DDA1BFBC for ; Tue, 30 Jun 2020 16:15:27 +0200 (CEST) IronPort-SDR: O4LdOpLamwxHiC2kV8EkHsXFfGkjzCEhxFis73cwuKJtQw3Ys+krSC2rCvvPHFyu+2ghA54jjS Xvu3Xre/n7Xg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="147784785" X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="147784785" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 07:15:27 -0700 IronPort-SDR: OsjEUixEPlc7UBJUevuByfa1FE2ruAn0Y2q29LRM+w2kBAlkVDE3vSTjItYCHztrx17iSJN4yW 25M4/0VsHcvw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="303471570" Received: from silpixa00399126.ir.intel.com ([10.237.222.84]) by fmsmga004.fm.intel.com with ESMTP; 30 Jun 2020 07:15:25 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, ktraynor@redhat.com, bluca@debian.org, sunil.pai.g@intel.com, Bruce Richardson Date: Tue, 30 Jun 2020 15:14:32 +0100 Message-Id: <20200630141433.818517-7-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630141433.818517-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200630141433.818517-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 6/7] build/pkg-config: improve static linking flags 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" Rather than setting -Bstatic in the linker flags when doing a static link, and then having to explicitly set -Bdynamic again afterwards, we can update the pkg-config file to use -l:libfoo.a syntax to explicitly refer to the static library in question. Since this syntax is not supported by meson's pkg-config module directly, we can post-process the .pc files instead to adjust them. Once done, we can simplify the examples' makefiles and the docs by removing the explicit static flag. Signed-off-by: Bruce Richardson Acked-by: Luca Boccassi Acked-by: Sunil Pai G Acked-by: Thomas Monjalon --- buildtools/pkg-config/meson.build | 13 ++++--- .../pkg-config/set-static-linker-flags.py | 38 +++++++++++++++++++ doc/guides/prog_guide/build-sdk-meson.rst | 2 +- examples/bbdev_app/Makefile | 2 +- examples/bond/Makefile | 2 +- examples/cmdline/Makefile | 2 +- examples/distributor/Makefile | 2 +- examples/eventdev_pipeline/Makefile | 2 +- examples/fips_validation/Makefile | 2 +- examples/flow_classify/Makefile | 2 +- examples/flow_filtering/Makefile | 2 +- examples/helloworld/Makefile | 2 +- examples/ioat/Makefile | 2 +- examples/ip_fragmentation/Makefile | 2 +- examples/ip_pipeline/Makefile | 2 +- examples/ip_reassembly/Makefile | 2 +- examples/ipsec-secgw/Makefile | 2 +- examples/ipv4_multicast/Makefile | 2 +- examples/kni/Makefile | 2 +- examples/l2fwd-cat/Makefile | 2 +- examples/l2fwd-crypto/Makefile | 2 +- examples/l2fwd-event/Makefile | 2 +- examples/l2fwd-jobstats/Makefile | 2 +- examples/l2fwd-keepalive/Makefile | 2 +- examples/l2fwd/Makefile | 2 +- examples/l3fwd-acl/Makefile | 2 +- examples/l3fwd-power/Makefile | 2 +- examples/l3fwd/Makefile | 2 +- examples/link_status_interrupt/Makefile | 2 +- examples/ntb/Makefile | 2 +- examples/packet_ordering/Makefile | 2 +- examples/ptpclient/Makefile | 2 +- examples/qos_meter/Makefile | 2 +- examples/qos_sched/Makefile | 2 +- examples/rxtx_callbacks/Makefile | 2 +- examples/service_cores/Makefile | 2 +- examples/skeleton/Makefile | 2 +- examples/tep_termination/Makefile | 2 +- examples/timer/Makefile | 2 +- examples/vdpa/Makefile | 2 +- examples/vhost/Makefile | 2 +- examples/vhost_blk/Makefile | 2 +- examples/vhost_crypto/Makefile | 2 +- examples/vmdq/Makefile | 2 +- examples/vmdq_dcb/Makefile | 2 +- 45 files changed, 88 insertions(+), 49 deletions(-) create mode 100644 buildtools/pkg-config/set-static-linker-flags.py diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build index aabd00eed..e043c5ee1 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -1,10 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2020 Intel Corporation -# for static builds, include the drivers as libs and we need to "whole-archive" -# them. -dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive'] - pkg = import('pkgconfig') pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args if is_freebsd @@ -38,6 +34,11 @@ Note that CFLAGS might contain an -march flag higher than typical baseline. This is required for a number of static inline functions in the public headers.''', requires: ['libdpdk-libs', libbsd], # may need libbsd for string funcs # if libbsd is not enabled, then this is blank - libraries_private: dpdk_drivers + dpdk_static_libraries + - ['-Wl,-Bdynamic'] + libraries_private: ['-Wl,--whole-archive'] + + dpdk_drivers + dpdk_static_libraries + + ['-Wl,--no-whole-archive'] ) + +# the pkg-config file generated is not best tuned for static linking so +# use a script to adjust the linker flags +run_command(py3, 'set-static-linker-flags.py', check: true) diff --git a/buildtools/pkg-config/set-static-linker-flags.py b/buildtools/pkg-config/set-static-linker-flags.py new file mode 100644 index 000000000..516c3678b --- /dev/null +++ b/buildtools/pkg-config/set-static-linker-flags.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +# Script to fix flags for static linking in pkgconfig files from meson +# Should be called from meson build itself +import os +import sys + + +def fix_ldflag(f): + if not f.startswith('-lrte_'): + return f + return '-l:lib' + f[2:] + '.a' + + +def fix_libs_private(line): + if not line.startswith('Libs.private'): + return line + ldflags = [fix_ldflag(flag) for flag in line.split()] + return ' '.join(ldflags) + '\n' + + +def process_pc_file(filepath): + print('Processing', filepath) + with open(filepath) as src: + lines = src.readlines() + with open(filepath, 'w') as dst: + dst.writelines([fix_libs_private(line) for line in lines]) + + +if 'MESON_BUILD_ROOT' not in os.environ: + print('This script must be called from a meson build environment') + sys.exit(1) +for root, dirs, files in os.walk(os.environ['MESON_BUILD_ROOT']): + pc_files = [f for f in files if f.endswith('.pc')] + for f in pc_files: + process_pc_file(os.path.join(root, f)) diff --git a/doc/guides/prog_guide/build-sdk-meson.rst b/doc/guides/prog_guide/build-sdk-meson.rst index 7679c049a..44d1cafdf 100644 --- a/doc/guides/prog_guide/build-sdk-meson.rst +++ b/doc/guides/prog_guide/build-sdk-meson.rst @@ -191,7 +191,7 @@ From examples/helloworld/Makefile:: PC_FILE := $(shell pkg-config --path libdpdk) CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) - LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + LDFLAGS_STATIC = $(shell pkg-config --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/bbdev_app/Makefile b/examples/bbdev_app/Makefile index ead3f016b..3c8eb75a4 100644 --- a/examples/bbdev_app/Makefile +++ b/examples/bbdev_app/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API diff --git a/examples/bond/Makefile b/examples/bond/Makefile index 2030ca410..4e4289e15 100644 --- a/examples/bond/Makefile +++ b/examples/bond/Makefile @@ -24,7 +24,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API diff --git a/examples/cmdline/Makefile b/examples/cmdline/Makefile index 9a33355d0..732509772 100644 --- a/examples/cmdline/Makefile +++ b/examples/cmdline/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/distributor/Makefile b/examples/distributor/Makefile index 63c14dfca..6e3fef981 100644 --- a/examples/distributor/Makefile +++ b/examples/distributor/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/eventdev_pipeline/Makefile b/examples/eventdev_pipeline/Makefile index 96cd24437..95a8d0884 100644 --- a/examples/eventdev_pipeline/Makefile +++ b/examples/eventdev_pipeline/Makefile @@ -24,7 +24,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/fips_validation/Makefile b/examples/fips_validation/Makefile index c207d11b9..b44ca2ee6 100644 --- a/examples/fips_validation/Makefile +++ b/examples/fips_validation/Makefile @@ -32,7 +32,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/flow_classify/Makefile b/examples/flow_classify/Makefile index 6864941b3..161d576b6 100644 --- a/examples/flow_classify/Makefile +++ b/examples/flow_classify/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API diff --git a/examples/flow_filtering/Makefile b/examples/flow_filtering/Makefile index e0d546de9..010a1383e 100644 --- a/examples/flow_filtering/Makefile +++ b/examples/flow_filtering/Makefile @@ -20,7 +20,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/helloworld/Makefile b/examples/helloworld/Makefile index 0f5af0806..94a1074cf 100644 --- a/examples/helloworld/Makefile +++ b/examples/helloworld/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/ioat/Makefile b/examples/ioat/Makefile index 9b277eb7b..86308854e 100644 --- a/examples/ioat/Makefile +++ b/examples/ioat/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/ip_fragmentation/Makefile b/examples/ip_fragmentation/Makefile index 8babbbf82..3f4db3f59 100644 --- a/examples/ip_fragmentation/Makefile +++ b/examples/ip_fragmentation/Makefile @@ -24,7 +24,7 @@ PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 3a0193818..1116bb6c1 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -35,7 +35,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -I. diff --git a/examples/ip_reassembly/Makefile b/examples/ip_reassembly/Makefile index 11be2a74a..be9e541bd 100644 --- a/examples/ip_reassembly/Makefile +++ b/examples/ip_reassembly/Makefile @@ -23,7 +23,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/ipsec-secgw/Makefile b/examples/ipsec-secgw/Makefile index c4a272a30..ab15fca9e 100644 --- a/examples/ipsec-secgw/Makefile +++ b/examples/ipsec-secgw/Makefile @@ -36,7 +36,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API diff --git a/examples/ipv4_multicast/Makefile b/examples/ipv4_multicast/Makefile index b9f0813ed..0ed78c1cc 100644 --- a/examples/ipv4_multicast/Makefile +++ b/examples/ipv4_multicast/Makefile @@ -23,7 +23,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/kni/Makefile b/examples/kni/Makefile index c7ca96d8a..8fcb67c61 100644 --- a/examples/kni/Makefile +++ b/examples/kni/Makefile @@ -23,7 +23,7 @@ PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/l2fwd-cat/Makefile b/examples/l2fwd-cat/Makefile index ca1202be1..d767a10d7 100644 --- a/examples/l2fwd-cat/Makefile +++ b/examples/l2fwd-cat/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) LDFLAGS += -lpqos diff --git a/examples/l2fwd-crypto/Makefile b/examples/l2fwd-crypto/Makefile index 2f1405a72..cdbb91a1e 100644 --- a/examples/l2fwd-crypto/Makefile +++ b/examples/l2fwd-crypto/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/l2fwd-event/Makefile b/examples/l2fwd-event/Makefile index 807f7f1b8..ddee388ae 100644 --- a/examples/l2fwd-event/Makefile +++ b/examples/l2fwd-event/Makefile @@ -28,7 +28,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/l2fwd-jobstats/Makefile b/examples/l2fwd-jobstats/Makefile index 6cd9dcd9c..bdb83c3e1 100644 --- a/examples/l2fwd-jobstats/Makefile +++ b/examples/l2fwd-jobstats/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/l2fwd-keepalive/Makefile b/examples/l2fwd-keepalive/Makefile index 0db5e6015..9fd9db497 100644 --- a/examples/l2fwd-keepalive/Makefile +++ b/examples/l2fwd-keepalive/Makefile @@ -24,7 +24,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/l2fwd/Makefile b/examples/l2fwd/Makefile index 8b7b26cb9..15105ac57 100644 --- a/examples/l2fwd/Makefile +++ b/examples/l2fwd/Makefile @@ -24,7 +24,7 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) # Add flag to allow experimental API as l2fwd uses rte_ethdev_set_ptype API CFLAGS += -DALLOW_EXPERIMENTAL_API LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/l3fwd-acl/Makefile b/examples/l3fwd-acl/Makefile index 9f31abef8..6644a2cf1 100644 --- a/examples/l3fwd-acl/Makefile +++ b/examples/l3fwd-acl/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/l3fwd-power/Makefile b/examples/l3fwd-power/Makefile index 852877c1f..ac1ccdcf6 100644 --- a/examples/l3fwd-power/Makefile +++ b/examples/l3fwd-power/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API diff --git a/examples/l3fwd/Makefile b/examples/l3fwd/Makefile index 839439f0f..b25a51581 100644 --- a/examples/l3fwd/Makefile +++ b/examples/l3fwd/Makefile @@ -23,7 +23,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/link_status_interrupt/Makefile b/examples/link_status_interrupt/Makefile index 613bb1167..f16916faa 100644 --- a/examples/link_status_interrupt/Makefile +++ b/examples/link_status_interrupt/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/ntb/Makefile b/examples/ntb/Makefile index f2920ed54..81ec6017f 100644 --- a/examples/ntb/Makefile +++ b/examples/ntb/Makefile @@ -27,7 +27,7 @@ PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/packet_ordering/Makefile b/examples/packet_ordering/Makefile index f5b68c97e..f99b69dc2 100644 --- a/examples/packet_ordering/Makefile +++ b/examples/packet_ordering/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/ptpclient/Makefile b/examples/ptpclient/Makefile index 7cd36632a..a9555fc66 100644 --- a/examples/ptpclient/Makefile +++ b/examples/ptpclient/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/qos_meter/Makefile b/examples/qos_meter/Makefile index 90e3533d1..165e07ee2 100644 --- a/examples/qos_meter/Makefile +++ b/examples/qos_meter/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API diff --git a/examples/qos_sched/Makefile b/examples/qos_sched/Makefile index 92e3de79b..0dd7d9105 100644 --- a/examples/qos_sched/Makefile +++ b/examples/qos_sched/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/rxtx_callbacks/Makefile b/examples/rxtx_callbacks/Makefile index 584b9fafb..10e5f14d5 100644 --- a/examples/rxtx_callbacks/Makefile +++ b/examples/rxtx_callbacks/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/service_cores/Makefile b/examples/service_cores/Makefile index aac207bd9..e742d88f6 100644 --- a/examples/service_cores/Makefile +++ b/examples/service_cores/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/skeleton/Makefile b/examples/skeleton/Makefile index 2612688c0..5f5acf715 100644 --- a/examples/skeleton/Makefile +++ b/examples/skeleton/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/tep_termination/Makefile b/examples/tep_termination/Makefile index 645112498..548ca3cee 100644 --- a/examples/tep_termination/Makefile +++ b/examples/tep_termination/Makefile @@ -24,7 +24,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -Wno-deprecated-declarations diff --git a/examples/timer/Makefile b/examples/timer/Makefile index e58e90a28..b40b65995 100644 --- a/examples/timer/Makefile +++ b/examples/timer/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/vdpa/Makefile b/examples/vdpa/Makefile index 6a25497cd..bc0b6793e 100644 --- a/examples/vdpa/Makefile +++ b/examples/vdpa/Makefile @@ -23,7 +23,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/vhost/Makefile b/examples/vhost/Makefile index f2b161541..ef6f3550f 100644 --- a/examples/vhost/Makefile +++ b/examples/vhost/Makefile @@ -24,7 +24,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API diff --git a/examples/vhost_blk/Makefile b/examples/vhost_blk/Makefile index 39244320d..395279178 100644 --- a/examples/vhost_blk/Makefile +++ b/examples/vhost_blk/Makefile @@ -25,7 +25,7 @@ LDFLAGS += -pthread PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) CFLAGS += -DALLOW_EXPERIMENTAL_API diff --git a/examples/vhost_crypto/Makefile b/examples/vhost_crypto/Makefile index ae8cb81f8..28e3e4de7 100644 --- a/examples/vhost_crypto/Makefile +++ b/examples/vhost_crypto/Makefile @@ -23,7 +23,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/vmdq/Makefile b/examples/vmdq/Makefile index 98e644fa7..b73373d3f 100644 --- a/examples/vmdq/Makefile +++ b/examples/vmdq/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) diff --git a/examples/vmdq_dcb/Makefile b/examples/vmdq_dcb/Makefile index 3eb7c9f43..8d8baf729 100644 --- a/examples/vmdq_dcb/Makefile +++ b/examples/vmdq_dcb/Makefile @@ -22,7 +22,7 @@ PKGCONF ?= pkg-config PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) -LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) From patchwork Tue Jun 30 14:14:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 72463 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B9D1DA0350; Tue, 30 Jun 2020 16:16:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1EAC61C030; Tue, 30 Jun 2020 16:15:32 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3E6511C025 for ; Tue, 30 Jun 2020 16:15:31 +0200 (CEST) IronPort-SDR: KrWQ7NaOtVGEKplNIE6rvhpDEHJD6H2Coqmg3uNIbFUo0Y9u2z/HLHb5z8mul08Jr92tYKYvww f6HBDSh4MpFg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="147784799" X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="147784799" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 07:15:30 -0700 IronPort-SDR: 7mqCNbYDcmOR4wCv+ZdcGawMN/owd0jYplvXw7B+jYwU9CACQT3n4f517mYOkBa3L/qbwLkyg4 9YdGRKI1ticw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="303471600" Received: from silpixa00399126.ir.intel.com ([10.237.222.84]) by fmsmga004.fm.intel.com with ESMTP; 30 Jun 2020 07:15:29 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, ktraynor@redhat.com, bluca@debian.org, sunil.pai.g@intel.com, Bruce Richardson Date: Tue, 30 Jun 2020 15:14:33 +0100 Message-Id: <20200630141433.818517-8-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630141433.818517-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200630141433.818517-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 Acked-by: Luca Boccassi Acked-by: Sunil Pai G --- 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