diff mbox series

[libnftnl] Add Libs.private field to libnftnl.pc

Message ID b121a93e89d0b9478d4e57430e98c04d490d5af2.1562297544.git.baruch@tkos.co.il
State Changes Requested
Delegated to: Pablo Neira
Headers show
Series [libnftnl] Add Libs.private field to libnftnl.pc | expand

Commit Message

Baruch Siach July 5, 2019, 3:32 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:

  Libs.private:

     This line should list any private libraries in use.  Private
     libraries are libraries which are not exposed through your
     library, but are needed in the case of static linking.

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 libnftnl.pc.in | 1 +
 1 file changed, 1 insertion(+)

Comments

Jan Engelhardt July 5, 2019, 7:04 a.m. UTC | #1
On Friday 2019-07-05 05:32, Baruch Siach wrote:

>diff --git a/libnftnl.pc.in b/libnftnl.pc.in
>index fd5cc6ac5ca4..7fef9215c888 100644
>--- a/libnftnl.pc.in
>+++ b/libnftnl.pc.in
>@@ -12,4 +12,5 @@ Version: @VERSION@
> Requires:
> Conflicts:
> Libs: -L${libdir} -lnftnl
>+Libs.private: @LIBMNL_LIBS@
> Cflags: -I${includedir}

This is incorrect. What should be used is

Requires.private: libmnl.
diff mbox series

Patch

diff --git a/libnftnl.pc.in b/libnftnl.pc.in
index fd5cc6ac5ca4..7fef9215c888 100644
--- a/libnftnl.pc.in
+++ b/libnftnl.pc.in
@@ -12,4 +12,5 @@  Version: @VERSION@
 Requires:
 Conflicts:
 Libs: -L${libdir} -lnftnl
+Libs.private: @LIBMNL_LIBS@
 Cflags: -I${includedir}