commit:     74f7ab1af81e3ce05117cd8b801d68c2bac10357
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Thu Dec 26 08:21:25 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 28 18:02:24 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74f7ab1a

net-nds/openldap: fix build issue with llvm profile and a test failure

1. building with llvm profile causes many error messagees like the
   one bellow:

     ld.lld: error: version script assignment of OPENLDAP_2.200 to symbol ... 
failed: symbol not defined

   This is caused by lld enable option "--no-undefined-version" by default
   (see 'https://reviews.llvm.org/D135402'). OpenLDAP define all dynamic
   symbols in libraries/{liblber/lber,libldap/ldap}.map, but some symbols
   are only available when specific configuration option are enabled. We've
   identified the options like HAVE_TLS, HAVE_CYRUS_SASL and LDAP_CONNECTIONLESS
   will cause build failures.
   There are two workarounds:
     1. Remove the symbol from .map file if the corresponding configuration
        option is not set.
     2. Add the linker option "-Wl,--undefined-version" to restore the default
        behavior that undefined symbols in shared libraries are allowed.

   Option 1 requires identifying all symbols controlled by different options,
   and using sed to remove them based on the configuration. Option 2 is much
   simpler and has no known side effects. We choose option 2.

2. In patch 'openldap-2.6.1-fix-missing-mapping.patch', 'ber_sockbuf_io_udp'
   was added to lber.map, but it's not completed. This symbol is part an
   unsupported feature (cldap or ldap over udp) and is only built when the
   unsupported LDAP_CONNECTIONLESS flag is defined. All the user of
   'ber_sockbuf_io_udp' are enclosed by #ifdef guards, it make no sense to not
   enclose it by #ifdef too. Another patch for ldap.map form Fedora is included
   too. Patch is updated to v2.

3. USE="debug" is required for USE="test", otherwise "test065-proxyauthz"
   will failed:
     must compile with LDAP_DEBUG for debugging
     unrecognized log level "pcache" (deferred)

Upstream Issue: https://bugs.openldap.org/show_bug.cgi?id=9739
FreeBSD Bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277585

Closes: https://bugs.gentoo.org/923334
Closes: https://bugs.gentoo.org/938553
Closes: https://bugs.gentoo.org/946816
Closes: https://bugs.gentoo.org/946975
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/39844
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../openldap-2.6.1-fix-missing-mapping.v2.patch    | 53 ++++++++++++++++++++++
 ...ap-2.6.6-r2.ebuild => openldap-2.6.4-r4.ebuild} | 36 +++++++--------
 net-nds/openldap/openldap-2.6.6-r2.ebuild          |  2 +-
 ...ap-2.6.6-r2.ebuild => openldap-2.6.6-r3.ebuild} |  7 ++-
 ...ap-2.6.6-r2.ebuild => openldap-2.6.8-r1.ebuild} | 52 +++++++++++++++------
 5 files changed, 113 insertions(+), 37 deletions(-)

