Skip to contentSkip to conversation

package/samba4: allow to use libtirpc instead of internal C implementation

PATCH New Bernd Kuhls 3 participants 7 messages Jul 23, 2017 – Sep 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 package/samba4: allow to use libtirpc instead of internal C implementation

This patch allows building samba4 with uClibc again after rpc support was removed from uClibc. Building with musl is still broken:

The first error

../nsswitch/wins.c: In function ?_nss_wins_gethostbyname_r?:
../nsswitch/wins.c:272:15: error: ?NETDB_INTERNAL? undeclared (first use in this function)

   *h_errnop = NETDB_INTERNAL;
               ^~~~~~~~~~~~~~
../nsswitch/wins.c:272:15: note: each undeclared identifier is reported only once for each function it appears in
../nsswitch/wins.c:349:14: error: ?NETDB_SUCCESS? undeclared (first use in this function)
  *h_errnop = NETDB_SUCCESS;
              ^~~~~~~~~~~~~

could be solved by applying
https://git.alpinelinux.org/cgit/aports/tree/main/samba/netdb-defines.patch

but then the build fails at

../ctdb/tests/src/test_mutex_raw.c: In function ?main?:
../ctdb/tests/src/test_mutex_raw.c:170:28: error: ?pthread_mutex_t {aka struct <anonymous>}? has no member named ?__data?

    printf("pid=%u\n", mutex->__data.__owner);
                            ^~

Therefore we disable musl support until a fix can be found.

---
Tested with test-pkg using this defconfig

BR2_PACKAGE_SAMBA4=y
BR2_PACKAGE_SAMBA4_AD_DC=y

                armv5-ctng-linux-gnueabi [ 1/47]: OK
              armv7-ctng-linux-gnueabihf [ 2/47]: OK
                        br-aarch64-glibc [ 3/47]: OK
                           br-arcle-hs38 [ 4/47]: OK
                            br-arm-basic [ 5/47]: SKIPPED
                  br-arm-cortex-a9-glibc [ 6/47]: OK
                   br-arm-cortex-a9-musl [ 7/47]: SKIPPED
                   br-arm-cortex-m4-full [ 8/47]: SKIPPED
                             br-arm-full [ 9/47]: OK
                    br-arm-full-nothread [10/47]: SKIPPED
                      br-arm-full-static [11/47]: SKIPPED
                            br-bfin-full [12/47]: SKIPPED
                   br-i386-pentium4-full [13/47]: OK
                br-i386-pentium-mmx-musl [14/47]: SKIPPED
                       br-m68k-5208-full [15/47]: SKIPPED
                      br-m68k-68040-full [16/47]: SKIPPED
                    br-microblazeel-full [17/47]: SKIPPED
                 br-mips32r6-el-hf-glibc [18/47]: OK
                      br-mips64-n64-full [19/47]: OK
                 br-mips64r6-el-hf-glibc [20/47]: OK
                      br-mipsel-o32-full [21/47]: OK
                          br-nios2-glibc [22/47]: SKIPPED
                      br-openrisc-uclibc [23/47]: SKIPPED
               br-powerpc-603e-basic-cpp [24/47]: SKIPPED
             br-powerpc64le-power8-glibc [25/47]: OK
               br-powerpc64-power7-glibc [26/47]: OK
                  br-powerpc-e500mc-full [27/47]: OK
                             br-sh4-full [28/47]: OK
                        br-sparc64-glibc [29/47]: OK
                         br-sparc-uclibc [30/47]: SKIPPED
                    br-x86-64-core2-full [31/47]: OK
                          br-x86-64-musl [32/47]: SKIPPED
                          br-xtensa-full [33/47]: OK
                     i686-ctng-linux-gnu [34/47]: OK
                          linaro-aarch64 [35/47]: OK
                              linaro-arm [36/47]: OK
             mips64el-ctng_n32-linux-gnu [37/47]: OK
             mips64el-ctng_n64-linux-gnu [38/47]: OK
        powerpc-ctng_e500v2-linux-gnuspe [39/47]: OK
                     sourcery-arm-armv4t [40/47]: OK
                            sourcery-arm [41/47]: OK
                     sourcery-arm-thumb2 [42/47]: OK
                         sourcery-mips64 [43/47]: OK
                           sourcery-mips [44/47]: OK
                          sourcery-nios2 [45/47]: SKIPPED
                         sourcery-x86-64 [46/47]: OK
           x86_64-ctng_locales-linux-gnu [47/47]: OK

