diff mbox series

[libnftnl,v2] Add Requires.private field to libnftnl.pc

Message ID 38ab4cd887af863846c651ba8fb2deef0dc770d9.1562315659.git.baruch@tkos.co.il
State Accepted
Delegated to: Pablo Neira
Headers show
Series [libnftnl,v2] Add Requires.private field to libnftnl.pc | expand

Commit Message

Baruch Siach July 5, 2019, 8:34 a.m. UTC
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Static linking userspace programs such as nftables against libnftnl
currently doesn't work out of the box, because libnftnl is linked
against libmnl, but this isn't expressed in libnftnl pkg-config
file:

  CCLD   nft
[...]/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libnftnl.a(table.o): In function `_nft_table_nlmsg_parse':
table.c:(.text+0x480): undefined reference to `_mnl_attr_parse'
table.c:(.text+0x492): undefined reference to `_mnl_attr_get_str'
table.c:(.text+0x4a8): undefined reference to `_mnl_attr_get_u32'
table.c:(.text+0x4ca): undefined reference to `_mnl_attr_get_u32'
[...]

The Libs.private field is specifically designed for such usage:

From pkg-config documentation:

  Requires.private:

    A list of packages required by this package. The difference from
    Requires is that the packages listed under Requires.private are not
    taken into account when a flag list is computed for dynamically
    linked executable (i.e., when --static was not specified). In the
    situation where each .pc file corresponds to a library,
    Requires.private shall be used exclusively to specify the
    dependencies between the libraries.

Therefore, this patch adds a reference to libmnl in the Requires.private
field of libnftnl pkg-config file.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[baruch: use Requires.private; update commit log]
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
v2:
  Use Requires.private (Jan Engelhardt)
---
 libnftnl.pc.in | 1 +
 1 file changed, 1 insertion(+)

Comments

Pablo Neira Ayuso July 5, 2019, 6:26 p.m. UTC | #1
On Fri, Jul 05, 2019 at 11:34:19AM +0300, Baruch Siach wrote:
> From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> 
> Static linking userspace programs such as nftables against libnftnl
> currently doesn't work out of the box, because libnftnl is linked
> against libmnl, but this isn't expressed in libnftnl pkg-config
> file:
> 
>   CCLD   nft
> [...]/bfin-buildroot-uclinux-uclibc/sysroot/usr/lib/libnftnl.a(table.o): In function `_nft_table_nlmsg_parse':
> table.c:(.text+0x480): undefined reference to `_mnl_attr_parse'
> table.c:(.text+0x492): undefined reference to `_mnl_attr_get_str'
> table.c:(.text+0x4a8): undefined reference to `_mnl_attr_get_u32'
> table.c:(.text+0x4ca): undefined reference to `_mnl_attr_get_u32'
> [...]
> 
> The Libs.private field is specifically designed for such usage:
> 
> From pkg-config documentation:
> 
>   Requires.private:
> 
>     A list of packages required by this package. The difference from
>     Requires is that the packages listed under Requires.private are not
>     taken into account when a flag list is computed for dynamically
>     linked executable (i.e., when --static was not specified). In the
>     situation where each .pc file corresponds to a library,
>     Requires.private shall be used exclusively to specify the
>     dependencies between the libraries.
> 
> Therefore, this patch adds a reference to libmnl in the Requires.private
> field of libnftnl pkg-config file.

Applied, thanks.
diff mbox series

Patch

diff --git a/libnftnl.pc.in b/libnftnl.pc.in
index fd5cc6ac5ca4..ef94d749dd86 100644
--- a/libnftnl.pc.in
+++ b/libnftnl.pc.in
@@ -10,6 +10,7 @@  Description: Netfilter nf_tables infrastructure library
 URL: http://netfilter.org/projects/libnftnl/
 Version: @VERSION@
 Requires:
+Requires.private: libmnl
 Conflicts:
 Libs: -L${libdir} -lnftnl
 Cflags: -I${includedir}