Bug 452633

Summary: Pkg-config file for KF5WaylandClient.pc is missing KWayland module name or namespace in include path
Product: [Frameworks and Libraries] kwayland Reporter: Russell Obets <russell>
Component: clientAssignee: Martin Flöser <mgraesslin>
Status: RESOLVED FIXED    
Severity: normal CC: kwin-bugs-null, nate
Priority: NOR    
Version First Reported In: 5.93.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Russell Obets 2022-04-15 02:08:54 UTC
SUMMARY
While trying to build gnupg pinentry, I found the pkg-config file for KF5WaylandClient is pointing to ${prefix}/include/KF5 instead of ${prefix}/include/KF5/KWayland.

The header install path was updated in a recent commit:
https://invent.kde.org/frameworks/kwayland/-/commit/de442e4a94e249a29cf2e005db8e0a5e4a6a13ed

STEPS TO REPRODUCE
On Gentoo:
1. Install/update to kde-frameworks/kwayland-5.93.0 `emerge -1 =kde-frameworks/kwayland-5.93.0`

2. Attempt to install or update app-crypt/pinentry-1.2.0 `emerge -1 =app-crypt/pinentry-1.2.0`. This fails with error:
```x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I..   -I.. -I../secmem -I/usr/include/ncursesw -I../pinentry -Wall -I/usr/include/KF5 -DQT_GUI_LIB -I/usr/include/qt5/QtGui -I/usr/include/qt5 -DQT_CORE_LIB -I/usr/include/qt5/QtCore   -I/usr/include/qt5/QtCore -I/usr/include/qt5 -I/usr/include/qt5/QtGui -DQT_WIDGETS_LIB -I/usr/include/qt5/QtWidgets -DQT_GUI_LIB -DQT_CORE_LIB  -fpic -std=c++11 -DQT_X11EXTRAS_LIB -I/usr/include/qt5/QtX11Extras -I/usr/include/qt5 -I/usr/include/qt5/QtCore -DQT_GUI_LIB -I/usr/include/qt5/QtGui -DQT_CORE_LIB  -fpic -O2 -march=skylake -mtune=skylake -falign-functions=32 -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -pipe -O2 -pipe -Wl,-O1 -Wl,--as-needed -std=gnu++11 -c -o capslock_unix.o capslock_unix.cpp
capslock_unix.cpp:29:11: fatal error: KWayland/Client/connection_thread.h: No such file or directory
   29 | # include <KWayland/Client/connection_thread.h>
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

3. Check pkg-config data for KF5WaylandClient `pkg-config --cflags KF5WaylandClient`


OBSERVED RESULT
Include path for KF5WaylandClient is /usr/include/KF5
```
# pkg-config --cflags KF5WaylandClient
-I/usr/include/KF5 -DQT_GUI_LIB -I/usr/include/qt5/QtGui -I/usr/include/qt5 -DQT_CORE_LIB -I/usr/include/qt5/QtCore 
```


EXPECTED RESULT
Expect include path to be /usr/include/KF5/KWayland/
```
# ls /usr/include/KF5/KWayland/
KWayland  kwayland_version.h  Server
```

BluezQt with a similar directory structure provides an include path of /usr/include/KF5/BluezQt.
```
# ls /usr/include/KF5/BluezQt/
bluezqt  BluezQt  bluezqt_version.h

 # pkg-config --cflags KF5BluezQt 
-I/usr/include/KF5/BluezQt/ -I/usr/include/qt5/QtCore -I/usr/include/qt5 -DQT_NETWORK_LIB -I/usr/include/qt5/QtNetwork -DQT_DBUS_LIB -I/usr/include/qt5/QtDBus -DQT_CORE_LIB 
```

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma:  Plasma 5.24.4 on Gentoo ~x86_64
(available in About System)
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
Looks like even build prep is enough to see the resulting pkg-config file.

```
 russell@russell-blade ~/git/kwayland/build  master $ git show --oneline -s
f565454 (HEAD -> master, origin/master, origin/HEAD) [plasmawindowmanagement] Add resourceName
 russell@russell-blade ~/git/kwayland/build  master $ cmake ..
...
 russell@russell-blade ~/git/kwayland/build  master $ cat KF5WaylandClient.pc 

prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib64
includedir=${prefix}/include/KF5

Name: KF5WaylandClient
Description: Qt-style API to interact with the wayland-client and wayland-server API
URL: https://www.kde.org/
Version: 5.94.0
Libs: -L${prefix}/lib64 -lKF5WaylandClient
Cflags: -I${prefix}/include/KF5 
Requires: Qt5Gui
```

cmake_install.cmake shows the install path as "${CMAKE_INSTALL_PREFIX}/include/KF5/KWayland"
```
if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xDevelx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/include/KF5/KWayland" TYPE FILE FILES "/home/russell/git/kwayland/build/kwayland_version.h")
endif()
```
Comment 1 Nate Graham 2022-04-18 16:08:55 UTC
Would you be interested in submitting a mere request to fix it? You can do so here: https://invent.kde.org/frameworks/kwayland/-/merge_requests
Comment 2 Antonio Rojas 2022-04-18 16:23:00 UTC
Already fixed in 9e70125d2991a2a2ab64e606ccabd223848945b0 (and distributions have been notified)