47 builds, 16 skipped, 0 build failed, 0 legal-info failed

 package/samba4/Config.in | 7 ++++---
 package/samba4/samba4.mk | 7 +++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
package/samba4/Config.in +4 -3
index ba48b8ab3..298fdc660 100644
@@ -1,6 +1,6 @@
-comment "samba4 needs a toolchain w/ RPC, wchar, dynamic library, NPTL"
+comment "samba4 needs a uClibc or glibc toolchain w/ wchar, dynamic library, NPTL"
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_NATIVE_RPC \
+	depends on !BR2_USE_WCHAR || BR2_TOOLCHAIN_USES_MUSL \
 		|| BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_USE_MMU
 
@@ -8,12 +8,13 @@ config BR2_PACKAGE_SAMBA4
 	bool "samba4"
 	depends on BR2_USE_MMU # fork()
 	depends on BR2_USE_WCHAR # python
-	depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # python -> libffi
 	depends on !BR2_STATIC_LIBS # python, gnutls
 	depends on !BR2_nios2 # binary too large, relocations don't fit
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
+	depends on !BR2_TOOLCHAIN_USES_MUSL
 	select BR2_PACKAGE_E2FSPROGS
+	select BR2_PACKAGE_LIBTIRPC if !BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	select BR2_PACKAGE_POPT
 	select BR2_PACKAGE_PYTHON
 	select BR2_PACKAGE_ZLIB
package/samba4/samba4.mk +7 -0
index 72fbd7448..ccdd13e2f 100644
@@ -18,6 +18,13 @@ SAMBA4_DEPENDENCIES = \
 	$(if $(BR2_PACKAGE_READLINE),readline) \
 	$(TARGET_NLS_DEPENDENCIES)
 
+ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
+SAMBA4_CONF_ENV += \
+	CFLAGS="$(TARGET_CFLAGS) `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`" \
+	LDFLAGS="$(TARGET_LDFLAGS) `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`"
+SAMBA4_DEPENDENCIES += libtirpc
+endif
+
 ifeq ($(BR2_PACKAGE_ACL),y)
 SAMBA4_CONF_OPTS += --with-acl-support
 SAMBA4_DEPENDENCIES += acl
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/3 package/samba4: add optional dependency to dbus

samba4 picks up dbus as dependency if it was built before:

Checking for dbus                : yes
Checking for header dbus/dbus.h  : yes
Checking for library dbus-1      : yes

There is no configure option to control dbus support so we just make sure dbus is built before samba4 to have reproducible builds.

---
 package/samba4/samba4.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/samba4/samba4.mk +4 -0
index ccdd13e2f..ab3f67dc9 100644
@@ -40,6 +40,10 @@ else
 SAMBA4_CONF_OPTS += --disable-cups
 endif
 
+ifeq ($(BR2_PACKAGE_DBUS),y)
+SAMBA4_DEPENDENCIES += dbus
+endif
+
 ifeq ($(BR2_PACKAGE_DBUS)$(BR2_PACKAGE_AVAHI_DAEMON),yy)
 SAMBA4_CONF_OPTS += --enable-avahi
 SAMBA4_DEPENDENCIES += avahi
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/3 package/samba4: add optional dependency to dbus

Hello,

Quoted 6 lines · Bernd Kuhls

samba4 picks up dbus as dependency if it was built before:

