DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, david.marchand@redhat.com, ktraynor@redhat.com,
	bluca@debian.org, sunil.pai.g@intel.com
Subject: Re: [dpdk-dev] [PATCH v3 5/7] build/pkg-config: output driver libs first for static build
Date: Wed, 01 Jul 2020 16:42:33 +0200	[thread overview]
Message-ID: <7587667.Wdl7rU7Jnr@thomas> (raw)
In-Reply-To: <20200630141433.818517-6-bruce.richardson@intel.com>

30/06/2020 16:14, Bruce Richardson:
> When calling pkg-config --static --libs, pkg-config will always output the
> regular libs first, and then the extra libs from libraries.private field,

s/libraries.private/Libs.private/

> 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.

s/libraries.private/Libs.private/

> 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 <bruce.richardson@intel.com>
> Acked-by: Luca Boccassi <bluca@debian.org>
> Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
> ---
> +# 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.

This is not obvious. In order to avoid messing it up in future,
I suggest this longer reword:

# 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:
#   Cflags   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).
# Another requirement is to allow linking dependencies as shared libraries,
# while linking static DPDK libraries and drivers. It is satisfied by
# listing the static files in Libs.private with the explicit syntax -l:libfoo.a.
# As a consequence, the regular DPDK libraries are already listed as static
# in the field Libs.private. The second occurences of DPDK libraries,
# included from Requires and used for shared library linkage case,
# are skipped in the case of static linkage thanks to the flag --as-needed.

# Link order summary:
#   libdpdk.Libs.private: whole-archive(static drivers/libs), drivers deps flags
#   libdpdk.Requires: libdpdk-libs package
#   libdpdk-libs.Libs: as-needed(shared libs)
#   libdpdk-libs.Libs.private: libs deps flags
#   libdpdk.pc.Requires.private: deps packages


