Bug 498058 - Compiling issue for v3.2.0 Qt6
Summary: Compiling issue for v3.2.0 Qt6
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 3.2.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: kf5
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-30 13:40 UTC by Fabio
Modified: 2025-01-03 09:32 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio 2024-12-30 13:40:25 UTC
SUMMARY

Hi, I'm the maintainer of Amarok on AUR and I have made a separate pkgbuild also with clang to build the Qt6 version just to test it 

* https://aur.archlinux.org/packages/amarok
* https://github.com/FabioLolix/PKGBUILD-AUR_fix/blob/master/a/amarok-qt6/PKGBUILD
* https://github.com/FabioLolix/PKGBUILD-AUR_fix/blob/master/a/amarok-qt6_clang/PKGBUILD

STEPS TO REPRODUCE

On Arch Linux
sudo pacman -Syyu git base-devel
git clone https://github.com/FabioLolix/PKGBUILD-AUR_fix
cd PKGBUILD-AUR_fix/a/amarok-qt6
makepkg -s

OBSERVED RESULT

Fails to compile

EXPECTED RESULT

Compile successfully

SOFTWARE/OS VERSIONS
Linux: linux-lts 6.6.68
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1

ADDITIONAL INFORMATION

Building with GCC 14.2.1

```
 57%] Linking CXX shared library ../bin/libamaroklib.so
/usr/bin/ld: CMakeFiles/amaroklib.dir/browsers/filebrowser/FileView.cpp.o: warning: relocation against `_ZN12PopupDropper5clearEv' in read-only section `.text'
/usr/bin/ld: CMakeFiles/amaroklib.dir/browsers/CollectionTreeView.cpp.o: in function `CollectionTreeView::mouseReleaseEvent(QMouseEvent*)':
CollectionTreeView.cpp:(.text+0xba48): undefined reference to `PopupDropper::fadeHideFinished()'
/usr/bin/ld: CMakeFiles/amaroklib.dir/browsers/CollectionTreeView.cpp.o: relocation R_X86_64_PC32 against undefined protected symbol `_ZN12PopupDropper16fadeHideFinishedEv' can not be used when making a shared object
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/amaroklib.dir/build.make:7527: bin/libamaroklib.so.1.0.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:12657: src/CMakeFiles/amaroklib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
==> ERROR: A failure occurred in build().
```

