[libnftnl PATCH 1/1] Correctly define the header 'Requires:' in the file 'libnftnl.pc'.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'libnftnl' unconditionally requires 'libmnl' and eventually requires
'mxml' and/or 'jansson' in case XML or JASON parsing was configured.

Without a correctly defined 'Requires:' header failures can happen
while linking a program against 'libnftnl', expecially while cross compiling.

Here the output of a 'make V=1 all' in a cross compiled (for ARM)
'nftable' project:

# make V=1 all
...
arm-926ejs-linux-gnueabi-gcc -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -Wsign-compare -Winit-self -Wformat-nonliteral -Wformat-security -Wmissing-format-attribute -Wcast-align -Wundef -Wbad-function-cast -O2 -msoft-float -mabi=aapcs-linux -march=armv5te -mtune=arm926ej-s -mcpu=arm926ej-s -w  -L/tmp/pkg_root/lib -o nft main.o rule.o statement.o datatype.o expression.o evaluate.o proto.o payload.o exthdr.o meta.o ct.o netlink.o netlink_linearize.o netlink_delinearize.o segtree.o rbtree.o gmputil.o utils.o erec.o mnl.o scanner.o parser_bison.o  -L/tmp/pkg_root/lib -lmnl  -L/tmp/pkg_root/lib -lnftnl  -lgmp
arm-926ejs-linux-gnueabi/bin/ld: warning: libjansson.so.4, needed by /tmp/pkg_root/lib/libnftnl.so, not found (try using -rpath or -rpath-link)
/tmp/pkg_root/lib/libnftnl.so: undefined reference to `json_integer_value'
/tmp/pkg_root/lib/libnftnl.so: undefined reference to `json_delete'
/tmp/pkg_root/lib/libnftnl.so: undefined reference to `json_string_value'
/tmp/pkg_root/lib/libnftnl.so: undefined reference to `json_array_get'
/tmp/pkg_root/lib/libnftnl.so: undefined reference to `json_loadf'
/tmp/pkg_root/lib/libnftnl.so: undefined reference to `json_loadb'
/tmp/pkg_root/lib/libnftnl.so: undefined reference to `json_array_size'
/tmp/pkg_root/lib/libnftnl.so: undefined reference to `json_object_get'
collect2: ld returned 1 exit status
Makefile:396: recipe for target 'nft' failed
make[6]: *** [nft] Error 1
#

Signed-off-by: Giorgio Dal Molin <giorgio.nicole@xxxxxxxx>
---
 configure.ac   | 5 +++++
 libnftnl.pc.in | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 55b28ab..ff29200 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,19 +39,24 @@ case "$host" in
 *) AC_MSG_ERROR([Linux only, dude!]);;
 esac
 
+NFTNL_PC_DEPS=libmnl
 regular_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_REENTRANT"
 AS_IF([test "x$with_xml_parsing" = "xyes"], [
 	regular_CPPFLAGS="$regular_CPPFLAGS -DXML_PARSING"
+	NFTNL_PC_DEPS+=" mxml"
 ])
 
 AS_IF([test "x$with_json_parsing" = "xyes"], [
 	regular_CPPFLAGS="$regular_CPPFLAGS -DJSON_PARSING"
+	NFTNL_PC_DEPS+=" jansson"
 ])
 regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
 	-Wmissing-prototypes -Wshadow -Wstrict-prototypes \
 	-Wformat=2 -pipe"
+
 AC_SUBST([regular_CPPFLAGS])
 AC_SUBST([regular_CFLAGS])
+AC_SUBST([NFTNL_PC_DEPS])
 AC_CONFIG_FILES([Makefile src/Makefile include/Makefile include/libnftnl/Makefile include/linux/Makefile include/linux/netfilter/Makefile examples/Makefile tests/Makefile libnftnl.pc doxygen.cfg])
 AC_OUTPUT
 
diff --git a/libnftnl.pc.in b/libnftnl.pc.in
index fd5cc6a..39c66f9 100644
--- a/libnftnl.pc.in
+++ b/libnftnl.pc.in
@@ -9,7 +9,7 @@ Name: libnftnl
 Description: Netfilter nf_tables infrastructure library
 URL: http://netfilter.org/projects/libnftnl/
 Version: @VERSION@
-Requires:
+Requires: @NFTNL_PC_DEPS@
 Conflicts:
 Libs: -L${libdir} -lnftnl
 Cflags: -I${includedir}
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux