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 544D3A0518 for ; Fri, 24 Jul 2020 14:12:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4549C1C439; Fri, 24 Jul 2020 14:12:39 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 977FA1C2F2 for ; Fri, 24 Jul 2020 14:12:38 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id o2so8080348wmh.2 for ; Fri, 24 Jul 2020 05:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=81bhmW+zRnyjOTixQ+T9rH0x2QhDGJNc3mfZgQV9ji4=; b=k9avZ/OYd6bYNZ/Isf+UpiENc7REtddv56i1vnb0hSCITN1HTJlKvaqaqOcyL848EU JxHDBms4P75SxLUTmaoTNZOXc+IDQvhSpOz/eFUI0XeCCX5Hz41TYBkqzTfgAXvFf4PP IoMDOOihPMkjf4hhlDl0xiA6MvIIr4Sn3+N9+1vtSIUPxhsPiHDBwNuWbe1vj5h8OqSa CUu4orT/+dCmLrQd7nhvK1UAwtYRegG+BPWbOpsO/onEeoBwsz2Q0hMk3wP1WTLiP6NS tx8K8xeTk7qm6wRXu+2knvX9d1jBS8qK6hfI+PFNwmMDl7Gi3mOreYn4OKdhUzCDYt/b 9T4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=81bhmW+zRnyjOTixQ+T9rH0x2QhDGJNc3mfZgQV9ji4=; b=bf90llHx6Dr96EqV81+NJxbB6T3b+2unnrHeVNchIcQ7x7/N4V6AzXl/kQB7DC/jbs wfPsBBmdvsnG5Nv5B8TLsy88JFrNM3X/i3msV60c6hk+iSnvXsduuP7n64+79x4vW+dZ euyJuovSY0tx3L9uk8/UtkjwQEeObibkSGwwUvb/zqs13Zj0wq5NkMCvcfRmHzOM+3dQ /COWQtKLEndGoJjABnJE1nPGia90Omdc7xbK1bdDmfRhCHJm49frlYG9MSNYqFzMGNmA 8RijoULpphBp1/ehlC9It79SRGTW7Q+fFClzA8kCRvcgrExusXw/wvAidFnEP0ew7mJw 7KFQ== X-Gm-Message-State: AOAM532bV1E/L+Fq1cPeSTi0ruSdWVnuAsbo+OWI1g2NuWtIoXZvc+35 NmdT+FEZi3Ox2Gq5P3a6e5Y= X-Google-Smtp-Source: ABdhPJy5RZ69sdNKoqNcv296/5CGGuxkinYECVNMnno4LPVJyaoYbKrlP4XULHLFLWC0B8+Y5KtK5Q== X-Received: by 2002:a1c:e382:: with SMTP id a124mr8570503wmh.11.1595592758336; Fri, 24 Jul 2020 05:12:38 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id g16sm1071705wrs.88.2020.07.24.05.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 05:12:37 -0700 (PDT) From: luca.boccassi@gmail.com To: Bruce Richardson Cc: Luca Boccassi , Sunil Pai G , Thomas Monjalon , dpdk stable Date: Fri, 24 Jul 2020 13:00:28 +0100 Message-Id: <20200724120030.1863487-190-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200724120030.1863487-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'build/pkg-config: output drivers first for static build' has been queued to stable release 19.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/26/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 9fb13a12c122b638a838ba9571aed8cde13ef094 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Tue, 30 Jun 2020 15:14:31 +0100 Subject: [PATCH] build/pkg-config: output drivers first for static build [ backported from upstream commit f9c0b1f4319ea4f40ee2ceb8097c9a5a34a56171 ] When calling pkg-config --static --libs, pkg-config will always output the regular libs first, and then the extra libs from Libs.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 Libs.private field rather than before. Without this patch, the linking works in DPDK because in all cases we specify the libraries after the drivers in the Libs.private line, ensuring that the references to the libs from the drivers can be resolved. The current output is therefore of the form, "(shared)libs, drivers, (static)libs", while after this patch the output is, "drivers, (static)libs, (shared)libs". The former case will not work if we use the --whole-archive flag on the static libs as it will lead to duplicate definitions due to some references having been previously resolved from the shared libraries. By ensuring the shared libraries come last in the link link, this issue does not occur, as duplicate references when linking the shared libs will be ignored. Signed-off-by: Bruce Richardson Acked-by: Luca Boccassi Acked-by: Sunil Pai G Signed-off-by: Thomas Monjalon --- buildtools/pkg-config/meson.build | 36 ++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build index 85d59972d..f663b1c66 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -10,17 +10,37 @@ 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 Libs.private field, +# since the assumption is that those are additional dependencies for building +# statically that the .a files depend upon. The output order of .pc fields is: +# Libs Libs.private Requires Requires.private +# The fields Requires* are for package names. +# The flags of the DPDK libraries must be defined in Libs* fields. +# However, the DPDK drivers are linked only in static builds (Libs.private), +# and those need to come *before* the regular libraries (Libs field). +# This requirement is satisfied by moving the regular libs in a separate file +# included in the field Requires (after Libs.private). + +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'] ) -- 2.20.1