If you agree, I could change this comment while merging.
I would add my Signed-off ;)



  parent reply	other threads:[~2020-07-01 14:42 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29 10:08 [dpdk-dev] [PATCH 0/7] improve DPDK static builds with meson Bruce Richardson
2020-04-29 10:08 ` [dpdk-dev] [PATCH 1/7] build: always link-whole DPDK static libraries Bruce Richardson
2020-04-29 10:18   ` Thomas Monjalon
2020-04-29 10:42     ` Bruce Richardson
2020-04-29 10:49       ` Thomas Monjalon
2020-04-29 14:04   ` Andrzej Ostruszka [C]
2020-04-29 10:08 ` [dpdk-dev] [PATCH 2/7] build: remove unnecessary variable Bruce Richardson
2020-04-29 10:19   ` Thomas Monjalon
2020-04-29 10:29     ` Bruce Richardson
2020-04-29 10:08 ` [dpdk-dev] [PATCH 3/7] devtools/test-meson-builds.sh: add pkg-config static builds Bruce Richardson
2020-04-29 10:08 ` [dpdk-dev] [PATCH 4/7] build: move pkg-config creation to separate file Bruce Richardson
2020-04-29 10:08 ` [dpdk-dev] [PATCH 5/7] build/pkg-config: output driver libs first for static build Bruce Richardson
2020-04-29 10:30   ` Thomas Monjalon
2020-04-29 10:54     ` Bruce Richardson
2020-04-29 10:40   ` Luca Boccassi
2020-04-29 11:03     ` Bruce Richardson
2020-04-29 11:12       ` Luca Boccassi
2020-04-29 10:08 ` [dpdk-dev] [PATCH 6/7] build/pkg-config: improve static linking flags Bruce Richardson
2020-04-29 10:32   ` Thomas Monjalon
2020-04-29 10:56     ` Bruce Richardson
2020-04-29 10:57       ` Thomas Monjalon
2020-04-29 10:37   ` Luca Boccassi
2020-04-29 10:58     ` Bruce Richardson
2020-04-29 11:10       ` Luca Boccassi
2020-04-29 10:08 ` [dpdk-dev] [PATCH 7/7] build/pkg-config: prevent overlinking Bruce Richardson
2020-04-29 10:34   ` Thomas Monjalon
2020-04-29 11:00     ` Bruce Richardson
2020-05-01 13:53 ` [dpdk-dev] [PATCH v2 0/7] improve DPDK static builds with meson Bruce Richardson
2020-05-01 13:53   ` [dpdk-dev] [PATCH v2 1/7] build: always link-whole DPDK static libraries Bruce Richardson
2020-05-01 13:53   ` [dpdk-dev] [PATCH v2 2/7] build: remove unnecessary variable Bruce Richardson
2020-05-01 13:53   ` [dpdk-dev] [PATCH v2 3/7] devtools/test-meson-builds.sh: add pkg-config static builds Bruce Richardson
2020-05-01 13:53   ` [dpdk-dev] [PATCH v2 4/7] build: move pkg-config creation to separate file Bruce Richardson
2020-05-01 13:53   ` [dpdk-dev] [PATCH v2 5/7] build/pkg-config: output driver libs first for static build Bruce Richardson
2020-05-01 13:54   ` [dpdk-dev] [PATCH v2 6/7] build/pkg-config: improve static linking flags Bruce Richardson
2020-05-01 13:54   ` [dpdk-dev] [PATCH v2 7/7] build/pkg-config: prevent overlinking Bruce Richardson
2020-05-01 14:02   ` [dpdk-dev] [PATCH v2 0/7] improve DPDK static builds with meson Luca Boccassi
2020-06-30 13:25   ` Pai G, Sunil
2020-06-30 16:37     ` Stokes, Ian
2020-07-01 17:29       ` Thomas Monjalon
2020-07-02 10:46         ` Stokes, Ian
2020-06-30 14:14 ` [dpdk-dev] [PATCH v3 " Bruce Richardson
2020-06-30 14:14   ` [dpdk-dev] [PATCH v3 1/7] build: always link-whole DPDK static libraries Bruce Richardson
2020-07-01 14:19     ` Thomas Monjalon
2020-06-30 14:14   ` [dpdk-dev] [PATCH v3 2/7] build: remove unnecessary variable Bruce Richardson
2020-06-30 14:14   ` [dpdk-dev] [PATCH v3 3/7] devtools/test-meson-builds.sh: add pkg-config static builds Bruce Richardson
2020-06-30 14:14   ` [dpdk-dev] [PATCH v3 4/7] build: move pkg-config creation to separate file Bruce Richardson
2020-06-30 14:14   ` [dpdk-dev] [PATCH v3 5/7] build/pkg-config: output driver libs first for static build Bruce Richardson
2020-07-01  7:50     ` Thomas Monjalon
2020-07-01  8:43       ` Bruce Richardson
2020-07-01 14:42     ` Thomas Monjalon [this message]
2020-07-01 15:16       ` Bruce Richardson
2020-07-01 15:36         ` Thomas Monjalon
2020-07-01 15:45           ` Bruce Richardson
2020-07-01 16:04             ` Thomas Monjalon
2020-06-30 14:14   ` [dpdk-dev] [PATCH v3 6/7] build/pkg-config: improve static linking flags Bruce Richardson
2020-07-01 14:30     ` Thomas Monjalon
2020-07-01 14:33       ` Thomas Monjalon
2020-07-01 14:36         ` Bruce Richardson
2020-07-01 14:45           ` Thomas Monjalon
2020-06-30 14:14   ` [dpdk-dev] [PATCH v3 7/7] build/pkg-config: prevent overlinking Bruce Richardson
2020-07-01  7:56     ` Thomas Monjalon
2020-07-01  8:58       ` Bruce Richardson
2020-07-01 17:33   ` [dpdk-dev] [PATCH v3 0/7] improve DPDK static builds with meson Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7587667.Wdl7rU7Jnr@thomas \
    --to=thomas@monjalon.net \
    --cc=bluca@debian.org \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ktraynor@redhat.com \
    --cc=sunil.pai.g@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).