Building with clang+lld v18.1.8
```
[ 57%] Linking CXX shared library ../bin/libamaroklib.so
ld.lld: error: undefined protected symbol: PopupDropper::PopupDropper(QWidget*, bool)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createPopupDropper(QWidget*, bool))
>>> did you mean: PopupDropper::PopupDropper(QWidget*, bool)
>>> defined in: ../bin/libamarokpud.so

ld.lld: error: undefined protected symbol: PopupDropper::setSvgRenderer(QSvgRenderer*)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createPopupDropper(QWidget*, bool))
>>> referenced by PrettyListView.cpp
>>>               CMakeFiles/amaroklib.dir/playlist/view/listview/PrettyListView.cpp.o:(Playlist::PrettyListView::startDrag(QFlags<Qt::DropAction>))

ld.lld: error: undefined protected symbol: PopupDropper::setQuitOnDragLeave(bool)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createPopupDropper(QWidget*, bool))

ld.lld: error: undefined protected symbol: PopupDropper::setFadeInTime(int)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createPopupDropper(QWidget*, bool))

ld.lld: error: undefined protected symbol: PopupDropper::setFadeOutTime(int)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createPopupDropper(QWidget*, bool))

ld.lld: error: undefined protected symbol: PopupDropper::setColors(QColor const&, QColor const&, QColor const&, QColor const&, QColor const&)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createPopupDropper(QWidget*, bool))

ld.lld: error: undefined protected symbol: PopupDropperItem::PopupDropperItem(QGraphicsItem*)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createItem(QAction*))

ld.lld: error: undefined protected symbol: PopupDropperItem::setAction(QAction*)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createItem(QAction*))

ld.lld: error: undefined protected symbol: PopupDropperItem::text() const
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createItem(QAction*))

ld.lld: error: undefined protected symbol: PopupDropperItem::setText(QString const&)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::createItem(QAction*))

ld.lld: error: undefined protected symbol: PopupDropperItem::setFont(QFont const&)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::adjustItem(PopupDropperItem*))

ld.lld: error: undefined protected symbol: PopupDropperItem::setHoverMsecs(int)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::adjustItem(PopupDropperItem*))

ld.lld: error: undefined protected symbol: PopupDropperItem::hoverIndicatorFillBrush() const
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::adjustItem(PopupDropperItem*))

ld.lld: error: undefined protected symbol: PopupDropperItem::setHoverIndicatorFillBrush(QBrush const&)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::adjustItem(PopupDropperItem*))

ld.lld: error: undefined protected symbol: PopupDropperItem::isSubmenuTrigger() const
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::adjustItem(PopupDropperItem*))

ld.lld: error: undefined protected symbol: PopupDropperItem::setHoverIndicatorShowStyle(PopupDropperItem::HoverIndicatorShowStyle)
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::adjustItem(PopupDropperItem*))

ld.lld: error: undefined protected symbol: PopupDropper::forEachItem(void (*)(void*))
>>> referenced by PopupDropperFactory.cpp
>>>               CMakeFiles/amaroklib.dir/PopupDropperFactory.cpp.o:(PopupDropperFactory::adjustItems(PopupDropper*))

ld.lld: error: undefined protected symbol: PopupDropper::isHidden() const
>>> referenced by FileView.cpp
>>>               CMakeFiles/amaroklib.dir/browsers/filebrowser/FileView.cpp.o:(FileView::startDrag(QFlags<Qt::DropAction>))
>>> referenced by PlaylistBrowserView.cpp
>>>               CMakeFiles/amaroklib.dir/browsers/playlistbrowser/PlaylistBrowserView.cpp.o:(PlaylistBrowserNS::PlaylistBrowserView::startDrag(QFlags<Qt::DropAction>))
>>> referenced by PrettyListView.cpp
>>>               CMakeFiles/amaroklib.dir/playlist/view/listview/PrettyListView.cpp.o:(Playlist::PrettyListView::startDrag(QFlags<Qt::DropAction>))
>>> referenced 1 more times

ld.lld: error: undefined protected symbol: PopupDropper::addItem(PopupDropperItem*, bool)
>>> referenced by FileView.cpp
>>>               CMakeFiles/amaroklib.dir/browsers/filebrowser/FileView.cpp.o:(FileView::startDrag(QFlags<Qt::DropAction>))
>>> referenced by PlaylistBrowserView.cpp
>>>               CMakeFiles/amaroklib.dir/browsers/playlistbrowser/PlaylistBrowserView.cpp.o:(PlaylistBrowserNS::PlaylistBrowserView::startDrag(QFlags<Qt::DropAction>))
>>> referenced by PrettyListView.cpp
>>>               CMakeFiles/amaroklib.dir/playlist/view/listview/PrettyListView.cpp.o:(Playlist::PrettyListView::startDrag(QFlags<Qt::DropAction>))
>>> referenced 3 more times

ld.lld: error: undefined protected symbol: PopupDropper::show()
>>> referenced by FileView.cpp
>>>               CMakeFiles/amaroklib.dir/browsers/filebrowser/FileView.cpp.o:(FileView::startDrag(QFlags<Qt::DropAction>))
>>> referenced by PlaylistBrowserView.cpp
>>>               CMakeFiles/amaroklib.dir/browsers/playlistbrowser/PlaylistBrowserView.cpp.o:(PlaylistBrowserNS::PlaylistBrowserView::startDrag(QFlags<Qt::DropAction>))
>>> referenced by PrettyListView.cpp
>>>               CMakeFiles/amaroklib.dir/playlist/view/listview/PrettyListView.cpp.o:(Playlist::PrettyListView::startDrag(QFlags<Qt::DropAction>))
>>> referenced 1 more times

ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/CMakeFiles/amaroklib.dir/build.make:7527: bin/libamaroklib.so.1.0.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:12657: src/CMakeFiles/amaroklib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
==> ERROR: A failure occurred in build().
```
Comment 1 Tuomas Nurmi 2024-12-30 15:28:01 UTC
Thank you for the report!
I guess I'll try setting up an Arch system and seeing if I can reproduce & fix later this week
Comment 2 Tuomas Nurmi 2025-01-02 22:20:12 UTC
Installed Arch & tested around a bit. Seems to be related to this one:
https://bugreports.qt.io/browse/QTBUG-112332

something similar here https://github.com/calamares/calamares/issues/2309
fixed apparently in packaging with https://gitlab.manjaro.org/manjaro-arm/packages/extra/calamares/-/commit/36071c2540e9eefaee50e1e79e5326843b57e7af#9b9baac1eb9b72790eef5540a1685306fc43fd6c_27_28
and worked around in source with https://github.com/calamares/calamares/commit/4eba859236777c5764ebd3db883a303ed810ee7b

