https://bugs.kde.org/show_bug.cgi?id=524317
Bug ID: 524317
Summary: Linker error, expecting to have Qt::WaylandClient
Classification: Frameworks and Libraries
Product: layer-shell-qt
Version First unspecified
Reported In:
Platform: Fedora RPMs
OS: Linux
Status: REPORTED
Severity: minor
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
DESCRIPTION
So, I am trying to make an app very similar to spectacle, but for translation
of text and new words learning.
And when I am trying to compile my app with these deps (I've tried to add
Qt::WaylandClient dependency after 1st linker error, but it has'nt resolved my
issue):
```
target_link_libraries(QBackgroundAppWithShortcutToShow
PRIVATE
Qt::Core
Qt::Widgets
Qt::DBus
Qt::WaylandClient
LayerShellQt::Interface
)
```
STEPS TO REPRODUCE
1. I've tried to compile my app with LayerShellQt as a dependency.
Cmake and 'hello world' project example:
https://github.com/Maslyna/LayerShellQtLinkerBugExample/blob/master/CMakeLists.txt
OBSERVED RESULT
I got linker errors:
```
/usr/bin/ld.bfd: /usr/lib64/libLayerShellQtInterface.so.6.7.4: undefined
reference to
`QtWaylandClient::QWaylandWindow::updateExposure()@Qt_6.11_PRIVATE_API'
/usr/bin/ld.bfd: /usr/lib64/libLayerShellQtInterface.so.6.7.4: undefined
reference to `typeinfo for
QtWaylandClient::QWaylandShellSurface@Qt_6.11_PRIVATE_API'
/usr/bin/ld.bfd: /usr/lib64/libLayerShellQtInterface.so.6.7.4: undefined
reference to
`QtWaylandClient::QWaylandShellIntegration::~QWaylandShellIntegration()@Qt_6.11_PRIVATE_API'
/usr/bin/ld.bfd: /usr/lib64/libLayerShellQtInterface.so.6.7.4: undefined
reference to `QtWaylandClient::QWaylandShellSurface::sendProperty(QString
const&, QVariant const&)@Qt_6.11_PRIVATE_API'
...
Basically 24 linker errors from libLayerShellQtInterface.so that are expecting
to have Qt::WaylandClientPrivate
```
EXPECTED RESULT
Successful compilation
POSSIBLE SOLUTION AND ROOT CAUSE
I think, the root cause is in
https://invent.kde.org/plasma/layer-shell-qt/-/blob/ecebbfed0b42dbdb0dffa14e02e8ea3c345f0239/src/CMakeLists.txt
at lines 35-36 we are declaring Qt::WaylandClientPrivate as PRIVATE:
```
target_link_libraries(LayerShellQtInterface PUBLIC Qt::Gui)
target_link_libraries(LayerShellQtInterface PRIVATE Qt::WaylandClientPrivate
Wayland::Client PkgConfig::XKBCOMMON)
```
Since LayerShellQtInterface's own implementation depends on symbols from
libQt6WaylandClient.so - any consumer that doesn't also explicitly force-link
Qt6::WaylandClient gets this undefined reference at link time, because
"--as-needed" (Fedora's default) drops the library from the link line before it
can satisfy that transitive symbol.
Workaround that works for me:
```
target_link_libraries(QBackgroundAppWithShortcutToShow
PRIVATE
Qt::Core
Qt::Widgets
Qt::DBus
-Wl,--no-as-needed
Qt::WaylandClient
-Wl,--as-needed
LayerShellQt::Interface
)
```
SOFTWARE/OS VERSIONS
mordyntsev@fedora:~$ rpm -q layer-shell-qt qt6-qtwayland
layer-shell-qt-6.7.4-1.fc44.x86_64
qt6-qtwayland-6.11.1-1.fc44.x86_64
Operating System: Fedora Linux 44
KDE Plasma Version: 6.7.4
KDE Frameworks Version: 6.29.0
Qt Version: 6.11.1
Kernel Version: 7.1.8-200.fc44.x86_64 (64-bit)
Graphics Platform: Wayland
ADDITIONAL INFORMATION
Here's a project example, that can recreate my problem:
https://github.com/Maslyna/LayerShellQtLinkerBugExample.git
--
You are receiving this mail because:
You are watching all bug changes.