From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 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 Content-Transfer-Encoding: 8bit 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) -- 2.20.1