From patchwork Wed Apr 29 10:08:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 69529 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 D4CCFA00BE; Wed, 29 Apr 2020 12:13:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4A49A1D919; Wed, 29 Apr 2020 12:13:44 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 4EE051D917 for ; Wed, 29 Apr 2020 12:13:43 +0200 (CEST) IronPort-SDR: hPTjPgDVz2EDEfIQSEfWZbXUof74Zi8+E0D2UQRDEvOI7ekGDfcJfOW+XP4IrVrZa+eMp1lIZi KbohhDl4M5cg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 03:13:42 -0700 IronPort-SDR: r/OnJgRqTGUw2zUCiKQrt1s4GuyLKLmtk6pTyn7bRLH68ubOx2j00A28WPZwwDrOT1WE0VOA9Q rZ3Zv2+7plzA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,331,1583222400"; d="scan'208";a="336915976" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga001.jf.intel.com with ESMTP; 29 Apr 2020 03:13:41 -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: Wed, 29 Apr 2020 11:08:25 +0100 Message-Id: <20200429100831.398-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429100831.398-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 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. Signed-off-by: Bruce Richardson Tested-by: Andrzej Ostruszka --- 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 fc60acbe7..5f2c803d6 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -400,7 +400,7 @@ test_dep_objs += cc.find_library('execinfo', required: false) link_libs = [] if get_option('default_library') == 'static' - link_libs = dpdk_drivers + link_libs = dpdk_static_libraries + dpdk_drivers endif dpdk_test = executable('dpdk-test', diff --git a/drivers/meson.build b/drivers/meson.build index dc293b270..53c2ff0f3 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -196,7 +196,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 1f2b6f516..ec6bd5a08 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,9 +1,9 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation -driver_libs = [] +link_whole_libs = [] if get_option('default_library') == 'static' - driver_libs = dpdk_drivers + link_whole_libs = dpdk_static_libraries + dpdk_drivers endif execinfo = cc.find_library('execinfo', required: false) @@ -99,7 +99,7 @@ foreach example: examples endif executable('dpdk-' + name, sources, include_directories: includes, - link_whole: driver_libs, + link_whole: link_whole_libs, link_args: dpdk_extra_ldflags, c_args: cflags, dependencies: dep_objs) diff --git a/lib/meson.build b/lib/meson.build index 07a65a625..44b850033 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -128,7 +128,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 Wed Apr 29 10:08:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 69530 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 895BAA00BE; Wed, 29 Apr 2020 12:13:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C309D1D959; Wed, 29 Apr 2020 12:13:47 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D74631D93D for ; Wed, 29 Apr 2020 12:13:45 +0200 (CEST) IronPort-SDR: c/O4CwPXcV+zSaLXuJ7ulEcA8/8mzrGOxJFtoxDUGQUqbjI3bExk1iVjxUQtEcpRsBgo4kNY38 SrXLbyKJN1Jw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 03:13:45 -0700 IronPort-SDR: 8gL6OCcbJezWdpqMIMmve/6wgzYZs0wjjHQiigPBUWpb/Psi56qXJrPNuSSYvk/eq9DJIQk6mt 4dY5Ei5A3MyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,331,1583222400"; d="scan'208";a="336915982" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga001.jf.intel.com with ESMTP; 29 Apr 2020 03:13:44 -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: Wed, 29 Apr 2020 11:08:26 +0100 Message-Id: <20200429100831.398-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429100831.398-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 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. Signed-off-by: Bruce Richardson --- app/meson.build | 2 +- lib/librte_telemetry/meson.build | 1 - meson.build | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/meson.build b/app/meson.build index 0f7fe9464..25f2da82e 100644 --- a/app/meson.build +++ b/app/meson.build @@ -36,7 +36,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/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build index 1bdf128c1..c6e8cc5de 100644 --- a/lib/librte_telemetry/meson.build +++ b/lib/librte_telemetry/meson.build @@ -8,7 +8,6 @@ deps += ['metrics', 'ethdev'] jansson = dependency('jansson', required: false) if jansson.found() ext_deps += jansson - dpdk_app_link_libraries += ['telemetry'] else build = false reason = 'missing dependency "jansson"' diff --git a/meson.build b/meson.build index d36580438..d8504afbf 100644 --- a/meson.build +++ b/meson.build @@ -19,7 +19,6 @@ dpdk_static_libraries = [] 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 Wed Apr 29 10:08: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: 69531 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 43E3DA00BE; Wed, 29 Apr 2020 12:14:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3C4EC1D983; Wed, 29 Apr 2020 12:13:51 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 10A3F1D964 for ; Wed, 29 Apr 2020 12:13:47 +0200 (CEST) IronPort-SDR: VzUmtJmAFnzKfFPr8uf9cwdSgLsWSITgIu+dnhRsgFXBTTsvAlIQ5XO8To1zTXxHZQh3NDPi8j D/aLxMgsX7fQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 03:13:47 -0700 IronPort-SDR: ssl+MylGA2isppJnNPWduKmaJxXKnft7c971HrM164yQbnRHEPE2YbX+l2cbaMAy0YOSRFv6en bBI0kgHSwSmg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,331,1583222400"; d="scan'208";a="336915996" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga001.jf.intel.com with ESMTP; 29 Apr 2020 03:13:46 -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: Wed, 29 Apr 2020 11:08:27 +0100 Message-Id: <20200429100831.398-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429100831.398-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 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 --- 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 e8df01759..132b801e6 100755 --- a/devtools/test-meson-builds.sh +++ b/devtools/test-meson-builds.sh @@ -219,6 +219,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 Wed Apr 29 10:08: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: 69532 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 21163A00BE; Wed, 29 Apr 2020 12:14:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C7F01D987; Wed, 29 Apr 2020 12:13:55 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 92FCF1D977 for ; Wed, 29 Apr 2020 12:13:50 +0200 (CEST) IronPort-SDR: 6DfcDXLXCXenH+GWjEQtPbfKklDgXF1bdNzggflPhM0i15F0cbQuw1QtKVzZgu8jNXcw4BmfD1 juTaczpAiM8w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 03:13:50 -0700 IronPort-SDR: Sh3xWZqE+G/I0bVGF3jQNgHmzmbrOhsZOpqT0PEbfET2LbAedHbKluZN1YLerQbyi34vJbW7UG OCqzrOKrcPdQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,331,1583222400"; d="scan'208";a="336916006" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga001.jf.intel.com with ESMTP; 29 Apr 2020 03:13:48 -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: Wed, 29 Apr 2020 11:08:28 +0100 Message-Id: <20200429100831.398-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429100831.398-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 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 --- 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 d8504afbf..5e46ebd8d 100644 --- a/meson.build +++ b/meson.build @@ -60,29 +60,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 Wed Apr 29 10:08: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: 69533 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 ADEFBA00BE; Wed, 29 Apr 2020 12:14:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6BF341D9B4; Wed, 29 Apr 2020 12:13:56 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 397921D939 for ; Wed, 29 Apr 2020 12:13:53 +0200 (CEST) IronPort-SDR: PkD8mJ0Zrbv7YMf0HmZ2sa5LZZA3P+KZ4esSa/10tFWGdq0yqdYb7dS73IxFREYk1iJsWggWQQ IvSy7ONF1TXw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 03:13:52 -0700 IronPort-SDR: YouFVpx809d9TDbb+OTBevX9Ifji4LLkjNxHZyzhq+IX/Mmpd9bTuZkN1+9+grLs5iClFgvzbe 1Qz/tagBCo7A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,331,1583222400"; d="scan'208";a="336916016" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga001.jf.intel.com with ESMTP; 29 Apr 2020 03:13:51 -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: Wed, 29 Apr 2020 11:08:29 +0100 Message-Id: <20200429100831.398-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429100831.398-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 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. Signed-off-by: Bruce Richardson --- buildtools/pkg-config/meson.build | 32 +++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build index 85d59972d..f08ca54ed 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -10,17 +10,33 @@ 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: 'The Data Plane Development Kit (DPDK), libraries only.', 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 Wed Apr 29 10:08: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: 69534 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 8F97DA00BE; Wed, 29 Apr 2020 12:14:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AEAFF1D9B0; Wed, 29 Apr 2020 12:14:02 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id F2A001D9AF for ; Wed, 29 Apr 2020 12:13:55 +0200 (CEST) IronPort-SDR: w3uarCX5j3kbukW/b++AgJ56RKwSAMYj2QBeonKMRS6PDzT0WTKGJMxdGUri4h2PJuVpJZDDB1 OVRjQeg8cPiw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 03:13:55 -0700 IronPort-SDR: tsZYOrGIPBw6Z5hI7VZkNL0/O4TuDmU2fS1op9xRQLmYPfgIxHzxsHp0EDQz3SX/j1/K7Ym+wO pJJUxi5WoKyQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,331,1583222400"; d="scan'208";a="336916026" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga001.jf.intel.com with ESMTP; 29 Apr 2020 03:13:53 -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: Wed, 29 Apr 2020 11:08:30 +0100 Message-Id: <20200429100831.398-7-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429100831.398-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 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 --- 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 f08ca54ed..bc723317c 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 @@ -37,6 +33,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 729d49639..74441f98c 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 Wed Apr 29 10:08: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: 69535 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 7F431A00BE; Wed, 29 Apr 2020 12:14:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E5AAE1D67C; Wed, 29 Apr 2020 12:14:03 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 985841D9B0 for ; Wed, 29 Apr 2020 12:13:58 +0200 (CEST) IronPort-SDR: xRSE0Lydj+o7En91XLzYjbNRxXPX/86cN9O+/0fwJZ/x0MjxeBWHU1jsJkY5Ua4Pt3p10Me78M KWrRu9LYeMYg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 03:13:58 -0700 IronPort-SDR: ObM78wiuYpqAJo1vYPi8LpevJuHZmQRv0k99stMrjgURkTngq9UQBKFCZ5k5YFeB8aKoQNQzII UdHoJzdDEclg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,331,1583222400"; d="scan'208";a="336916040" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga001.jf.intel.com with ESMTP; 29 Apr 2020 03:13:56 -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: Wed, 29 Apr 2020 11:08:31 +0100 Message-Id: <20200429100831.398-8-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429100831.398-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 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. Signed-off-by: Bruce Richardson --- 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 bc723317c..07b556288 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -22,7 +22,7 @@ pkg.generate(name: 'dpdk-libs', 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