Bug 273992 - qt-dist.mk: suppress linker version script errors with lld >= 17
Summary: qt-dist.mk: suppress linker version script errors with lld >= 17
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks: 273753
  Show dependency treegraph
 
Reported: 2023-09-21 08:47 UTC by Dimitry Andric
Modified: 2023-11-04 16:27 UTC (History)
1 user (show)

See Also:


Attachments
qt-dist.mk: suppress linker version script errors with lld >= 17 (979 bytes, patch)
2023-09-21 08:47 UTC, Dimitry Andric
no flags Details | Diff
qt-dist.mk: suppress linker version script errors with lld >= 17 (now for all qt versions) (906 bytes, patch)
2023-09-26 19:07 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-09-21 08:47:00 UTC
Qt uses generated linker version scripts which always have a qt_version_tag symbol, but that symbol is only defined in the main Qt shared library. For other Qt components, this leads to lld >= 17 erroring out due to the symbol being undefined. Suppress these errors from qt-dist.mk, so we don't have to patch each individual port.

This affects at least:
* devel/qt5-dbus
* net/qt5-network
* databases/qt5-sql

which were the first ones to fall over with a clang+lld 17 poudriere bulk run.

For reference, the error you would see looks like:

...
c++ -Wl,--as-needed -fstack-protector-strong -Wl,--no-undefined -Wl,--version-script,QtDBus.version -pthread -Wl,-rpath,/usr/local/lib/qt5 -shared -Wl,-Bsymbolic-functions -Wl,-soname,libQt5DBus.so.5 -o libQt5DBus.so.5.15.8 .obj/qdbusconnection.o  .obj/qdbusconnectioninterface.o  .obj/qdbuserror.o  .obj/qdbusintegrator.o  .obj/qdbusmessage.o  .obj/qdbusserver.o  .obj/qdbusabstractinterface.o  .obj/qdbusinterface.o  .obj/qdbusxmlparser.o  .obj/qdbusutil.o  .obj/qdbusintrospection.o  .obj/qdbusabstractadaptor.o  .obj/qdbusinternalfilters.o  .obj/qdbusmetaobject.o  .obj/qdbusxmlgenerator.o  .obj/qdbusmisc.o  .obj/qdbusargument.o  .obj/qdbusreply.o  .obj/qdbusmetatype.o  .obj/qdbusextratypes.o  .obj/qdbuscontext.o  .obj/qdbuspendingcall.o  .obj/qdbuspendingreply.o  .obj/qdbus_symbols.o  .obj/qdbusservicewatcher.o  .obj/qdbusunixfiledescriptor.o  .obj/qdbusvirtualobject.o  .obj/moc_qdbusconnectioninterface.o  .obj/moc_qdbuserror.o  .obj/moc_qdbusconnection.o  .obj/moc_qdbusabstractadaptor.o  .obj/moc_qdbusvirtualobject.o  .obj/moc_qdbusconnection_p.o  .obj/moc_qdbusconnectionmanager_p.o  .obj/moc_qdbuspendingcall_p.o  -L/wrkdirs/usr/ports/devel/qt5-dbus/work/kde-qtbase-5.15.8p157/lib /usr/local/lib/qt5/libQt5Core.so -L/usr/local/lib -ldbus-1 
ld: error: version script assignment of 'Qt_5.15' to symbol 'qt_version_tag' failed: symbol not defined
c++: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-09-21 08:47:26 UTC
Created attachment 245087 [details]
qt-dist.mk: suppress linker version script errors with lld >= 17
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2023-09-26 19:07:30 UTC
Created attachment 245260 [details]
qt-dist.mk: suppress linker version script errors with lld >= 17 (now for all qt versions)

Move the LDFLAGS block so it applies to both qt5 and qt6, since they both have the same issue.
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-10-06 17:52:06 UTC
A commit in branch main references this bug:

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

