From patchwork Fri May 1 13:53:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 69642 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 6A930A04AD; Fri, 1 May 2020 15:59:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4276B1DA58; Fri, 1 May 2020 15:59:29 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A49CC1DA56 for ; Fri, 1 May 2020 15:59:27 +0200 (CEST) IronPort-SDR: S8nTaYwhmmaX7/uLimfVgzFwtSqOIeNf5M1B+7mRqGNnwl91CNbsSskrRO/4Dxk+jr4WRaUlo8 qJ4rqGef7+1g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 06:59:26 -0700 IronPort-SDR: a7yqlSXcp2uCLfR1JZUl2OAB3d3Bc5w+EuMeHAiR3/YGCGqV71qoUKuFbH4+VDpWkYPentLI+8 QjGsZpZY4paw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,339,1583222400"; d="scan'208";a="433318842" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga005.jf.intel.com with ESMTP; 01 May 2020 06:59:24 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, bluca@debian.org, david.marchand@redhat.com, ktraynor@redhat.com, Bruce Richardson , Andrzej Ostruszka Date: Fri, 1 May 2020 14:53:55 +0100 Message-Id: <20200501135401.28124-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200501135401.28124-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200501135401.28124-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 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 --- V2: amended git log to clarify that external dependencies are unaffected by this change --- 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 Fri May 1 13:53:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 69643 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 857C2A04AE; Fri, 1 May 2020 15:59:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B68631DA62; Fri, 1 May 2020 15:59:31 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id CC1A91DA5C for ; Fri, 1 May 2020 15:59:29 +0200 (CEST) IronPort-SDR: qZWsegL7gJofE1XeuM1Oxe3tiLD2Z28k2iWyuDf7zW4y/A47pcFUvxosmVDKdwBmfmyAiGdCKP HFYRkETxlxMg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 06:59:29 -0700 IronPort-SDR: +DIg2qiXgrDy06i52bFlhT+91F/o/gIu/7g5qz1k8UOOUai4dkyvUA6f7jZRLlQrHymj2Zb96Z PklgWnfrEc4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,339,1583222400"; d="scan'208";a="433318856" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga005.jf.intel.com with ESMTP; 01 May 2020 06:59:28 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, bluca@debian.org, david.marchand@redhat.com, ktraynor@redhat.com, Bruce Richardson Date: Fri, 1 May 2020 14:53:56 +0100 Message-Id: <20200501135401.28124-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200501135401.28124-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200501135401.28124-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 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 --- V2: added more detail on the history to the commit log --- 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 Fri May 1 13:53:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 69644 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 27413A04AD; Fri, 1 May 2020 15:59:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EEBAC1DA6E; Fri, 1 May 2020 15:59:33 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 388AB1DA65 for ; Fri, 1 May 2020 15:59:32 +0200 (CEST) IronPort-SDR: /B8NsDlWUMzw33yHBrJsJZ9CehdkvciA/+2BivUe8u1DEF7odWPa1S0zieUYVgXDAA3WPfuHr7 6bbwu7saD3NA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 06:59:31 -0700 IronPort-SDR: geXHMh5FE3JpzIUstvq5fwxFDYrVI0bt/d6zUWICnibTN+fhWD19E8AZkTLDA+LbkJfoez5v8b 7/uWXQm512YQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,339,1583222400"; d="scan'208";a="433318868" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga005.jf.intel.com with ESMTP; 01 May 2020 06:59:30 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, bluca@debian.org, david.marchand@redhat.com, ktraynor@redhat.com, Bruce Richardson Date: Fri, 1 May 2020 14:53:57 +0100 Message-Id: <20200501135401.28124-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200501135401.28124-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200501135401.28124-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 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 Fri May 1 13:53:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 69645 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 404FEA04AD; Fri, 1 May 2020 15:59:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7B1EE1DA6D; Fri, 1 May 2020 15:59:38 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id D99441DA73 for ; Fri, 1 May 2020 15:59:35 +0200 (CEST) IronPort-SDR: ZfuCk+s+anIw3z1H8ZlWVEp4OoP1M0ye7FCzuAUxZ5gqvzgtGBA4+nQ9a5g0GopkpweyrXUX1W OF+NGyzq3uTg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 06:59:35 -0700 IronPort-SDR: BJCDgoGALQI0x0RUzWJ8+FlqM10p+Votkwy+Hobxrk7H7PIEBfnNgYVC2T3WeNsHYIKI3nFaAa eEyy7O2W4myQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,339,1583222400"; d="scan'208";a="433318892" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga005.jf.intel.com with ESMTP; 01 May 2020 06:59:33 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, bluca@debian.org, david.marchand@redhat.com, ktraynor@redhat.com, Bruce Richardson Date: Fri, 1 May 2020 14:53:58 +0100 Message-Id: <20200501135401.28124-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200501135401.28124-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200501135401.28124-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 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 Fri May 1 13:53:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 69646 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 256F6A04AD; Fri, 1 May 2020 16:00:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C24CA1DA81; Fri, 1 May 2020 15:59:39 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7E7851DA73 for ; Fri, 1 May 2020 15:59:38 +0200 (CEST) IronPort-SDR: jPoZdpxMfWgq8YydH81x7eV+lwCf+3s8m5ME+o3yl4nX5pCsbk2Dm8CrtJMkuanB7GIMhtcSRL JfRfIOc0C9fQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 06:59:38 -0700 IronPort-SDR: VrF5GIyPnW1SIpFJmbLCPXhqloGj9ZE7DWn3801nvtoynwrZW+W3+A1Qf88sc7RaQRI+V6YVpm ni65iaXfEq8Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,339,1583222400"; d="scan'208";a="433318901" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga005.jf.intel.com with ESMTP; 01 May 2020 06:59:36 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, bluca@debian.org, david.marchand@redhat.com, ktraynor@redhat.com, Bruce Richardson Date: Fri, 1 May 2020 14:53:59 +0100 Message-Id: <20200501135401.28124-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200501135401.28124-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200501135401.28124-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 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 --- V2: expanded commit log message with extra info, and updated pkg-config file description to make it clearer that one file is internal-only --- 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 Fri May 1 13:54:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 69647 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 1CDBCA04AD; Fri, 1 May 2020 16:00:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6FD201DA7A; Fri, 1 May 2020 15:59:43 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 90D541DA95 for ; Fri, 1 May 2020 15:59:41 +0200 (CEST) IronPort-SDR: R6vLN4UeaRB5iB4oLHeA/Jm5TigKN5TWHvPj5y4XFJeeuhx5LbLb3ZddD0fVjnN9ohN29odNdL 4NGpYIf41sUA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 06:59:41 -0700 IronPort-SDR: Cm09dLyYwtxy6KqmwO9gspPsXcoEl+79AlNGJvBjrCSx4HtowWyGc5fnV0HzkkvQVIbn+BidGK yxi1XgvF95vA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,339,1583222400"; d="scan'208";a="433318916" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga005.jf.intel.com with ESMTP; 01 May 2020 06:59:39 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, bluca@debian.org, david.marchand@redhat.com, ktraynor@redhat.com, Bruce Richardson Date: Fri, 1 May 2020 14:54:00 +0100 Message-Id: <20200501135401.28124-7-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200501135401.28124-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200501135401.28124-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 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 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 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 Fri May 1 13:54:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 69648 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 7FF14A04AD; Fri, 1 May 2020 16:00:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ECDFC1DAA8; Fri, 1 May 2020 15:59:44 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 023EF1DA96 for ; Fri, 1 May 2020 15:59:43 +0200 (CEST) IronPort-SDR: FNTX212tei/qPYVcfJd0B3cJLyoLCXB8qyWXfn6d/GE9xfvfSQ+QHbd5+7pyyLAcJ7+MMi8zjw pFZlWfGGGugA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2020 06:59:43 -0700 IronPort-SDR: LU58bzzstVcYyHQ2h8/m6lhy9U25He5WFYFlMirS+8X/UIAnNeQAzWSKXjiMO7BtPiwjcFk12Y wC/I0TZs/2Uw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,339,1583222400"; d="scan'208";a="433318923" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga005.jf.intel.com with ESMTP; 01 May 2020 06:59:42 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, bluca@debian.org, david.marchand@redhat.com, ktraynor@redhat.com, Bruce Richardson Date: Fri, 1 May 2020 14:54:01 +0100 Message-Id: <20200501135401.28124-8-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200501135401.28124-1-bruce.richardson@intel.com> References: <20200429100831.398-1-bruce.richardson@intel.com> <20200501135401.28124-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 7/7] build/pkg-config: prevent overlinking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add the --as-needed linker flag to the DPDK library list in the pkg-config file so as to prevent overlinking. Without this flag, when linking statically using flags from $(pkg-config --static --libs libdpdk), all DPDK drivers and libs were statically linked in, but the binary was also requiring all the shared versions be present to run. The real root-cause of this issue is that the DPDK libraries need to be duplicated in the linker command when doing static linking, due to the behaviour of pkg-config, but since that behaviour cannot be easily changed, this is a simple workaround to avoid problems. Signed-off-by: Bruce Richardson --- V2: expand commit log to explain that pkg-config behaviour of part of the problem. --- buildtools/pkg-config/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build index e043c5ee1..5c1e31c4d 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -23,7 +23,7 @@ Use libdpdk.pc instead of this file to query DPDK compile/link arguments''', version: meson.project_version(), subdirs: [get_option('include_subdir_arch'), '.'], extra_cflags: pkg_extra_cflags, - libraries: dpdk_libraries, + libraries: ['-Wl,--as-needed'] + dpdk_libraries, libraries_private: dpdk_extra_ldflags) pkg.generate(name: 'DPDK', # main DPDK pkgconfig file