Based on comments at https://github.com/pedrolcl/drumstick/issues/12 I tried editing PopupDropper_Export.h:32 from
# define POPUPDROPPER_EXPORT Q_DECL_EXPORT
to
# define POPUPDROPPER_EXPORT Q_DECL_EXPORT_OVERRIDABLE
which seemed to fix the build, too. But reading Qt headers, the Calamares' solution would probably be sensible here, as the section in question is inside ifdef for non-windows builds, anyhow.
Comment 3 Tuomas Nurmi 2025-01-02 22:55:47 UTC
Git commit d696408d3e6b719cdb657ed23c446d4f72617027 by Tuomas Nurmi.
Committed on 02/01/2025 at 22:47.
Pushed by nurmi into branch 'master'.

Edit libpud exports to fix build on some Qt6 setups

Related issue seems to be described at https://bugreports.qt.io/browse/QTBUG-112332

The fix done at
https://github.com/calamares/calamares/commit/4eba859236777c5764ebd3db883a303ed810ee7b
seems sensible here, too, and doesn't seem to break anything, so let's try that.

M  +1    -1    src/context/popupdropper/libpud/PopupDropper_Export.h

https://invent.kde.org/multimedia/amarok/-/commit/d696408d3e6b719cdb657ed23c446d4f72617027
Comment 4 Fabio 2025-01-02 23:15:25 UTC
Nice, it is compiling fine and running with GCC but fail with Clang:

[ 91%] Building CXX object tests/importers/CMakeFiles/testbansheeimporter.dir/__/__/src/importers/banshee/BansheeConfigWidget.cpp.o
/home/fabio/Dev/Github/PKGBUILD-AUR_fix/a/amarok-qt6-git/src/amarok/tests/importers/TestImporterBase.cpp:404:51: error: parameter declarator cannot be qualified
  404 |     const QString testName( QLatin1String( QTest::currentDataTag() ) );
      |                                            ~~~~~~~^
/home/fabio/Dev/Github/PKGBUILD-AUR_fix/a/amarok-qt6-git/src/amarok/tests/importers/TestImporterBase.cpp:404:27: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
  404 |     const QString testName( QLatin1String( QTest::currentDataTag() ) );
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/fabio/Dev/Github/PKGBUILD-AUR_fix/a/amarok-qt6-git/src/amarok/tests/importers/TestImporterBase.cpp:404:29: note: add a pair of parentheses to declare a variable
  404 |     const QString testName( QLatin1String( QTest::currentDataTag() ) );
      |                             ^
      |                             (                                       )
/home/fabio/Dev/Github/PKGBUILD-AUR_fix/a/amarok-qt6-git/src/amarok/tests/importers/TestImporterBase.cpp:406:37: error: reference to type 'const QString' could not bind to an lvalue of type 'const QString (QLatin1String ((*)()))'
  406 |     QVERIFY( trackForName.contains( testName ) );
      |                                     ^~~~~~~~
/usr/include/qt6/QtTest/qtestcase.h:60:43: note: expanded from macro 'QVERIFY'
   60 |     if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
      |                                           ^~~~~~~~~
/usr/include/qt6/QtCore/qmap.h:342:30: note: passing argument to parameter 'key' here
  342 |     bool contains(const Key &key) const
      |                              ^
/home/fabio/Dev/Github/PKGBUILD-AUR_fix/a/amarok-qt6-git/src/amarok/tests/importers/TestImporterBase.cpp:408:49: error: reference to type 'const QString' could not bind to an lvalue of type 'const QString (QLatin1String ((*)()))'
  408 |     const TrackPtr &track = trackForName.value( testName );
      |                                                 ^~~~~~~~
/usr/include/qt6/QtCore/qmap.h:358:24: note: passing argument to parameter 'key' here
  358 |     T value(const Key &key, const T &defaultValue = T()) const
      |                        ^
1 warning generated.
[ 91%] Linking CXX executable ../../../../../bin/testsqlartist
Comment 5 Tuomas Nurmi 2025-01-03 09:32:13 UTC
Ah, true. I've never tried compiling Amarok with clang before (no idea if anyone has) but the fix seemed to be trivial enough and is now in git master: 
https://invent.kde.org/multimedia/amarok/-/commit/4fdd5d39b0d585330956ad0b67d1807306e8dde2

At least builds now, but didn't test if the program starts / works