Skip to contentSkip to conversation

Build bind with threads

PATCH In review [email protected] 4 participants 11 messages May 19, 2017 – Nov 21, 2017

lore
Share & tools
lore
#0 lore raw

cover Build bind with threads

From: Kai Kang <[email protected]>

The following changes since commit ef506f58da3a95fba2696df749b2b81f9c118847:

cve-check-tool: backport a patch to make CVE checking work (2017-05-18 14:01:48 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib kangkai/bind
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/bind

Kai Kang (2):
bind: build with threads and update configure options
dhcp: build shared libraries

 .../bind/bind/generate-rndc-key.sh                 |   1 +
 meta/recipes-connectivity/bind/bind_9.10.3-P3.bb   |  10 +-
 meta/recipes-connectivity/dhcp/dhcp.inc            |   6 +-
 .../dhcp/dhcp/build-shared-libs.patch              | 186 +++++++++++++++++++++
 meta/recipes-connectivity/dhcp/dhcp_4.3.5.bb       |   1 +
 5 files changed, 200 insertions(+), 4 deletions(-)
 create mode 100644 meta/recipes-connectivity/dhcp/dhcp/build-shared-libs.patch
Signature · 1 line
2.10.1
#1 lore raw

PATCH 1/2 bind: build with threads and update configure options

From: Kai Kang <[email protected]>

Build without threads for bind is inherited from legacy openembedded. All libc's support proper threading on Linux now, so enable threads support for bind.

It is also need to disable static library build which cause package dhcp fail to build after enable bind threads support.

Options devpoll and epoll are configured to choose most preferable multiplex method for unix socket. The priorities are: epoll > poll > select. When set '--enable-epoll', it just defines a var and include header file that is available for cross compile. So use epoll for bind.

Add PACKAGECONFIG 'urandom' that could use /dev/urandom as random device.

Update file/directory ownerships to fix daemon start failure.

---
 meta/recipes-connectivity/bind/bind/generate-rndc-key.sh |  1 +
 meta/recipes-connectivity/bind/bind_9.10.3-P3.bb         | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
meta/recipes-connectivity/bind/bind/generate-rndc-key.sh +1 -0
index db20127..ef915c0 100644
@@ -3,5 +3,6 @@
 if [ ! -s /etc/bind/rndc.key ]; then
     echo -n "Generating /etc/bind/rndc.key:"
     /usr/sbin/rndc-confgen -a -b 512 -r /dev/urandom
+    chown root:bind /etc/bind/rndc.key
     chmod 0640 /etc/bind/rndc.key
 fi
meta/recipes-connectivity/bind/bind_9.10.3-P3.bb +8 -2
index 18249f2..7eb79b0 100644
@@ -38,8 +38,8 @@ SRC_URI[md5sum] = "bcf7e772b616f7259420a3edc5df350a"
 SRC_URI[sha256sum] = "690810d1fbb72afa629e74638d19cd44e28d2b2e5eb63f55c705ad85d1a4cb83"
 
 ENABLE_IPV6 = "--enable-ipv6=${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'yes', 'no', d)}"
-EXTRA_OECONF = " ${ENABLE_IPV6} --with-randomdev=/dev/random --disable-threads \
-                 --disable-devpoll --disable-epoll --with-gost=no \
+EXTRA_OECONF = " ${ENABLE_IPV6} --with-libtool --enable-threads \
+                 --disable-devpoll --enable-epoll --with-gost=no \
                  --with-gssapi=no --with-ecdsa=yes \
                  --sysconfdir=${sysconfdir}/bind \
                  --with-openssl=${STAGING_LIBDIR}/.. \
@@ -51,6 +51,7 @@ PACKAGECONFIG ?= "readline"
 PACKAGECONFIG[httpstats] = "--with-libxml2,--without-libxml2,libxml2"
 PACKAGECONFIG[readline] = "--with-readline=-lreadline,,readline"
 PACKAGECONFIG[libedit] = "--with-readline=-ledit,,libedit"
+PACKAGECONFIG[urandom] = "--with-randomdev=/dev/urandom,--with-randomdev=/dev/random,,"
 
 USERADD_PACKAGES = "${PN}"
 USERADD_PARAM_${PN} = "--system --home ${localstatedir}/cache/bind --no-create-home \
@@ -101,6 +102,11 @@ do_install_append() {
 
 	install -d ${D}${sysconfdir}/default
 	install -m 0644 ${WORKDIR}/bind9 ${D}${sysconfdir}/default
+
+	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+		install -d ${D}${sysconfdir}/tmpfiles.d
+		echo "d /run/named 0755 bind bind - -" > ${D}${sysconfdir}/tmpfiles.d/bind.conf
+	fi
 }
 
 CONFFILES_${PN} = " \
Signature · 1 line
2.10.1
#2 lore raw

