Bug 501325

Summary: kinfocenter has a compile-time dependency on QTVulkanInstance, but Qt6 may be built without Vulkan support, handle this gracefully
Product: [Applications] kinfocenter Reporter: Alexander Wessel <flexx>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: sitter
Priority: NOR    
Version: 6.3.2   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Incomplete patch, simply makes the code compile (to find all affected locations), but won't link nor work as expected!

Description Alexander Wessel 2025-03-10 22:45:15 UTC
Created attachment 179276 [details]
Incomplete patch, simply makes the code compile (to find all affected locations), but won't link nor work as expected!

kinfocenter 6.3.2 currently doesn't build on my (~amd64) Gentoo box (sandybridge with integrated graphics and NO vulkan support). I consequently disable vulkan globally with the -vulkan use flag.

Thus my Qt6 is build without Vulkan support (i. e. QT_CONFIG(vulkan) is not defined during the Qt6 build). This causes <QVulkanInstance>, <QVulkanFunctions> and some VK_* constants (VK_PHYSICAL_DEVICE_TYPE_*) to be unavailable.

At least the following files have hard dependencies on one or more of the aforementioned classes / constants.

kcms/about-distro/src/GPUEntry.h
kcms/about-distro/src/GPUEntry.cpp
kcms/about-distro/src/GPUEntryFactory.cpp
kcms/about-distro/src/main.cpp

Since not every system will have Qt6 with Vulkan support compiled in, kinfocenter should not depend on these optional classes at compile time.

I'll attach a patch draft, which makes the code compile, but not link, as a starting point. It's basically my work in progess to get an working ebuild locally (where I don't care about breaking any of the vulkan-related stuff)

Note that the pattern

```c++
QVulkanInstance inst;

bool ok = inst.create();
if (!ok) {
    // ... Vulkan not available
}
```

does not work -- it *also* requires that QT6 was built with Vulkan support (with -feature-vulkan).

Thus dependent code should test if QVulkanInstance is available at all, using the preprocessor, e. g. 

#if __has_include(<QVulkanInstance>)
#define QT_VULKAN
#endif

It appears that kinfocenter 6.2.5 was the last version that compiled on a non-vulkan enabled Qt6.
Comment 1 Harald Sitter 2025-03-10 22:51:40 UTC
It's a required feature.
Comment 2 Alexander Wessel 2025-03-10 23:10:14 UTC
(In reply to Harald Sitter from comment #1)
> It's a required feature.

Vulkan is now a required feature to compile and run KDE Plasma!? :O 

That's quite unfortunate news to me. Can you point me to some announcement or something to that effect?

Also... Why? It's a just a few lines of conditional code, really...

Thanks anyway,
Alexander