Checking for dbus                : yes
Checking for header dbus/dbus.h  : yes
Checking for library dbus-1      : yes
Quoted 7 lines

There is no configure option to control dbus support so we just make sure dbus is built before samba4 to have reproducible builds.

---
 package/samba4/samba4.mk | 4 ++++
 1 file changed, 4 insertions(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 2/3 package/samba4: add optional dependency to dbus

In reply to Bernd Kuhls
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Bernd" == Bernd Kuhls <[email protected]> writes:

samba4 picks up dbus as dependency if it was built before:

Checking for dbus                : yes
Checking for header dbus/dbus.h  : yes
Checking for library dbus-1      : yes

There is no configure option to control dbus support so we just make sure dbus is built before samba4 to have reproducible builds.

Committed to 2017.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 3/3 package/samba4: bump version to 4.6.6

In reply to Bernd Kuhls
---
 package/samba4/samba4.hash | 2 +-
 package/samba4/samba4.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/samba4/samba4.hash +1 -1
index 0783b37d0..a2a0cd3a3 100644
@@ -1,2 +1,2 @@
 # Locally calculated
-sha256 f4c17123e3cc852a5ecc7e38884b00deab57632b9519aebc243e2a94b9b5ace4  samba-4.5.12.tar.gz
+sha256 fc31c809f7d85ae30f2b7dcddcb8404201b626047458cb5f2b743d4f6f3f1a8e  samba-4.6.6.tar.gz
package/samba4/samba4.mk +1 -1
index ab3f67dc9..9b9f5495c 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-SAMBA4_VERSION = 4.5.12
+SAMBA4_VERSION = 4.6.6
 SAMBA4_SITE = https://download.samba.org/pub/samba/stable
 SAMBA4_SOURCE = samba-$(SAMBA4_VERSION).tar.gz
 SAMBA4_INSTALL_STAGING = YES
Signature · 1 line
2.11.0
#5 lore raw

PATCH 3/3 package/samba4: bump version to 4.6.6

Hello,

Quoted 5 lines · Bernd Kuhls
---
 package/samba4/samba4.hash | 2 +-
 package/samba4/samba4.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH 1/3 package/samba4: allow to use libtirpc instead of internal C implementation

In reply to Bernd Kuhls

Hello,

Quoted 21 lines · Bernd Kuhls

This patch allows building samba4 with uClibc again after rpc support was removed from uClibc. Building with musl is still broken:

The first error

../nsswitch/wins.c: In function ?_nss_wins_gethostbyname_r?:
../nsswitch/wins.c:272:15: error: ?NETDB_INTERNAL? undeclared (first use in this function)

   *h_errnop = NETDB_INTERNAL;
               ^~~~~~~~~~~~~~
../nsswitch/wins.c:272:15: note: each undeclared identifier is reported only once for each function it appears in
../nsswitch/wins.c:349:14: error: ?NETDB_SUCCESS? undeclared (first use in this function)
  *h_errnop = NETDB_SUCCESS;
              ^~~~~~~~~~~~~

could be solved by applying
https://git.alpinelinux.org/cgit/aports/tree/main/samba/netdb-defines.patch

but then the build fails at

../ctdb/tests/src/test_mutex_raw.c: In function ?main?:
../ctdb/tests/src/test_mutex_raw.c:170:28: error: ?pthread_mutex_t {aka struct <anonymous>}? has no member named ?__data?

Quoted 8 lines
    printf("pid=%u\n", mutex->__data.__owner);
                            ^~

Therefore we disable musl support until a fix can be found.

---
Tested with test-pkg using this defconfig

Applied to master, with the following changes:

[Thomas:
- instead of setting SAMBA4_CONF_ENV within the libtirpc condition, introduce SAMBA4_CFLAGS and SAMBA4_LDFLAGS variables and use them
- add missing dependency on host-pkgconf, needed because we call pkg-config to get the flags from libtirpc]

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com