Re: [PATCH 1/2] bind: build with threads and update configure options

Quoted 7 lines · On 19 May 2017 at 09:52, <[email protected]> wrote:

Build without threads for bind is inherited from legacy openembedded. All libc's support proper threading on Linux now, so enable threads support for bind.

It is also need to disable static library build which cause package dhcp fail to build after enable bind threads support.

Quoted 9 lines

Options devpoll and epoll are configured to choose most preferable multiplex method for unix socket. The priorities are: epoll > poll > select. When set '--enable-epoll', it just defines a var and include header file that is available for cross compile. So use epoll for bind.

Add PACKAGECONFIG 'urandom' that could use /dev/urandom as random device.

Update file/directory ownerships to fix daemon start failure.

This is changing more than documented:

packages/corei7-64-poky-linux/bind/bind-utils: RDEPENDS: removed "libcrypto (['>= 1.0.2k'])", added "bind (['>= 9.10.3-P3'])"

(and dhcp has the same dropping of libcrypto)

Is this intentional?

Ross

author
#3 lore raw

Re: [PATCH 1/2] bind: build with threads and update configure options

Quoted 20 lines · Ross

On 19 May 2017 at 09:52, <[email protected] <mailto:[email protected]>> wrote:

Build without threads for bind is inherited from legacy openembedded. All libc's support proper threading on Linux now, so enable threads support for bind.

It is also need to disable static library build which cause package dhcp
fail to build after enable bind threads support.

Options devpoll and epoll are configured to choose most preferable multiplex method for unix socket. The priorities are: epoll > poll > select. When set '--enable-epoll', it just defines a var and include header file that is available for cross compile. So use epoll for bind.

Add PACKAGECONFIG 'urandom' that could use /dev/urandom as random device.

Quoted 6 lines

Update file/directory ownerships to fix daemon start failure.

This is changing more than documented:

packages/corei7-64-poky-linux/bind/bind-utils: RDEPENDS: removed "libcrypto (['>= 1.0.2k'])", added "bind (['>= 9.10.3-P3'])"

It is a problem and I am still working to figure it out.

Thanks,
Kai

Quoted 6 lines

(and dhcp has the same dropping of libcrypto)

Is this intentional?

Ross

Signature · 2 lines
Regards,
Neil | Kai Kang
author
#4 lore raw

Re: [PATCH 1/2] bind: build with threads and update configure options

Quoted 21 lines · Kang Kai
Quoted 20 lines · Ross

On 19 May 2017 at 09:52, <[email protected] <mailto:[email protected]>> wrote:

Build without threads for bind is inherited from legacy openembedded. All libc's support proper threading on Linux now, so enable threads support for bind.

It is also need to disable static library build which cause package dhcp
fail to build after enable bind threads support.

Options devpoll and epoll are configured to choose most preferable multiplex method for unix socket. The priorities are: epoll > poll > select. When set '--enable-epoll', it just defines a var and include header file that is available for cross compile. So use epoll for bind.

Add PACKAGECONFIG 'urandom' that could use /dev/urandom as random device.

Quoted 6 lines
Quoted 6 lines

Update file/directory ownerships to fix daemon start failure.

This is changing more than documented:

packages/corei7-64-poky-linux/bind/bind-utils: RDEPENDS: removed "libcrypto (['>= 1.0.2k'])", added "bind (['>= 9.10.3-P3'])"

Hi Ross,

Sorry for late reply.

Before this patch, bind is static built. So the 2 elf files "dig and host" in sub-packages bind-utils pack the libraries which require libcrypto from package bind itself. So bind-utils only depends on libcrypto but does not require bind.

When build dynamically, all the functions which require libcrypto are packages into dynamic libraries. And these libraries are packaged into bind. That cause bind depends on librypto and bind-utils depends on bind.

dhcp has the similar reason.

Regards,
Kai

Quoted 17 lines

It is a problem and I am still working to figure it out.

Thanks,
Kai

Quoted 6 lines

(and dhcp has the same dropping of libcrypto)

Is this intentional?

Ross

Signature · 2 lines
Regards,
Neil | Kai Kang
Signature · 2 lines
Regards,
Neil | Kai Kang
#5 lore raw

Re: [PATCH 1/2] bind: build with threads and update configure options

Quoted 10 lines · Kang Kai

On 2017年05月23日 17:58, Kang Kai wrote:
On 2017年05月19日 19:47, Burton, Ross wrote:

Quoted 7 lines · On 19 May 2017 at 09:52, <[email protected]> wrote:

Build without threads for bind is inherited from legacy openembedded. All libc's support proper threading on Linux now, so enable threads support for bind.

It is also need to disable static library build which cause package dhcp fail to build after enable bind threads support.

It seems this change was made without taking into account the advice given in:

http://git.openembedded.org/openembedded-core/commit/?id=f28757a4b89447ea528cba987f0396b92aa0bbfe

"If and when we ship bind's shared libraries we should ensure that the libraries go into a separate package."

In rocko builds I see "named" running on port 53 and dnsmasq fails to start...

Quoted 9 lines
Quoted 8 lines

Options devpoll and epoll are configured to choose most preferable multiplex method for unix socket. The priorities are: epoll > poll > select. When set '--enable-epoll', it just defines a var and include header file that is available for cross compile. So use epoll for bind.

Add PACKAGECONFIG 'urandom' that could use /dev/urandom as random device.

Update file/directory ownerships to fix daemon start failure.

author
#6 lore raw

Re: [PATCH 1/2] bind: build with threads and update configure options

Quoted 10 lines · Andre McCurdy
Quoted 9 lines · Kang Kai

On 2017年05月23日 17:58, Kang Kai wrote:
On 2017年05月19日 19:47, Burton, Ross wrote:

Quoted 6 lines · On 19 May 2017 at 09:52, <[email protected]> wrote:

Build without threads for bind is inherited from legacy openembedded. All libc's support proper threading on Linux now, so enable threads support for bind.

It is also need to disable static library build which cause package dhcp fail to build after enable bind threads support.

Quoted 8 lines

It seems this change was made without taking into account the advice given in:

   http://git.openembedded.org/openembedded-core/commit/?id=f28757a4b89447ea528cba987f0396b92aa0bbfe

"If and when we ship bind's shared libraries we should ensure that the libraries go into a separate package."

In rocko builds I see "named" running on port 53 and dnsmasq fails to start...

Thanks. I'll check that.

--Kai

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Options devpoll and epoll are configured to choose most preferable multiplex method for unix socket. The priorities are: epoll > poll > select. When set '--enable-epoll', it just defines a var and include header file that is available for cross compile. So use epoll for bind.

Add PACKAGECONFIG 'urandom' that could use /dev/urandom as random device.

Update file/directory ownerships to fix daemon start failure.

Signature · 2 lines
Regards,
Neil | Kai Kang
author
#7 lore raw

Re: [PATCH 1/2] bind: build with threads and update configure options

Quoted 9 lines · Kang Kai
Quoted 8 lines · Andre McCurdy
Quoted 7 lines · Kang Kai

On 2017年05月23日 17:58, Kang Kai wrote:
On 2017年05月19日 19:47, Burton, Ross wrote:

Quoted 4 lines · On 19 May 2017 at 09:52, <[email protected]> wrote:

Build without threads for bind is inherited from legacy openembedded. All libc's support proper threading on Linux now, so enable threads support for bind.

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

It is also need to disable static library build which cause package dhcp fail to build after enable bind threads support.

It seems this change was made without taking into account the advice given in:

http://git.openembedded.org/openembedded-core/commit/?id=f28757a4b89447ea528cba987f0396b92aa0bbfe

"If and when we ship bind's shared libraries we should ensure that the libraries go into a separate package."

Libraries are packaged to bind-libs which has been created by :

http://git.openembedded.org/openembedded-core/commit/?id=d74ebc91388941295a2321a295cdb06ee87fc38b

Regards,
Kai

Quoted 18 lines
Quoted 2 lines

In rocko builds I see "named" running on port 53 and dnsmasq fails to start...

Thanks. I'll check that.

--Kai

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Options devpoll and epoll are configured to choose most preferable multiplex method for unix socket. The priorities are: epoll > poll > select. When set '--enable-epoll', it just defines a var and include header file that is available for cross compile. So use epoll for bind.

Add PACKAGECONFIG 'urandom' that could use /dev/urandom as random device.

Update file/directory ownerships to fix daemon start failure.

Signature · 2 lines
Regards,
Neil | Kai Kang
#8 lore raw

Re: [PATCH 1/2] bind: build with threads and update configure options

Quoted 18 lines · Kang Kai
Quoted 17 lines · Kang Kai
Quoted 16 lines · Andre McCurdy
Quoted 11 lines · Kang Kai

On 2017年05月23日 17:58, Kang Kai wrote:
On 2017年05月19日 19:47, Burton, Ross wrote:

Quoted 8 lines · On 19 May 2017 at 09:52, <[email protected]> wrote:

Build without threads for bind is inherited from legacy openembedded. All libc's support proper threading on Linux now, so enable threads support for bind.