diff --git a/net-nds/openldap/files/openldap-2.6.1-fix-missing-mapping.v2.patch 
b/net-nds/openldap/files/openldap-2.6.1-fix-missing-mapping.v2.patch
new file mode 100644
index 000000000000..d12ee12cfcca
--- /dev/null
+++ b/net-nds/openldap/files/openldap-2.6.1-fix-missing-mapping.v2.patch
@@ -0,0 +1,53 @@
+Fix of lber.mao & ldap.map from Fedora with URL below:
+  
https://src.fedoraproject.org/rpms/openldap/raw/rawhide/f/openldap-add-export-symbols-LDAP_CONNECTIONLESS.patch
+
+  From 6779e56fafb0aa8ae5efa7068da34a630b51b530 Mon Sep 17 00:00:00 2001
+  From: Simon Pichugin <[email protected]>
+  Date: Fri, 5 Aug 2022 13:23:52 -0700
+  Subject: [PATCH] Add export symbols related to LDAP_CONNECTIONLESS
+
+Upstream Issue: https://bugs.openldap.org/show_bug.cgi?id=9739
+
+But above patch is not complete, 'ber_sockbuf_io_udp' is part of an unsupported
+feature (cldap or ldap over udp), only built when the unsupported
+LDAP_CONNECTIONLESS flag is defined. All the user of 'ber_sockbuf_io_udp'
+are included by #ifdef, so it make no sense to not include it too.
+
+diff --git a/include/lber.h b/include/lber.h
+index 530359dc92..fd4957ddcd 100644
+--- a/include/lber.h
++++ b/include/lber.h
+@@ -590,7 +590,9 @@ LBER_V( Sockbuf_IO ) ber_sockbuf_io_tcp;
+ LBER_V( Sockbuf_IO ) ber_sockbuf_io_readahead;
+ LBER_V( Sockbuf_IO ) ber_sockbuf_io_fd;
+ LBER_V( Sockbuf_IO ) ber_sockbuf_io_debug;
++#ifdef LDAP_CONNECTIONLESS
+ LBER_V( Sockbuf_IO ) ber_sockbuf_io_udp;
++#endif
+ 
+ /*
+  * LBER memory.c
+diff --git a/libraries/liblber/lber.map b/libraries/liblber/lber.map
+index 9a4094b0fe..083cd1f322 100644
+--- a/libraries/liblber/lber.map
++++ b/libraries/liblber/lber.map
+@@ -121,6 +121,7 @@ OPENLDAP_2.200
+     ber_sockbuf_io_fd;
+     ber_sockbuf_io_readahead;
+     ber_sockbuf_io_tcp;
++    ber_sockbuf_io_udp;
+     ber_sockbuf_remove_io;
+     ber_sos_dump;
+     ber_start;
+diff --git a/libraries/libldap/ldap.map b/libraries/libldap/ldap.map
+index b28c9c21e7..021aaba63c 100644
+--- a/libraries/libldap/ldap.map
++++ b/libraries/libldap/ldap.map
+@@ -200,6 +200,7 @@ OPENLDAP_2.200
+     ldap_is_ldap_url;
+     ldap_is_ldapi_url;
+     ldap_is_ldaps_url;
++    ldap_is_ldapc_url;
+     ldap_is_read_ready;
+     ldap_is_write_ready;
+     ldap_ld_free;

diff --git a/net-nds/openldap/openldap-2.6.6-r2.ebuild 
b/net-nds/openldap/openldap-2.6.4-r4.ebuild
similarity index 97%
copy from net-nds/openldap/openldap-2.6.6-r2.ebuild
copy to net-nds/openldap/openldap-2.6.4-r4.ebuild
index 4830a68178ee..12920fbbf6fc 100644
--- a/net-nds/openldap/openldap-2.6.6-r2.ebuild
+++ b/net-nds/openldap/openldap-2.6.4-r4.ebuild
@@ -26,7 +26,7 @@ S="${WORKDIR}"/${PN}-OPENLDAP_REL_ENG_${MY_PV}
 LICENSE="OPENLDAP GPL-2"
 # Subslot added for bug #835654
 SLOT="0/$(ver_cut 1-2)"
-KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 
sparc x86 ~amd64-linux ~x86-linux"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
 
 IUSE_DAEMON="argon2 +cleartext crypt experimental minimal samba tcpd"
 IUSE_OVERLAY="overlays perl autoca"
@@ -34,17 +34,15 @@ IUSE_OPTIONAL="debug gnutls iodbc odbc sasl ssl selinux 
static-libs +syslog test
 IUSE_CONTRIB="kerberos kinit pbkdf2 sha2 smbkrb5passwd"
 IUSE_CONTRIB="${IUSE_CONTRIB} cxx"
 IUSE="systemd ${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} 
${IUSE_CONTRIB}"
-REQUIRED_USE="
-       cxx? ( sasl )
+REQUIRED_USE="cxx? ( sasl )
        pbkdf2? ( ssl )
-       test? ( cleartext sasl )
+       test? ( cleartext sasl debug )
        autoca? ( !gnutls )
        ?? ( test minimal )
-       kerberos? ( ?? ( kinit smbkrb5passwd ) )
-"
+       kerberos? ( ?? ( kinit smbkrb5passwd ) )"
 RESTRICT="!test? ( test )"
 
-SYSTEM_LMDB_VER=0.9.31
+SYSTEM_LMDB_VER=0.9.30
 # openssl is needed to generate lanman-passwords required by samba
 COMMON_DEPEND="
        kernel_linux? ( sys-apps/util-linux )
@@ -82,22 +80,19 @@ COMMON_DEPEND="
                )
        )
 "
-DEPEND="
-       ${COMMON_DEPEND}
+DEPEND="${COMMON_DEPEND}
        sys-apps/groff
 "
-RDEPEND="
-       ${COMMON_DEPEND}
+RDEPEND="${COMMON_DEPEND}
        selinux? ( sec-policy/selinux-ldap )
 "
 
 # The user/group are only used for running daemons which are
 # disabled in minimal builds, so elide the accounts too.
-BDEPEND="
-       !minimal? (
+BDEPEND="!minimal? (
                acct-group/ldap
                acct-user/ldap
-       )
+)
 "
 
 # for tracking versions
@@ -147,10 +142,9 @@ PATCHES=(
        "${FILESDIR}"/${PN}-2.6.1-system-mdb.patch
        "${FILESDIR}"/${PN}-2.6.1-cloak.patch
        "${FILESDIR}"/${PN}-2.6.1-flags.patch
-       "${FILESDIR}"/${PN}-2.6.1-fix-missing-mapping.patch
-       "${FILESDIR}"/${PN}-2.6.6-fix-type-mismatch-lloadd.patch
-       "${FILESDIR}"/${PN}-2.6.x-gnutls-pointer-error.patch
-       "${FILESDIR}"/${PN}-2.6.x-slapd-pointer-types.patch
+       "${FILESDIR}"/${PN}-2.6.1-fix-missing-mapping.v2.patch
+       "${FILESDIR}"/${PN}-2.6.4-clang16.patch
+       "${FILESDIR}"/${PN}-2.6.4-libressl.patch #903001
 )
 
 openldap_filecount() {
@@ -401,6 +395,9 @@ build_contrib_module() {
 }
 
 multilib_src_configure() {
+       # Workaround for bug #923334, #938553, #946816
+       append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+
        # Optional Features
        myconf+=(
                --enable-option-checking
@@ -686,7 +683,7 @@ multilib_src_test() {
                #TESTS+=( pldif ) # not done by default, so also exclude here
                #use odbc && TESTS+=( psql ) # not done by default, so also 
exclude here
 
-               emake -Onone "${TESTS[@]}"
+               emake "${TESTS[@]}"
        fi
 }
 
@@ -817,7 +814,6 @@ multilib_src_install() {
 multilib_src_install_all() {
        dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
        docinto rfc ; dodoc doc/rfc/*.txt
-       rmdir -p "${D}"/var/openldap-lloadd # Created but not used by any part 
of current codebase.
 }
 
 pkg_preinst() {

diff --git a/net-nds/openldap/openldap-2.6.6-r2.ebuild 
b/net-nds/openldap/openldap-2.6.6-r2.ebuild
index 4830a68178ee..76db88d237e2 100644
--- a/net-nds/openldap/openldap-2.6.6-r2.ebuild
+++ b/net-nds/openldap/openldap-2.6.6-r2.ebuild
@@ -37,7 +37,7 @@ IUSE="systemd ${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} 
${IUSE_OPTIONAL} ${
 REQUIRED_USE="
        cxx? ( sasl )
        pbkdf2? ( ssl )
-       test? ( cleartext sasl )
+       test? ( cleartext sasl debug )
        autoca? ( !gnutls )
        ?? ( test minimal )
        kerberos? ( ?? ( kinit smbkrb5passwd ) )

diff --git a/net-nds/openldap/openldap-2.6.6-r2.ebuild 
b/net-nds/openldap/openldap-2.6.6-r3.ebuild
similarity index 99%
copy from net-nds/openldap/openldap-2.6.6-r2.ebuild
copy to net-nds/openldap/openldap-2.6.6-r3.ebuild
index 4830a68178ee..66fd46cecdc3 100644
--- a/net-nds/openldap/openldap-2.6.6-r2.ebuild
+++ b/net-nds/openldap/openldap-2.6.6-r3.ebuild
@@ -26,7 +26,7 @@ S="${WORKDIR}"/${PN}-OPENLDAP_REL_ENG_${MY_PV}
 LICENSE="OPENLDAP GPL-2"
 # Subslot added for bug #835654
 SLOT="0/$(ver_cut 1-2)"
-KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 
sparc x86 ~amd64-linux ~x86-linux"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
 
 IUSE_DAEMON="argon2 +cleartext crypt experimental minimal samba tcpd"
 IUSE_OVERLAY="overlays perl autoca"
@@ -147,7 +147,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-2.6.1-system-mdb.patch
        "${FILESDIR}"/${PN}-2.6.1-cloak.patch
        "${FILESDIR}"/${PN}-2.6.1-flags.patch
-       "${FILESDIR}"/${PN}-2.6.1-fix-missing-mapping.patch
+       "${FILESDIR}"/${PN}-2.6.1-fix-missing-mapping.v2.patch
        "${FILESDIR}"/${PN}-2.6.6-fix-type-mismatch-lloadd.patch
        "${FILESDIR}"/${PN}-2.6.x-gnutls-pointer-error.patch
        "${FILESDIR}"/${PN}-2.6.x-slapd-pointer-types.patch
@@ -401,6 +401,9 @@ build_contrib_module() {
 }
 
 multilib_src_configure() {
+       # Workaround for bug #923334, #938553, #946816
+       append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+
        # Optional Features
        myconf+=(
                --enable-option-checking

diff --git a/net-nds/openldap/openldap-2.6.6-r2.ebuild 
b/net-nds/openldap/openldap-2.6.8-r1.ebuild
similarity index 95%
copy from net-nds/openldap/openldap-2.6.6-r2.ebuild
copy to net-nds/openldap/openldap-2.6.8-r1.ebuild
index 4830a68178ee..dcd8bb68c6da 100644
--- a/net-nds/openldap/openldap-2.6.6-r2.ebuild
+++ b/net-nds/openldap/openldap-2.6.8-r1.ebuild
@@ -26,7 +26,7 @@ S="${WORKDIR}"/${PN}-OPENLDAP_REL_ENG_${MY_PV}
 LICENSE="OPENLDAP GPL-2"
 # Subslot added for bug #835654
 SLOT="0/$(ver_cut 1-2)"
-KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 
sparc x86 ~amd64-linux ~x86-linux"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
 
 IUSE_DAEMON="argon2 +cleartext crypt experimental minimal samba tcpd"
 IUSE_OVERLAY="overlays perl autoca"
@@ -37,14 +37,14 @@ IUSE="systemd ${IUSE_DAEMON} ${IUSE_BACKEND} 
${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${
 REQUIRED_USE="
        cxx? ( sasl )
        pbkdf2? ( ssl )
-       test? ( cleartext sasl )
+       test? ( cleartext sasl debug )
        autoca? ( !gnutls )
        ?? ( test minimal )
        kerberos? ( ?? ( kinit smbkrb5passwd ) )
 "
 RESTRICT="!test? ( test )"
 
-SYSTEM_LMDB_VER=0.9.31
+SYSTEM_LMDB_VER=0.9.33
 # openssl is needed to generate lanman-passwords required by samba
 COMMON_DEPEND="
        kernel_linux? ( sys-apps/util-linux )
@@ -147,10 +147,10 @@ PATCHES=(
        "${FILESDIR}"/${PN}-2.6.1-system-mdb.patch
        "${FILESDIR}"/${PN}-2.6.1-cloak.patch
        "${FILESDIR}"/${PN}-2.6.1-flags.patch
-       "${FILESDIR}"/${PN}-2.6.1-fix-missing-mapping.patch
-       "${FILESDIR}"/${PN}-2.6.6-fix-type-mismatch-lloadd.patch
+       "${FILESDIR}"/${PN}-2.6.1-fix-missing-mapping.v2.patch
+       #"${FILESDIR}"/${PN}-2.6.6-fix-type-mismatch-lloadd.patch
        "${FILESDIR}"/${PN}-2.6.x-gnutls-pointer-error.patch
-       "${FILESDIR}"/${PN}-2.6.x-slapd-pointer-types.patch
+       #"${FILESDIR}"/${PN}-2.6.x-slapd-pointer-types.patch # included upstream
 )
 
 openldap_filecount() {
@@ -394,13 +394,19 @@ build_contrib_module() {
        einfo "Compiling contrib-module: $1"
        local target="${2:-all}"
        emake \
-               LDAP_BUILD="${BUILD_DIR}" prefix="${EPREFIX}/usr" \
-               CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" \
+               CC="${CC}" \
+               LDAP_BUILD="${BUILD_DIR}" \
+               libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" \
+               prefix="${EPREFIX}/usr" \
+               STRIP=/bin/true \
                "${target}"
        popd &>/dev/null || die
 }
 
 multilib_src_configure() {
+       # Workaround for bug #923334, #938553, #946816
+       append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+
        # Optional Features
        myconf+=(
                --enable-option-checking
@@ -417,6 +423,10 @@ multilib_src_configure() {
                $(multilib_native_use_with sasl cyrus-sasl)
        )
 
+       # error: passing argument 3 of ‘ldap_bv2rdn’ from incompatible pointer 
type [-Wincompatible-pointer-types]
+       # expected ‘char **’ but argument is of type ‘const char **’
+       #append-flags $(test-flags-CC -Wno-error=incompatible-pointer-types)
+
        if use experimental ; then
                # connectionless ldap per bug #342439
                # connectionless is a unsupported feature according to Howard 
Chu
@@ -530,7 +540,9 @@ multilib_src_configure() {
 
        tc-export AR CC CXX
 
-       ECONF_SOURCE="${S}" econf \
+       ECONF_SOURCE="${S}" \
+       STRIP=/bin/true \
+               econf \
                --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
                --localstatedir="${EPREFIX}"/var \
                --runstatedir="${EPREFIX}"/run \
@@ -566,13 +578,19 @@ src_configure_cxx() {
        append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs 
-L"${BUILD_DIR}"/libraries/libldap/.libs
        append-cppflags -I"${BUILD_DIR}"/include
 
-       ECONF_SOURCE="${S}"/contrib/ldapc++ econf "${myconf_ldapcpp[@]}"
+       ECONF_SOURCE="${S}"/contrib/ldapc++ \
+       STRIP=/bin/true \
+               econf \
+               "${myconf_ldapcpp[@]}"
        popd &>/dev/null || die "popd contrib/ldapc++"
 }
 
 multilib_src_compile() {
        tc-export AR CC CXX
-       emake CC="$(tc-getCC)" SHELL="${EPREFIX}"/bin/sh
+       emake \
+               CC="$(tc-getCC)" \
+               SHELL="${EPREFIX}"/bin/sh \
+               STRIP="/bin/true"
 
        if ! use minimal && multilib_is_native_abi ; then
                if use cxx ; then
@@ -610,8 +628,10 @@ multilib_src_compile() {
                        pushd "${S}/contrib/slapd-modules/samba4" &>/dev/null 
|| die "pushd contrib/slapd-modules/samba4"
 
                        emake \
+                               CC="$(tc-getCC)" \
                                LDAP_BUILD="${BUILD_DIR}" \
-                               CC="$(tc-getCC)" 
libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
+                               
libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" \
+                               STRIP=/bin/true
                        popd &>/dev/null || die
                fi
 
@@ -691,8 +711,12 @@ multilib_src_test() {
 }
 
 multilib_src_install() {
-       emake CC="$(tc-getCC)" \
-               DESTDIR="${D}" SHELL="${EPREFIX}"/bin/sh install
+       emake \
+               CC="$(tc-getCC)" \
+               DESTDIR="${D}" \
+               SHELL="${EPREFIX}"/bin/sh \
+               STRIP=/bin/true \
+               install
 
        if ! use minimal && multilib_is_native_abi; then
                # openldap modules go here

Reply via email to