Bug 491808 - Calendar and contact apps don't start when built with -Wl,--as-needed
Summary: Calendar and contact apps don't start when built with -Wl,--as-needed
Status: RESOLVED FIXED
Alias: None
Product: Merkuro
Classification: Applications
Component: general (show other bugs)
Version: 24.07.90
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Claudio Cambra
URL:
Keywords:
: 492132 492252 492253 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-08-17 08:46 UTC by Antonio Rojas
Modified: 2024-09-18 07:57 UTC (History)
5 users (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 Antonio Rojas 2024-08-17 08:46:05 UTC
The calendar and contact apps don't run at all on 24.08 RC

> merkuro-contact 
QQmlApplicationEngine failed to load component
<Unknown File>: No module named "org.kde.merkuro.contact" found

> merkuro-calendar 
QQmlApplicationEngine failed to load component
qrc:/main.qml:328:19: Type MainDrawer unavailable
qrc:/MainDrawer.qml:341:9: Type CheckableCollectionNavigationView unavailable
qrc:/CheckableCollectionNavigationView.qml:11:1: Failed to extract plugin meta data from '/usr/lib/qt6/qml/org/kde/merkuro/contact/libmerkuro_contact_pluginplugin.so': '/usr/lib/qt6/qml/org/kde/merkuro/contact/libmerkuro_contact_pluginplugin.so' is not a Qt plugin (metadata not found)
Comment 1 Carl Schwan 2024-08-18 21:31:40 UTC
I can't reproduce but I don't doubt this happen.

Could you check if the file is correctly installed for you /usr/lib/qt6/qml/org/kde/merkuro/contact/libmerkuro_contact_pluginplugin.so ?
Comment 2 Antonio Rojas 2024-08-18 23:21:26 UTC
Yes, the files are there. Narrowed it down to linking with --as-needed
Comment 3 Antonio Rojas 2024-08-24 13:17:12 UTC
*** Bug 492132 has been marked as a duplicate of this bug. ***
Comment 4 Titouan Camus 2024-08-25 08:16:40 UTC
I have the same bug since 24.08. However, in my system,  /usr/lib/qt6/qml/org/kde is empty.

Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.6-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Comment 5 Antonio Rojas 2024-08-25 08:34:28 UTC
LD_PRELOAD'ing libmerkuro_contact_plugin.so.6 fixes the issue. Also fixed by forcefully linking binaries to it after build with patchelf:

sudo patchelf --add-needed libmerkuro_contact_plugin.so.6 /usr/bin/merkuro-calendar
sudo patchelf --add-needed libmerkuro_contact_plugin.so.6 /usr/bin/merkuro-contact

This linking is done at build time but --as-needed removes it since the executables don't use any symbol form the library.
Comment 6 Titouan Camus 2024-08-25 08:42:06 UTC
(In reply to Antonio Rojas from comment #5)
> LD_PRELOAD'ing libmerkuro_contact_plugin.so.6 fixes the issue. Also fixed by
> forcefully linking binaries to it after build with patchelf:
> 
> sudo patchelf --add-needed libmerkuro_contact_plugin.so.6
> /usr/bin/merkuro-calendar
> sudo patchelf --add-needed libmerkuro_contact_plugin.so.6
> /usr/bin/merkuro-contact
> 
> This linking is done at build time but --as-needed removes it since the
> executables don't use any symbol form the library.

Worked for me, thanks !
Comment 7 Antonio Rojas 2024-08-27 08:58:53 UTC
*** Bug 492252 has been marked as a duplicate of this bug. ***
Comment 8 Antonio Rojas 2024-08-27 08:59:17 UTC
*** Bug 492253 has been marked as a duplicate of this bug. ***
Comment 9 Bug Janitor Service 2024-08-30 13:01:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/merkuro/-/merge_requests/455
Comment 10 Carl Schwan 2024-08-30 14:15:23 UTC
Git commit 8f58856bd2bc7e4a2b6bcc964414e098784498e3 by Carl Schwan, on behalf of Antonio Rojas.
Committed on 30/08/2024 at 14:15.
Pushed by carlschwan into branch 'master'.

Compile contacts plugin metadata in the actual QML plugin, not in the shared library.

Otherwise Qt refuses to load it. This is worked around currently by linking the binaries to the contacts shared library, but this does not work when linking with --as-needed (as most distros do nowadays).

Also disambiguate the target names, currently both the shared library and the QML plugin have the same cmake target name.

M  +0    -1    src/calendar/CMakeLists.txt
M  +8    -15   src/contacts/CMakeLists.txt
M  +5    -5    src/contacts/autotests/CMakeLists.txt
M  +0    -1    src/contacts/contactconfig.kcfgc
D  +0    -17   src/contacts/contactplugin.cpp
D  +0    -15   src/contacts/contactplugin.h

https://invent.kde.org/pim/merkuro/-/commit/8f58856bd2bc7e4a2b6bcc964414e098784498e3
Comment 11 Carl Schwan 2024-08-30 14:23:16 UTC
Git commit 9f175f2973fea624c1f4de1fda26f64ffb236ec0 by Carl Schwan, on behalf of Antonio Rojas.
Committed on 30/08/2024 at 14:20.
Pushed by carlschwan into branch 'worl/carl/24-08-merkuro-fix-plugin-load'.

Compile contacts plugin metadata in the actual QML plugin, not in the shared library.

Otherwise Qt refuses to load it. This is worked around currently by linking the binaries to the contacts shared library, but this does not work when linking with --as-needed (as most distros do nowadays).

Also disambiguate the target names, currently both the shared library and the QML plugin have the same cmake target name.

M  +0    -1    src/calendar/CMakeLists.txt
M  +13   -14   src/contacts/CMakeLists.txt
M  +5    -5    src/contacts/autotests/CMakeLists.txt

https://invent.kde.org/pim/merkuro/-/commit/9f175f2973fea624c1f4de1fda26f64ffb236ec0
Comment 12 Torsten Wohlfarth (TUXEDO) 2024-09-18 07:31:53 UTC
I can confirm the patchelf way is working, the application is starting.
But rightclick ==> "New Event" (or "New Task") doesn't do anything.

And on every start from Konsole:


test@test:~$ merkuro-calendar
qrc:/main.qml:663:9: QML ScheduleView: Created graphical object was not placed in the graphics scene.
kf.config.core: Migrating old staterc "" -> "/home/test/.local/state/merkuro.calendarstaterc"
QFile::rename: Empty or null file name
kf.config.core: Failed to migrate "" -> "/home/test/.local/state/merkuro.calendarstaterc"
qrc:/HourlyView.qml:16:1: QML HourlyView: Created graphical object was not placed in the graphics scene.
qrc:/BasicInternalHourlyView.qml:681:41: TypeError: Cannot read property 'width' of null
qrc:/BasicInternalHourlyView.qml:681:41: TypeError: Cannot read property 'width' of null
qrc:/BasicInternalHourlyView.qml:681:41: TypeError: Cannot read property 'width' of null
qrc:/main.qml:651:9: QML MonthView: Created graphical object was not placed in the graphics scene.
qt.qml.context: qrc:/DayGridView.qml:401:37 Parameter "type" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.
qrc:/DayGridView.qml:394: TypeError: Property 'setUpAdd' of object CalendarUiUtils_QMLTYPE_0(0x64642bcab3d0) is not a function
Comment 13 Antonio Rojas 2024-09-18 07:57:15 UTC
(In reply to Torsten Wohlfarth (TUXEDO) from comment #12)
> I can confirm the patchelf way is working, the application is starting.
> But rightclick ==> "New Event" (or "New Task") doesn't do anything.

That's https://bugs.kde.org/show_bug.cgi?id=492820 (and the patchelf hack is no longer needed in 24.08.1)