package/bind: enable static build
PATCH v2 1/4 package/bind: enable static build
Static build has been disabled in 2014 with commit 6045904752b06a8b8e52ba8fc2e49a8548964e8d however bind can be built statically thanks to --without-dlopen so enable it back
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Enable/disable libtool depending on BR2_STATIC_LIBS value
...n_driver.c-fix-build-without-dlfcn.h.patch | 28 +++++++++++++++++++ package/bind/Config.in | 5 ++-- package/bind/bind.mk | 14 ++++++++-- 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 package/bind/0002-dlz_open_driver.c-fix-build-without-dlfcn.h.patch
package/bind/0002-dlz_open_driver.c-fix-build-without-dlfcn.h.patch new file +28 -0
@@ -0,0 +1,28 @@ +From 92b738a0fe8a7d65346de9e6dd7a8f135ee29765 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine <[email protected]> +Date: Tue, 23 Apr 2019 22:45:25 +0200 +Subject: [PATCH] dlz_open_driver.c: fix build without dlfcn.h + +Signed-off-by: Fabrice Fontaine <[email protected]> +[Upstream status: https://gitlab.isc.org/isc-projects/bind9/issues/995] +--- + bin/named/unix/dlz_dlopen_driver.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/bin/named/unix/dlz_dlopen_driver.c b/bin/named/unix/dlz_dlopen_driver.c +index 74d29ffa09..ab8a5c9493 100644 +--- a/bin/named/unix/dlz_dlopen_driver.c ++++ b/bin/named/unix/dlz_dlopen_driver.c +@@ -14,7 +14,9 @@ + #include <inttypes.h> + #include <stdlib.h> + #include <string.h> ++#if HAVE_DLFCN_H + #include <dlfcn.h> ++#endif + + #include <dns/log.h> + #include <dns/result.h> +-- +2.20.1 +
package/bind/Config.in +2 -3
@@ -2,7 +2,6 @@ config BR2_PACKAGE_BIND bool "bind" depends on BR2_USE_MMU # fork() depends on BR2_TOOLCHAIN_HAS_THREADS - depends on !BR2_STATIC_LIBS help BIND (Berkeley Internet Name Domain) is an implementation of the Domain Name System (DNS) protocols
@@ -41,6 +40,6 @@ config BR2_PACKAGE_BIND_TOOLS endif -comment "bind needs a toolchain w/ threads, dynamic library" +comment "bind needs a toolchain w/ threads" depends on BR2_USE_MMU - depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS + depends on !BR2_TOOLCHAIN_HAS_THREADS
package/bind/bind.mk +12 -2
@@ -28,7 +28,6 @@ BIND_CONF_OPTS = \ --with-libjson=no \ --with-randomdev=/dev/urandom \ --enable-epoll \ - --with-libtool \ --with-gssapi=no \ --enable-filter-aaaa
@@ -54,12 +53,13 @@ BIND_CONF_OPTS += --with-libxml2=no endif ifeq ($(BR2_PACKAGE_OPENSSL),y) -BIND_DEPENDENCIES += openssl +BIND_DEPENDENCIES += host-pkgconf openssl BIND_CONF_OPTS += \ --with-openssl=$(STAGING_DIR)/usr \ --with-ecdsa=yes \ --with-eddsa=no \ --with-aes=yes +BIND_CONF_ENV += LIBS=`$(PKG_CONFIG_HOST_BINARY) --libs openssl` # GOST cipher support requires openssl extra engines ifeq ($(BR2_PACKAGE_OPENSSL_ENGINES),y) BIND_CONF_OPTS += --with-gost=yes
@@ -81,6 +81,16 @@ else BIND_CONF_OPTS += --with-readline=no endif +ifeq ($(BR2_STATIC_LIBS),y) +BIND_CONF_OPTS += \ + --without-dlopen \ + --without-libtool +else +BIND_CONF_OPTS += \ + --with-dlopen \ + --with-libtool +endif + define BIND_TARGET_REMOVE_SERVER rm -rf $(addprefix $(TARGET_DIR)/usr/sbin/, $(BIND_TARGET_SERVER_SBIN)) endef
Signature · 1 line
2.20.1
PATCH v2 2/4 package/bind: remove threads dependency
Threads dependency has been added in 2015 with commit 07c1ad4647b6a8e60338fc01ddcb2d629de0ad14 however bind can be built without threads thanks to --disable-threads
--- package/bind/Config.in | 5 ----- package/bind/bind.mk | 1 + 2 files changed, 1 insertion(+), 5 deletions(-)
package/bind/Config.in +0 -5
@@ -1,7 +1,6 @@ config BR2_PACKAGE_BIND bool "bind" depends on BR2_USE_MMU # fork() - depends on BR2_TOOLCHAIN_HAS_THREADS help BIND (Berkeley Internet Name Domain) is an implementation of the Domain Name System (DNS) protocols
@@ -39,7 +38,3 @@ config BR2_PACKAGE_BIND_TOOLS Install tools (dig, host, nslookup, nsupdate) endif - -comment "bind needs a toolchain w/ threads" - depends on BR2_USE_MMU - depends on !BR2_TOOLCHAIN_HAS_THREADS
package/bind/bind.mk +1 -0
@@ -24,6 +24,7 @@ BIND_CONF_ENV = \ BUILD_CC="$(TARGET_CC)" \ BUILD_CFLAGS="$(TARGET_CFLAGS)" BIND_CONF_OPTS = \ + $(if $(BR2_TOOLCHAIN_HAS_THREADS),--enable-threads,--disable-threads) \ --without-lmdb \ --with-libjson=no \ --with-randomdev=/dev/urandom \
Signature · 1 line
2.20.1
PATCH v2 3/4 package/bind: don't enable server by default
In reply to Fabrice FontaineDon't enable server by default as dhcp will now select bind to use the bind libraries
--- package/bind/Config.in | 1 - 1 file changed, 1 deletion(-)
package/bind/Config.in +0 -1
@@ -28,7 +28,6 @@ if BR2_PACKAGE_BIND config BR2_PACKAGE_BIND_SERVER bool "Install server components" - default y help Install server components (named, lwresd)
Signature · 1 line
2.20.1
PATCH v2 4/4 package/dhcp: use system bind
In reply to Fabrice FontaineSelect bind instead of using the embedded bind libraries. This will help managing correctly all the bind dependencies such as zlib
Fixes:
- http://autobuild.buildroot.org/results/a61f24e9f117c81893c58befb20d21179e61b85b
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Enable/disable libtool depending on BR2_STATIC_LIBS value
...ibility-headers-updated-util-bind-sh.patch | 87 +++++++++++++++++++ package/dhcp/Config.in | 1 + package/dhcp/dhcp.mk | 18 ++-- 3 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 package/dhcp/0001-master-Added-includes-of-new-BIND9-compatibility-headers-updated-util-bind-sh.patch
package/dhcp/0001-master-Added-includes-of-new-BIND9-compatibility-headers-updated-util-bind-sh.patch new file +87 -0
@@ -0,0 +1,87 @@ +From 8194daabfd590f17825f0c61e9534bee5c99cc86 Mon Sep 17 00:00:00 2001 +From: Thomas Markwalder <[email protected]> +Date: Fri, 14 Sep 2018 13:41:41 -0400 +Subject: [PATCH] [master] Added includes of new BIND9 compatibility headers, + updated util/bind.sh + + Merges in rt48072. +Signed-off-by: Fabrice Fontaine <[email protected]> +[Retrieved (and updated to remvove bind.sh update) from: +https://gitlab.isc.org/isc-projects/dhcp/commit/8194daabfd590f17825f0c61e9534bee5c99cc86] +--- + includes/omapip/isclib.h | 3 +++ + includes/omapip/result.h | 1 + + server/dhcpv6.c | 13 +++++++++---- + 3 files changed, 39 insertions(+), 12 deletions(-) + +diff --git a/includes/omapip/isclib.h b/includes/omapip/isclib.h +index 75a87ff6..538b927f 100644 +--- a/includes/omapip/isclib.h ++++ b/includes/omapip/isclib.h +@@ -48,6 +48,9 @@ + #include <string.h> + #include <netdb.h> + ++#include <isc/boolean.h> ++#include <isc/int.h> ++ + #include <isc/buffer.h> + #include <isc/lex.h> + #include <isc/lib.h> +diff --git a/includes/omapip/result.h b/includes/omapip/result.h +index 91243e1b..860298f6 100644 +--- a/includes/omapip/result.h ++++ b/includes/omapip/result.h +@@ -26,6 +26,7 @@ + #ifndef DHCP_RESULT_H + #define DHCP_RESULT_H 1 + ++#include <isc/boolean.h> + #include <isc/lang.h> + #include <isc/resultclass.h> + #include <isc/types.h> +diff --git a/server/dhcpv6.c b/server/dhcpv6.c +index a7110f98..cde4f617 100644 +--- a/server/dhcpv6.c ++++ b/server/dhcpv6.c +@@ -1034,7 +1034,8 @@ void check_pool6_threshold(struct reply_state *reply, + shared_name, + inet_ntop(AF_INET6, &lease->addr, + tmp_addr, sizeof(tmp_addr)), +- used, count); ++ (long long unsigned)(used), ++ (long long unsigned)(count)); + } + return; + } +@@ -1066,7 +1067,8 @@ void check_pool6_threshold(struct reply_state *reply, + "address: %s; high threshold %d%% %llu/%llu.", + shared_name, + inet_ntop(AF_INET6, &lease->addr, tmp_addr, sizeof(tmp_addr)), +- poolhigh, used, count); ++ poolhigh, (long long unsigned)(used), ++ (long long unsigned)(count)); + + /* handle the low threshold now, if we don't + * have one we default to 0. */ +@@ -1436,12 +1438,15 @@ pick_v6_address(struct reply_state *reply) + log_debug("Unable to pick client address: " + "no addresses available - shared network %s: " + " 2^64-1 < total, %llu active, %llu abandoned", +- shared_name, active - abandoned, abandoned); ++ shared_name, (long long unsigned)(active - abandoned), ++ (long long unsigned)(abandoned)); + } else { + log_debug("Unable to pick client address: " + "no addresses available - shared network %s: " + "%llu total, %llu active, %llu abandoned", +- shared_name, total, active - abandoned, abandoned); ++ shared_name, (long long unsigned)(total), ++ (long long unsigned)(active - abandoned), ++ (long long unsigned)(abandoned)); + } + + return ISC_R_NORESOURCES; +-- +2.18.1 +
package/dhcp/Config.in +1 -0
@@ -3,6 +3,7 @@ config BR2_PACKAGE_DHCP # fork() depends on BR2_USE_MMU depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + select BR2_PACKAGE_BIND help DHCP relay agent from the ISC DHCP distribution.
package/dhcp/dhcp.mk +5 -13
@@ -9,13 +9,16 @@ DHCP_SITE = http://ftp.isc.org/isc/dhcp/$(DHCP_VERSION) DHCP_INSTALL_STAGING = YES DHCP_LICENSE = MPL-2.0 DHCP_LICENSE_FILES = LICENSE +DHCP_DEPENDENCIES = bind DHCP_CONF_ENV = \ CPPFLAGS='-D_PATH_DHCPD_CONF=\"/etc/dhcp/dhcpd.conf\" \ -D_PATH_DHCLIENT_CONF=\"/etc/dhcp/dhclient.conf\"' \ - CFLAGS='$(TARGET_CFLAGS) -DISC_CHECK_NONE=1' + CFLAGS='$(TARGET_CFLAGS) -DISC_CHECK_NONE=1' \ + LIBS="`$(STAGING_DIR)/usr/bin/bind9-config --libs bind9`" DHCP_CONF_OPTS = \ - --with-bind-extra-config="$(DHCP_BIND_CONF_OPTS)" \ + --with-libbind=$(STAGING_DIR)/usr \ + $(if $(BR2_STATIC_LIBS),--disable-libtool,--enable-libtool) \ --with-randomdev=/dev/random \ --with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \ --with-srv6-lease-file=/var/lib/dhcp/dhcpd6.leases \
@@ -44,17 +47,6 @@ ifeq ($(BR2_PACKAGE_DHCP_SERVER_DELAYED_ACK),y) DHCP_CONF_OPTS += --enable-delayed-ack endif -ifeq ($(BR2_PACKAGE_ZLIB),y) -DHCP_DEPENDENCIES += zlib -DHCP_BIND_CONF_OPTS += --with-zlib -else -DHCP_BIND_CONF_OPTS += --without-zlib -endif - -ifeq ($(BR2_STATIC_LIBS),y) -DHCP_BIND_CONF_OPTS += --without-dlopen -endif - ifeq ($(BR2_PACKAGE_DHCP_SERVER),y) define DHCP_INSTALL_SERVER mkdir -p $(TARGET_DIR)/var/lib
Signature · 1 line
2.20.1
PATCH v2 1/4 package/bind: enable static build
In reply to Fabrice FontaineHello Fabrice,
Quoted 8 lines · On Thu, 25 Apr 2019 19:49:13 +0200 Fabrice Fontaine…
Static build has been disabled in 2014 with commit
6045904752b06a8b8e52ba8fc2e49a8548964e8dhowever bind can be built statically thanks to --without-dlopen so enable it backSigned-off-by Fabrice Fontaine <[email protected]>---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Enable/disable libtool depending onBR2_STATIC_LIBSvalue
Thanks for this new iteration, but unfortunately, it still doesn't build (with the same defconfig), but due to another error:
libtool: install: (cd /home/thomas/projets/buildroot/output/build/dhcp-4.4.1/common; /bin/sh "/home/thomas/projets/buildroot/output/build/dhcp-4.4.1/libtool" --tag CC --mode=relink /home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -DISC_CHECK_NONE=1 -I../includes -I/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include -o libdhcp.la -rpath /usr/lib alloc.lo bpf.lo comapi.lo conflex.lo ctrace.lo dhcp4o6.lo discover.lo dispatch.lo dlpi.lo dns.lo ethernet.lo execute.lo fddi.lo icmp.lo inet.lo lpf.lo memory.lo nit.lo ns_name.lo options.lo packet.lo parse.lo print.lo raw.lo resolv.lo socket.lo tables.lo tr.lo tree.lo upf.lo -L/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin/../../usr/lib -lbind9 -ldns -lisccfg -lisc -ldl -lpthread -inst-prefix-dir /home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot)
libtool: relink: /home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc -shared -fPIC -DPIC .libs/alloc.o .libs/bpf.o .libs/comapi.o .libs/conflex.o .libs/ctrace.o .libs/dhcp4o6.o .libs/discover.o .libs/dispatch.o .libs/dlpi.o .libs/dns.o .libs/ethernet.o .libs/execute.o .libs/fddi.o .libs/icmp.o .libs/inet.o .libs/lpf.o .libs/memory.o .libs/nit.o .libs/ns_name.o .libs/options.o .libs/packet.o .libs/parse.o .libs/print.o .libs/raw.o .libs/resolv.o .libs/socket.o .libs/tables.o .libs/tr.o .libs/tree.o .libs/upf.o
-Wl,-rpath -Wl,/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -L/home/thomas/projets/buildroot/output/build/bind-9.11.5-P4/lib/isccfg/.libs -L/home/thomas/projets/buildroot/output/build/bind-9.11.5-P4/lib/dns/.libs -L/home/thomas/projets/buildroot/output/build/bind-9.11.5-P4/lib/isc/.libs -L/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin/../../usr/lib -L/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -L/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -lbind9 -L/usr/lib -lisccfg -ldns -lisc -ldl -lpthread -Os -Wl,-soname -Wl,libdhcp.so.0 -o .libs/libdhcp.so.0.0.0
arm-linux-gcc: ERROR: unsafe header/library path used in cross-compilation: '-L/usr/lib'
libtool: error: error: relink 'libdhcp.la' with the above command before installing it
The -L/usr/lib doesn't exist on the libtool command line, so it gets invented by libtool. I think part of the problem is that this error happens during the staging installation case.
There is also this warning at configure time:
configure: WARNING: legacy configure is used but libtool is enabled. Trying to recover...
I have uploaded the full build log of the DHCP package at:
http://code.bulix.org/7xi08h-677888?raw
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/4 package/bind: enable static build
Hello Thomas,
Le jeu. 25 avr. 2019 ? 23:35, Thomas Petazzoni
<[email protected]> a ?crit :
Quoted 29 lines
Hello Fabrice,
Quoted 8 lines · On Thu, 25 Apr 2019 19:49:13 +0200 Fabrice Fontaine…
Static build has been disabled in 2014 with commit
6045904752b06a8b8e52ba8fc2e49a8548964e8dhowever bind can be built statically thanks to --without-dlopen so enable it backSigned-off-by Fabrice Fontaine <[email protected]>---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Enable/disable libtool depending onBR2_STATIC_LIBSvalueThanks for this new iteration, but unfortunately, it still doesn't build (with the same defconfig), but due to another error:
libtool: install: (cd
/home/thomas/projets/buildroot/output/build/dhcp-4.4.1/common;/bin/sh"/home/thomas/projets/buildroot/output/build/dhcp-4.4.1/libtool" --tag CC --mode=relink/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -DISC_CHECK_NONE=1 -I../includes -I/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include -o libdhcp.la -rpath/usr/liballoc.lo bpf.lo comapi.lo conflex.lo ctrace.lo dhcp4o6.lo discover.lo dispatch.lo dlpi.lo dns.lo ethernet.lo execute.lo fddi.lo icmp.lo inet.lo lpf.lo memory.lo nit.lo ns_name.lo options.lo packet.lo parse.lo print.lo raw.lo resolv.lo socket.lo tables.lo tr.lo tree.lo upf.lo -L/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin/../../usr/lib -lbind9 -ldns -lisccfg -lisc -ldl -lpthread -inst-prefix-dir/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot)
libtool: relink:/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc-shared -fPIC -DPIC.libs/alloc.o.libs/bpf.o.libs/comapi.o.libs/conflex.o.libs/ctrace.o.libs/dhcp4o6.o.libs/discover.o.libs/dispatch.o.libs/dlpi.o.libs/dns.o.libs/ethernet.o.libs/execute.o.libs/fddi.o.libs/icmp.o.libs/inet.o.libs/lpf.o.libs/memory.o.libs/nit.o.libs/ns_name.o.libs/options.o.libs/packet.o.libs/parse.o.libs/print.o.libs/raw.o.libs/resolv.o.libs/socket.o.libs/tables.o.libs/tr.o.libs/tree.o.libs/upf.o
-Wl,-rpath -Wl,/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -L/home/thomas/projets/buildroot/output/build/bind-9.11.5-P4/lib/isccfg/.libs -L/home/thomas/projets/buildroot/output/build/bind-9.11.5-P4/lib/dns/.libs -L/home/thomas/projets/buildroot/output/build/bind-9.11.5-P4/lib/isc/.libs -L/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin/../../usr/lib -L/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -L/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -lbind9 -L/usr/lib -lisccfg -ldns -lisc -ldl -lpthread -Os -Wl,-soname -Wl,libdhcp.so.0 -o .libs/libdhcp.so.0.0.0
arm-linux-gcc: ERROR: unsafe header/library path used in cross-compilation: '-L/usr/lib'
libtool: error: error: relink 'libdhcp.la' with the above command before installing itThe -L/usr/lib doesn't exist on the libtool command line, so it gets invented by libtool. I think part of the problem is that this error happens during the staging installation case.
Quoted 7 lines
There is also this warning at configure time:
configure: WARNING: legacy configure is used but libtool is enabled. Trying to recover...
I have uploaded the full build log of the DHCP package at:
I tested this same defconfig file and it builds fine however if I add AUTORECONF = YES, the build fails.
The issue was raised by "bind9-config --libs" so I'll move this call under the BR2_STATIC_LIBS condition, it'll fix the build as libtool won't be used in static mode.
Quoted 8 lines
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Best Regards,
Fabrice