Bug 277585 - net/openldap26-server build failing in 13.3 with llvm17
Summary: net/openldap26-server build failing in 13.3 with llvm17
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Xin LI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-08 19:37 UTC by Matt Magoffin
Modified: 2024-03-10 03:00 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (delphij)


Attachments
poudriere build output (120.48 KB, text/plain)
2024-03-08 19:37 UTC, Matt Magoffin
no flags Details
net/openldap26-server: fix build with lld 17 and DEBUG option off (1.54 KB, patch)
2024-03-09 20:26 UTC, Dimitry Andric
delphij: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Magoffin 2024-03-08 19:37:17 UTC
Created attachment 249036 [details]
poudriere build output

I am trying to build net/openldap26-server in poudriere for 13.3-RELEASE on amd64 and linking is failing with this output:

libtool: link: cc -shared  -fPIC -DPIC  .libs/bind.o .libs/open.o .libs/result.o .libs/error.o .libs/compare.o .libs/search.o .libs/controls.o .libs/messages.o .libs/references.o .libs/extended.o .libs/cyrus.o .libs/modify.o .libs/add.o .libs/modrdn.o .libs/delete.o .libs/abandon.o .libs/sasl.o .libs/sbind.o .libs/unbind.o .libs/cancel.o .libs/filter.o .libs/free.o .libs/sort.o .libs/passwd.o .libs/whoami.o .libs/vc.o .libs/getdn.o .libs/getentry.o .libs/getattr.o .libs/getvalues.o .libs/addentry.o .libs/request.o .libs/os-ip.o .libs/url.o .libs/pagectrl.o .libs/sortctrl.o .libs/vlvctrl.o .libs/init.o .libs/options.o .libs/print.o .libs/string.o .libs/util-int.o .libs/schema.o .libs/charray.o .libs/os-local.o .libs/dnssrv.o .libs/utf-8.o .libs/utf-8-conv.o .libs/tls2.o .libs/tls_o.o .libs/tls_g.o .libs/turn.o .libs/ppolicy.o .libs/dds.o .libs/txn.o .libs/ldap_sync.o .libs/stctrl.o .libs/assertion.o .libs/deref.o .libs/ldifutil.o .libs/ldif.o .libs/fetch.o .libs/lbase64.o .libs/msctrl.o .libs/psearchctrl.o .libs/threads.o .libs/rdwr.o .libs/tpool.o .libs/rq.o .libs/thr_posix.o .libs/thr_thr.o .libs/thr_nt.o .libs/thr_pth.o .libs/thr_debug.o .libs/account_usability.o .libs/avl.o .libs/tavl.o .libs/version.o   -Wl,-rpath -Wl,/wrkdirs/usr/ports/net/openldap26-server/work/openldap-2.6.7/libraries/liblber/.libs -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib ../../libraries/liblber/.libs/liblber.so -levent /usr/local/lib/libsasl2.so -lssl -lcrypto  -O2 -fstack-protector-strong -Wl,-rpath -Wl,/usr/local/lib -fstack-protector-strong -Wl,--version-script=./ldap.map -pthread   -pthread -Wl,-soname -Wl,libldap.so.2 -o .libs/libldap.so.2.0.200
ld: error: version script assignment of 'OPENLDAP_2.200' to symbol 'ldap_dump_connection' failed: symbol not defined
ld: error: version script assignment of 'OPENLDAP_2.200' to symbol 'ldap_dump_requests_and_responses' failed: symbol not defined
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [Makefile:426: libldap.la] Error 1
gmake[2]: Leaving directory '/wrkdirs/usr/ports/net/openldap26-server/work/openldap-2.6.7/libraries/libldap'
gmake[1]: *** [Makefile:310: all-common] Error 1
gmake[1]: Leaving directory '/wrkdirs/usr/ports/net/openldap26-server/work/openldap-2.6.7/libraries'
gmake: *** [Makefile:320: all-common] Error 1
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-03-09 20:11:32 UTC
For me, the port builds fine, but it's probably because ldap_dump_connection() and ldap_dump_requests_and_responses() are within a #ifdef LDAP_DEBUG block.

The DEBUG option is on by default, so you have probably turned it off. If I disable the option, I get the same errors as you.

There are two ways to fix this problem: either we unconditionally add -Wl,--undefined-version so any warnings about undefined symbols are ignored, or conditionally delete the symbols from the ldap.map file when the DEBUG option is off.
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2024-03-09 20:26:24 UTC
Created attachment 249055 [details]
net/openldap26-server: fix build with lld 17 and DEBUG option off
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-03-09 21:38:33 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3d75c31b623969e665a9c83337efe34417cd4b78

commit 3d75c31b623969e665a9c83337efe34417cd4b78
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-03-09 21:37:15 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2024-03-09 21:37:15 +0000

    net/openldap26-server: fix build with lld 17 and DEBUG option off

    If the DEBUG option for the net/openldap26-server is turned off,
    building the port will result in:

      ld: error: version script assignment of 'OPENLDAP_2.200' to symbol 'ldap_dump_connection' failed: symbol not defined
      ld: error: version script assignment of 'OPENLDAP_2.200' to symbol 'ldap_dump_requests_and_responses' failed: symbol not defined
      cc: error: linker command failed with exit code 1 (use -v to see invocation)

    This is because the mentioned symbols are in a #ifdef LDAP_DEBUG block,
    and will indeed not be defined if DEBUG option is off.

    Adjust the port Makefile to delete the undefined symbols from the
    ldap.map file, if the DEBUG option is off.

    PR:             277585
    Reported by:    Matt Magoffin <bugs.freebsd.org@msqr.us>
    MFH:            2024Q1

 net/openldap26-server/Makefile | 5 +++++
 1 file changed, 5 insertions(+)
Comment 4 Xin LI freebsd_committer freebsd_triage 2024-03-09 21:39:09 UTC
Committed Dimitry's patch, thanks!
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-03-09 21:42:34 UTC
A commit in branch 2024Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c03c94943e1de2751f21e6dd264538f0402df6b2

commit c03c94943e1de2751f21e6dd264538f0402df6b2
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-03-09 21:37:15 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2024-03-09 21:41:37 +0000

    net/openldap26-server: fix build with lld 17 and DEBUG option off

    If the DEBUG option for the net/openldap26-server is turned off,
    building the port will result in:

      ld: error: version script assignment of 'OPENLDAP_2.200' to symbol 'ldap_dump_connection' failed: symbol not defined
      ld: error: version script assignment of 'OPENLDAP_2.200' to symbol 'ldap_dump_requests_and_responses' failed: symbol not defined
      cc: error: linker command failed with exit code 1 (use -v to see invocation)

    This is because the mentioned symbols are in a #ifdef LDAP_DEBUG block,
    and will indeed not be defined if DEBUG option is off.

    Adjust the port Makefile to delete the undefined symbols from the
    ldap.map file, if the DEBUG option is off.

    PR:             277585
    Reported by:    Matt Magoffin <bugs.freebsd.org@msqr.us>

    (cherry picked from commit 3d75c31b623969e665a9c83337efe34417cd4b78)

 net/openldap26-server/Makefile | 5 +++++
 1 file changed, 5 insertions(+)
Comment 6 Matt Magoffin 2024-03-10 03:00:05 UTC
Awesome, thank you for finding the cause and fixing so quickly.