Bug 501325 - kinfocenter has a compile-time dependency on QTVulkanInstance, but Qt6 may be built without Vulkan support, handle this gracefully
Summary: kinfocenter has a compile-time dependency on QTVulkanInstance, but Qt6 may be...
Status: RESOLVED INTENTIONAL
Alias: None
Product: kinfocenter
Classification: Applications
Component: general (show other bugs)
Version: 6.3.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-10 22:45 UTC by Alexander Wessel
Modified: 2025-03-10 23:10 UTC (History)
1 user (show)

See Also:
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! (3.38 KB, patch)
2025-03-10 22:45 UTC, Alexander Wessel
Details

Note You need to log in before you can comment on or make changes to this bug.
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