[dpdk-dev] [PATCH v3 5/7] build/pkg-config: output driver libs first for static build
Thomas Monjalon
thomas at monjalon.net
Wed Jul 1 09:50:20 CEST 2020
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,
> 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
Sorry, I'm lost here. Why "only" driver files?
> those need to come *before* the regular libraries.
Given whole libs are linked, is it really needed to have drivers first?
> 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.
I'm completely lost. In which case we link both static and shared libs?
> 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 at intel.com>
> Acked-by: Luca Boccassi <bluca at debian.org>
> Acked-by: Sunil Pai G <sunil.pai.g at intel.com>
More information about the dev
mailing list