Skip to contentSkip to conversation

Correctly define the header 'Requires:' in the file 'libnftnl.pc'.

PATCH [email protected] 1 participant 1 message Nov 13, 2014 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

----- Original Nachricht ----

Von:     Jan Engelhardt <[email protected]>
An:      Giorgio Dal Molin <[email protected]>
Datum:   13.11.2014 13:34
Betreff: Re: [libnftnl PATCH 1/1] Correctly define the header 'Requires:' in

the file 'libnftnl.pc'.

Quoted 23 lines · Giorgio Dal Molin
Quoted 3 lines

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

compiling.

Quoted 4 lines
# make V=1 all
...
arm-926ejs-linux-gnueabi-gcc -Wall -Wstrict-prototypes -Wmissing-prototypes
(quoted diff) +0 -4
-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

Quoted 1 line

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)

Quoted 1 line

/tmp/pkg_root/lib/libnftnl.so: undefined reference to `json_integer_value'

Quoted 8 lines

Can you actually check whether LD_LIBRARY_PATH=/tmp/pkg_root/lib ldd -r /tmp/pkg_root/lib/libnftnl.so succeeds?

Programs should generally need not be concerned with 3rd-level symbols. Adding json to the command line for linking the nft program seems wrong (when you have a build with shared libraries), because nft does not appear to be using any of the json_* symbols.

I'm not really a 'guru' about building sw packages but
as I understand the pkg-config system there is no *direct* 3rd-level dependencies, every package must declare just its own direct deps, pkg-config then does the recursion when needed, pulling in the whole tree. In this case, the 'nftable' package just needs 'libnftnl', it should not know what 'libnftnl' in turn needs.

Here is how I (cross) build 'nftable' in my own Makefile:
...
configure:

	( cd $(BUILD_DIR) &&									\
	$(SRC_DIR)/configure									\
		PKG_CONFIG_LIBDIR="$(PKG_ROOT)/lib/pkgconfig" 		\
		CFLAGS="$(CROSS_CFLAGS)"						\
		--prefix= --host="$(CONFIGURE_HOST)"				\
		--libexecdir=/lib				 					\
		--enable-assert									\
		--without-cli									\
	)

build: configure

	$(MAKE) -C $(BUILD_DIR) DESTDIR=$(PKG_ROOT) V=1 all
	$(MAKE) -C $(BUILD_DIR) DESTDIR=$(PKG_ROOT) install-strip

I think this should just work, without requiring additional/redundant infos.

I've tested your 'ldd' with the LD_LIBRARY_PATH explicitly set and it actually works but I don't want to fiddle with such env. variables directly when I already have a build configuration system.

giorgio

Quoted 21 lines
Quoted 12 lines

index 55b28ab..ff29200 100644

configure.ac +0 -0
@@ -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"

configure.ac +1 -0
+	NFTNL_PC_DEPS+=" mxml"
Quoted 1 line

])

+= is not portable to sh; such should be of the form a="$a b". --
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html