It is also need to disable static library build which cause package dhcp
fail to build after enable bind threads support.

It seems this change was made without taking into account the advice given in:

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines

http://git.openembedded.org/openembedded-core/commit/?id=f28757a4b89447ea528cba987f0396b92aa0bbfe

"If and when we ship bind's shared libraries we should ensure that the libraries go into a separate package."

Libraries are packaged to bind-libs which has been created by :

http://git.openembedded.org/openembedded-core/commit/?id=d74ebc91388941295a2321a295cdb06ee87fc38b

Looks good. Hopefully it gets pulled into rocko soon.

#9 lore raw

Re: [PATCH 1/2] bind: build with threads and update configure options

In reply to [email protected]
Quoted 9 lines · On Fri, 2017-05-19 at 16:52 +0800, [email protected] wrote:

From: Kai Kang <[email protected]>

Build without threads for bind is inherited from legacy openembedded. All libc's support proper threading on Linux now, so enable threads support for bind.

It is also need to disable static library build which cause package dhcp fail to build after enable bind threads support.

Quoted 6 lines

Options devpoll and epoll are configured to choose most preferable multiplex method for unix socket. The priorities are: epoll > poll > select. When set '--enable-epoll', it just defines a var and include header file that is available for cross compile. So use epoll for bind.

Add PACKAGECONFIG 'urandom' that could use /dev/urandom as random device.

I'd say using /dev/urandom should also be made the default.

Cheers,
Andre'

#10 lore raw

PATCH 2/2 dhcp: build shared libraries

In reply to [email protected]

From: Kai Kang <[email protected]>

When enable bind threads support, it fails to compile dhcp:

| tmp/work/armv5e-poky-linux-gnueabi/bind/9.10.3-P3-r0/build/lib/isc/pthreads/../../../ | ../bind-9.10.3-P3/lib/isc/pthreads/thread.c:64: undefined reference to `pthread_create'

Enable build shared libraries for bind and dhcp to fix the build failure. And the patch is ported from Fedora.

Add sub-package dhcp-libs to package shared libraries.

---
 meta/recipes-connectivity/dhcp/dhcp.inc            |   6 +-
 .../dhcp/dhcp/build-shared-libs.patch              | 186 +++++++++++++++++++++
 meta/recipes-connectivity/dhcp/dhcp_4.3.5.bb       |   1 +
 3 files changed, 191 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-connectivity/dhcp/dhcp/build-shared-libs.patch
meta/recipes-connectivity/dhcp/dhcp.inc +4 -2
index aafdd0a..969fdcb 100644
@@ -46,7 +46,7 @@ EXTRA_OECONF = "--with-srv-lease-file=${localstatedir}/lib/dhcp/dhcpd.leases \
                 --with-cli-lease-file=${localstatedir}/lib/dhcp/dhclient.leases \
                 --with-cli6-lease-file=${localstatedir}/lib/dhcp/dhclient6.leases \
                 --with-libbind=${STAGING_LIBDIR}/ \
-                --enable-paranoia \
+                --enable-paranoia --disable-static \
                 --with-randomdev=/dev/random \
                "
 
@@ -82,12 +82,14 @@ do_install_append () {
        sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service
 }
 
-PACKAGES += "dhcp-server dhcp-server-config dhcp-client dhcp-relay dhcp-omshell"
+PACKAGES += "dhcp-libs dhcp-server dhcp-server-config dhcp-client dhcp-relay dhcp-omshell"
 
 FILES_${PN} = ""
 RDEPENDS_${PN}-dev = ""
 RDEPENDS_${PN}-staticdev = ""
 
+FILES_${PN}-libs = "${libdir}/libdhcpctl.so.0* ${libdir}/libomapi.so.0*"
+
 FILES_${PN}-server = "${sbindir}/dhcpd ${sysconfdir}/init.d/dhcp-server"
 RRECOMMENDS_${PN}-server = "dhcp-server-config"
 
meta/recipes-connectivity/dhcp/dhcp/build-shared-libs.patch new file +186 -0

186 lines not on this page · raw message

meta/recipes-connectivity/dhcp/dhcp_4.3.5.bb +1 -0
index 678c29a..0a73ecc 100644
@@ -9,6 +9,7 @@ SRC_URI += "file://dhcp-3.0.3-dhclient-dbus.patch;striplevel=0 \
             file://libxml2-configure-argument.patch \
             file://tweak-to-support-external-bind.patch \
             file://remove-dhclient-script-bash-dependency.patch \
+            file://build-shared-libs.patch \
            "
 
 SRC_URI[md5sum] = "2b5e5b2fa31c2e27e487039d86f83d3f"
Signature · 1 line
2.10.1