commit 3e5360df35848a1ad8c5edae83a0a9cdfd6bb775
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-09-21 08:40:09 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-10-06 17:48:52 +0000

    qt-dist.mk: suppress linker version script errors with lld >= 17

    Qt uses generated linker version scripts which always have a
    qt_version_tag symbol, but that symbol is only defined in the main Qt
    shared library. For other Qt components, this leads to lld >= 17
    erroring out due to the symbol being undefined. Suppress these errors
    from qt-dist.mk, so we don't have to patch each individual port.

    This affects at least:
    * devel/qt5-dbus
    * net/qt5-network
    * databases/qt5-sql

    which were the first ones to fall over with a clang+lld 17 poudriere
    bulk run.

    For reference, the error you would see looks like:

      ...
      c++ -Wl,--as-needed -fstack-protector-strong -Wl,--no-undefined -Wl,--version-script,QtDBus.version -pthread -Wl,-rpath,/usr/local/lib/qt5 -shared -Wl,-Bsymbolic-functions -Wl,-soname,libQt5DBus.so.5 -o libQt5DBus.so.5.15.8 .obj/qdbusconnection.o  .obj/qdbusconnectioninterface.o  .obj/qdbuserror.o  .obj/qdbusintegrator.o  .obj/qdbusmessage.o  .obj/qdbusserver.o  .obj/qdbusabstractinterface.o  .obj/qdbusinterface.o  .obj/qdbusxmlparser.o  .obj/qdbusutil.o  .obj/qdbusintrospection.o  .obj/qdbusabstractadaptor.o  .obj/qdbusinternalfilters.o  .obj/qdbusmetaobject.o  .obj/qdbusxmlgenerator.o  .obj/qdbusmisc.o  .obj/qdbusargument.o  .obj/qdbusreply.o  .obj/qdbusmetatype.o  .obj/qdbusextratypes.o  .obj/qdbuscontext.o  .obj/qdbuspendingcall.o  .obj/qdbuspendingreply.o  .obj/qdbus_symbols.o  .obj/qdbusservicewatcher.o  .obj/qdbusunixfiledescriptor.o  .obj/qdbusvirtualobject.o  .obj/moc_qdbusconnectioninterface.o  .obj/moc_qdbuserror.o  .obj/moc_qdbusconnection.o  .obj/moc_qdbusabstracta
 daptor.o  .obj/moc_qdbusvirtualobject.o  .obj/moc_qdbusconnection_p.o  .obj/moc_qdbusconnectionmanager_p.o  .obj/moc_qdbuspendingcall_p.o  -L/wrkdirs/usr/ports/devel/qt5-dbus/work/kde-qtbase-5.15.8p157/lib /usr/local/lib/qt5/libQt5Core.so -L/usr/local/lib -ldbus-1
      ld: error: version script assignment of 'Qt_5.15' to symbol 'qt_version_tag' failed: symbol not defined
      c++: error: linker command failed with exit code 1 (use -v to see invocation)

    PR:             273992
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2023Q4

 Mk/Uses/qt-dist.mk | 6 ++++++
 1 file changed, 6 insertions(+)
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-11-04 16:27:36 UTC
A commit in branch main references this bug:

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

commit 3cb46a4465c6319ff9fcf7ac6d151ac884a515ee
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-11-04 15:51:40 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-11-04 16:26:59 +0000

    qt(-dist)?.mk: suppress linker version script errors with lld >= 17 (take 2)

    This amends commit 3e5360df35848a1ad8c5edae83a0a9cdfd6bb775:

      Qt uses generated linker version scripts which always have a
      qt_version_tag symbol, but that symbol is only defined in the main Qt
      shared library. For other Qt components, this leads to lld >= 17
      erroring out due to the symbol being undefined. Suppress these errors
      from qt-dist.mk, so we don't have to patch each individual port.

      This affects at least:
      * devel/qt5-dbus
      * net/qt5-network
      * databases/qt5-sql

      which were the first ones to fall over with a clang+lld 17 poudriere
      bulk run.

      For reference, the error you would see looks like:

        ...
        c++ -Wl,--as-needed -fstack-protector-strong -Wl,--no-undefined -Wl,--version-script,QtDBus.version -pthread -Wl,-rpath,/usr/local/lib/qt5 -shared -Wl,-Bsymbolic-functions -Wl,-soname,libQt5DBus.so.5 -o libQt5DBus.so.5.15.8 .obj/qdbusconnection.o  .obj/qdbusconnectioninterface.o  .obj/qdbuserror.o  .obj/qdbusintegrator.o  .obj/qdbusmessage.o  .obj/qdbusserver.o  .obj/qdbusabstractinterface.o  .obj/qdbusinterface.o  .obj/qdbusxmlparser.o  .obj/qdbusutil.o  .obj/qdbusintrospection.o  .obj/qdbusabstractadaptor.o  .obj/qdbusinternalfilters.o  .obj/qdbusmetaobject.o  .obj/qdbusxmlgenerator.o  .obj/qdbusmisc.o  .obj/qdbusargument.o  .obj/qdbusreply.o  .obj/qdbusmetatype.o  .obj/qdbusextratypes.o  .obj/qdbuscontext.o  .obj/qdbuspendingcall.o  .obj/qdbuspendingreply.o  .obj/qdbus_symbols.o  .obj/qdbusservicewatcher.o  .obj/qdbusunixfiledescriptor.o  .obj/qdbusvirtualobject.o  .obj/moc_qdbusconnectioninterface.o  .obj/moc_qdbuserror.o  .obj/moc_qdbusconnection.o  .obj/moc_qdbusabstrac
 tadaptor.o  .obj/moc_qdbusvirtualobject.o  .obj/moc_qdbusconnection_p.o  .obj/moc_qdbusconnectionmanager_p.o  .obj/moc_qdbuspendingcall_p.o  -L/wrkdirs/usr/ports/devel/qt5-dbus/work/kde-qtbase-5.15.8p157/lib /usr/local/lib/qt5/libQt5Core.so -L/usr/local/lib -ldbus-1
        ld: error: version script assignment of 'Qt_5.15' to symbol 'qt_version_tag' failed: symbol not defined
        c++: error: linker command failed with exit code 1 (use -v to see invocation)

    Some qt ports, such as www/qt5-webkit, do not use qt-dist.mk but qt.mk,
    and qt-dist.mk includes qt.mk, so move the workaround that sets LDFLAGS
    to qt.mk instead. This should fix the problem for all qt ports.

    PR:             273992, 273753
    Fixes:          3e5360df3584
    MFH:            2023Q4

 Mk/Uses/qt-dist.mk | 6 ------
 Mk/Uses/qt.mk      | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)