ValveSoftware / gamescope

SteamOS session compositing window manager
Other
3.05k stars 201 forks source link

Build Issue With Vulkan-Headers 1.3.243 #858

Open FireBurn opened 1 year ago

FireBurn commented 1 year ago
FAILED: layer/libVkLayer_FROG_gamescope_wsi.so.p/VkLayer_FROG_gamescope_wsi.cpp.o 
x86_64-pc-linux-gnu-g++ -Ilayer/libVkLayer_FROG_gamescope_wsi.so.p -Ilayer -I../gamescope-3.11.52-beta6/layer -Iprotocol -I/usr/lib64/libffi/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++20 -DWLR_USE_UNSTABLE -Wno-unused-parameter -Wno-missing-field-initializers -Wno-invalid-offsetof -Wno-unused-const-variable -DHAVE_PIPEWIRE=1 -DHAVE_OPENVR=0 '-DHWDATA_PNP_IDS="//usr/share/hwdata/pnp.ids"' -O3 -march=native -pipe -flto=16 -fPIC -MD -MQ layer/libVkLayer_FROG_gamescope_wsi.so.p/VkLayer_FROG_gamescope_wsi.cpp.o -MF layer/libVkLayer_FROG_gamescope_wsi.so.p/VkLayer_FROG_gamescope_wsi.cpp.o.d -o layer/libVkLayer_FROG_gamescope_wsi.so.p/VkLayer_FROG_gamescope_wsi.cpp.o -c ../gamescope-3.11.52-beta6/layer/VkLayer_FROG_gamescope_wsi.cpp
In file included from ../gamescope-3.11.52-beta6/layer/VkLayer_FROG_gamescope_wsi.cpp:4:
/usr/include/vkroots.h:481:5: error: ‘PFN_vkGetPhysicalDeviceRefreshableObjectTypesKHR’ does not name a type; did you mean ‘PFN_vkGetPhysicalDevicePresentRectanglesKHR’?
  481 |     PFN_vkGetPhysicalDeviceRefreshableObjectTypesKHR GetPhysicalDeviceRefreshableObjectTypesKHR;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     PFN_vkGetPhysicalDevicePresentRectanglesKHR
/usr/include/vkroots.h: In constructor ‘vkroots::VkPhysicalDeviceDispatch::VkPhysicalDeviceDispatch(vkroots::PFN_vkGetPhysicalDeviceProcAddr, VkInstance, const vkroots::VkInstanceDispatch*)’:
/usr/include/vkroots.h:414:7: error: ‘GetPhysicalDeviceRefreshableObjectTypesKHR’ was not declared in this scope
  414 |       GetPhysicalDeviceRefreshableObjectTypesKHR = (PFN_vkGetPhysicalDeviceRefreshableObjectTypesKHR) NextGetPhysicalDeviceProcAddr(instance, "vkGetPhysicalDeviceRefreshableObjectTypesKHR");
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:414:53: error: ‘PFN_vkGetPhysicalDeviceRefreshableObjectTypesKHR’ was not declared in this scope; did you mean ‘PFN_vkGetPhysicalDevicePresentRectanglesKHR’?
  414 |       GetPhysicalDeviceRefreshableObjectTypesKHR = (PFN_vkGetPhysicalDeviceRefreshableObjectTypesKHR) NextGetPhysicalDeviceProcAddr(instance, "vkGetPhysicalDeviceRefreshableObjectTypesKHR");
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                     PFN_vkGetPhysicalDevicePresentRectanglesKHR
/usr/include/vkroots.h: At global scope:
/usr/include/vkroots.h:1300:5: error: ‘PFN_vkCmdRefreshObjectsKHR’ does not name a type; did you mean ‘PFN_vkCmdResetEvent2KHR’?
 1300 |     PFN_vkCmdRefreshObjectsKHR CmdRefreshObjectsKHR;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |     PFN_vkCmdResetEvent2KHR
/usr/include/vkroots.h:1560:5: error: ‘PFN_vkGetCommandPoolMemoryConsumption’ does not name a type
 1560 |     PFN_vkGetCommandPoolMemoryConsumption GetCommandPoolMemoryConsumption;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:1595:5: error: ‘PFN_vkGetFaultData’ does not name a type; did you mean ‘PFN_vkGetPrivateData’?
 1595 |     PFN_vkGetFaultData GetFaultData;
      |     ^~~~~~~~~~~~~~~~~~
      |     PFN_vkGetPrivateData
/usr/include/vkroots.h: In constructor ‘vkroots::VkDeviceDispatch::VkDeviceDispatch(PFN_vkGetDeviceProcAddr, VkDevice, VkPhysicalDevice, const vkroots::VkPhysicalDeviceDispatch*, const VkDeviceCreateInfo*)’:
/usr/include/vkroots.h:668:7: error: ‘CmdRefreshObjectsKHR’ was not declared in this scope
  668 |       CmdRefreshObjectsKHR = (PFN_vkCmdRefreshObjectsKHR) NextGetDeviceProcAddr(device, "vkCmdRefreshObjectsKHR");
      |       ^~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:668:31: error: ‘PFN_vkCmdRefreshObjectsKHR’ was not declared in this scope; did you mean ‘PFN_vkCmdResetEvent2KHR’?
  668 |       CmdRefreshObjectsKHR = (PFN_vkCmdRefreshObjectsKHR) NextGetDeviceProcAddr(device, "vkCmdRefreshObjectsKHR");
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                               PFN_vkCmdResetEvent2KHR
/usr/include/vkroots.h:929:7: error: ‘GetCommandPoolMemoryConsumption’ was not declared in this scope
  929 |       GetCommandPoolMemoryConsumption = (PFN_vkGetCommandPoolMemoryConsumption) NextGetDeviceProcAddr(device, "vkGetCommandPoolMemoryConsumption");
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:929:42: error: ‘PFN_vkGetCommandPoolMemoryConsumption’ was not declared in this scope
  929 |       GetCommandPoolMemoryConsumption = (PFN_vkGetCommandPoolMemoryConsumption) NextGetDeviceProcAddr(device, "vkGetCommandPoolMemoryConsumption");
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:964:7: error: ‘GetFaultData’ was not declared in this scope
  964 |       GetFaultData = (PFN_vkGetFaultData) NextGetDeviceProcAddr(device, "vkGetFaultData");
      |       ^~~~~~~~~~~~
/usr/include/vkroots.h:964:23: error: ‘PFN_vkGetFaultData’ was not declared in this scope; did you mean ‘PFN_vkGetPrivateData’?
  964 |       GetFaultData = (PFN_vkGetFaultData) NextGetDeviceProcAddr(device, "vkGetFaultData");
      |                       ^~~~~~~~~~~~~~~~~~
      |                       PFN_vkGetPrivateData
/usr/include/vkroots.h: At global scope:
/usr/include/vkroots.h:3465:78: error: ‘VkRefreshObjectListKHR’ does not name a type
 3465 |   static void wrap_CmdRefreshObjectsKHR(VkCommandBuffer commandBuffer, const VkRefreshObjectListKHR *pRefreshObjects) {
      |                                                                              ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:4518:170: error: redefinition of ‘const VkSwapchainCreateInfoKHR* pCreateInfos’
 4518 |   static VkResult wrap_CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR *pCreateInfos, const VkSwapchainCreateInfoKHR *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) {
      |                                                                                                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/vkroots.h:4518:124: note: ‘const VkSwapchainCreateInfoKHR* pCreateInfos’ previously declared here
 4518 |   static VkResult wrap_CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR *pCreateInfos, const VkSwapchainCreateInfoKHR *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) {
      |                                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/vkroots.h:4525:137: error: redefinition of ‘const VkSwapchainCreateInfoKHR* pCreateInfo’
 4525 |   static VkResult wrap_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) {
      |                                                                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/usr/include/vkroots.h:4525:92: note: ‘const VkSwapchainCreateInfoKHR* pCreateInfo’ previously declared here
 4525 |   static VkResult wrap_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) {
      |                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/usr/include/vkroots.h:4989:127: error: ‘VkCommandPoolMemoryConsumption’ has not been declared
 4989 |   static void wrap_GetCommandPoolMemoryConsumption(VkDevice device, VkCommandPool commandPool, VkCommandBuffer commandBuffer, VkCommandPoolMemoryConsumption *pConsumption) {
      |                                                                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:5194:54: error: ‘VkFaultQueryBehavior’ has not been declared
 5194 |   static VkResult wrap_GetFaultData(VkDevice device, VkFaultQueryBehavior faultQueryBehavior, VkBool32 *pUnrecordedFaults, uint32_t *pFaultCount, VkFaultData *pFaults) {
      |                                                      ^~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:5194:147: error: ‘VkFaultData’ has not been declared
 5194 |   static VkResult wrap_GetFaultData(VkDevice device, VkFaultQueryBehavior faultQueryBehavior, VkBool32 *pUnrecordedFaults, uint32_t *pFaultCount, VkFaultData *pFaults) {
      |                                                                                                                                                   ^~~~~~~~~~~
/usr/include/vkroots.h:11268:50: error: ‘VkFaultLevel’ was not declared in this scope
11268 |     template <> constexpr const char* enumString<VkFaultLevel>(VkFaultLevel type) {
      |                                                  ^~~~~~~~~~~~
/usr/include/vkroots.h:11268:64: error: template-id ‘enumString<<expression error> >’ used as a declarator
11268 |     template <> constexpr const char* enumString<VkFaultLevel>(VkFaultLevel type) {
      |                                                                ^~~~~~~~~~~~
/usr/include/vkroots.h:11268:64: error: ‘VkFaultLevel’ was not declared in this scope
/usr/include/vkroots.h:11268:82: error: expected ‘;’ before ‘{’ token
11268 |     template <> constexpr const char* enumString<VkFaultLevel>(VkFaultLevel type) {
      |                                                                                  ^~
      |                                                                                  ;
/usr/include/vkroots.h:11279:50: error: ‘VkFaultQueryBehavior’ was not declared in this scope
11279 |     template <> constexpr const char* enumString<VkFaultQueryBehavior>(VkFaultQueryBehavior type) {
      |                                                  ^~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:11279:72: error: template-id ‘enumString<<expression error> >’ used as a declarator
11279 |     template <> constexpr const char* enumString<VkFaultQueryBehavior>(VkFaultQueryBehavior type) {
      |                                                                        ^~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:11279:72: error: ‘VkFaultQueryBehavior’ was not declared in this scope
/usr/include/vkroots.h:11279:98: error: expected ‘;’ before ‘{’ token
11279 |     template <> constexpr const char* enumString<VkFaultQueryBehavior>(VkFaultQueryBehavior type) {
      |                                                                                                  ^~
      |                                                                                                  ;
/usr/include/vkroots.h:11287:50: error: ‘VkFaultType’ was not declared in this scope
11287 |     template <> constexpr const char* enumString<VkFaultType>(VkFaultType type) {
      |                                                  ^~~~~~~~~~~
/usr/include/vkroots.h:11287:63: error: template-id ‘enumString<<expression error> >’ used as a declarator
11287 |     template <> constexpr const char* enumString<VkFaultType>(VkFaultType type) {
      |                                                               ^~~~~~~~~~~
/usr/include/vkroots.h:11287:63: error: ‘VkFaultType’ was not declared in this scope
/usr/include/vkroots.h:11287:80: error: expected ‘;’ before ‘{’ token
11287 |     template <> constexpr const char* enumString<VkFaultType>(VkFaultType type) {
      |                                                                                ^~
      |                                                                                ;
/usr/include/vkroots.h:12385:50: error: ‘VkPipelineCacheValidationVersion’ was not declared in this scope; did you mean ‘VkPipelineCacheHeaderVersion’?
12385 |     template <> constexpr const char* enumString<VkPipelineCacheValidationVersion>(VkPipelineCacheValidationVersion type) {
      |                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                  VkPipelineCacheHeaderVersion
/usr/include/vkroots.h:12385:84: error: template-id ‘enumString<<expression error> >’ used as a declarator
12385 |     template <> constexpr const char* enumString<VkPipelineCacheValidationVersion>(VkPipelineCacheValidationVersion type) {
      |                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:12385:84: error: ‘VkPipelineCacheValidationVersion’ was not declared in this scope; did you mean ‘VkPipelineCacheHeaderVersion’?
12385 |     template <> constexpr const char* enumString<VkPipelineCacheValidationVersion>(VkPipelineCacheValidationVersion type) {
      |                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                    VkPipelineCacheHeaderVersion
/usr/include/vkroots.h:12385:122: error: expected ‘;’ before ‘{’ token
12385 |     template <> constexpr const char* enumString<VkPipelineCacheValidationVersion>(VkPipelineCacheValidationVersion type) {
      |                                                                                                                          ^~
      |                                                                                                                          ;
/usr/include/vkroots.h:12476:50: error: ‘VkPipelineMatchControl’ was not declared in this scope
12476 |     template <> constexpr const char* enumString<VkPipelineMatchControl>(VkPipelineMatchControl type) {
      |                                                  ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:12476:74: error: template-id ‘enumString<<expression error> >’ used as a declarator
12476 |     template <> constexpr const char* enumString<VkPipelineMatchControl>(VkPipelineMatchControl type) {
      |                                                                          ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/vkroots.h:12476:74: error: ‘VkPipelineMatchControl’ was not declared in this scope
/usr/include/vkroots.h:12476:102: error: expected ‘;’ before ‘{’ token
12476 |     template <> constexpr const char* enumString<VkPipelineMatchControl>(VkPipelineMatchControl type) {
      |                                                                                                      ^~
      |                                                                                                      ;
/usr/include/vkroots.h: In instantiation of ‘VkResult vkroots::wrap_CreateSwapchainKHR(...) [with InstanceOverrides = GamescopeWSILayer::VkInstanceOverrides; PhysicalDeviceOverrides = NoOverrides; DeviceOverrides = GamescopeWSILayer::VkDeviceOverrides; VkResult = VkResult]’:
/usr/include/vkroots.h:8710:16:   required from ‘void (* vkroots::GetDeviceProcAddr(VkDevice, const char*))() [with InstanceOverrides = GamescopeWSILayer::VkInstanceOverrides; PhysicalDeviceOverrides = NoOverrides; DeviceOverrides = GamescopeWSILayer::VkDeviceOverrides; PFN_vkVoidFunction = void (*)(); VkDevice = VkDevice_T*]’
/usr/include/vkroots.h:14687:54:   required from ‘VkResult vkroots::NegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface*) [with InstanceOverrides = GamescopeWSILayer::VkInstanceOverrides; PhysicalDeviceOverrides = NoOverrides; DeviceOverrides = GamescopeWSILayer::VkDeviceOverrides; VkResult = VkResult; VkNegotiateLayerInterface = VkNegotiateLayerInterface]’
../gamescope-3.11.52-beta6/layer/VkLayer_FROG_gamescope_wsi.cpp:672:1:   required from here
/usr/include/vkroots.h:4527:55: error: no matching function for call to ‘GamescopeWSILayer::VkDeviceOverrides::CreateSwapchainKHR(const vkroots::VkDeviceDispatch*&, VkDevice_T*&, const VkSwapchainCreateInfoKHR*&, const VkSwapchainCreateInfoKHR*&, const VkAllocationCallbacks*&, VkSwapchainKHR_T**&)’
 4527 |     VkResult ret = DeviceOverrides::CreateSwapchainKHR(dispatch, device, pCreateInfo, pCreateInfo, pAllocator, pSwapchain);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../gamescope-3.11.52-beta6/layer/VkLayer_FROG_gamescope_wsi.cpp:501:21: note: candidate: ‘static VkResult GamescopeWSILayer::VkDeviceOverrides::CreateSwapchainKHR(const vkroots::VkDeviceDispatch*, VkDevice, const VkSwapchainCreateInfoKHR*, const VkAllocationCallbacks*, VkSwapchainKHR_T**)’
  501 |     static VkResult CreateSwapchainKHR(
      |                     ^~~~~~~~~~~~~~~~~~
../gamescope-3.11.52-beta6/layer/VkLayer_FROG_gamescope_wsi.cpp:501:21: note:   candidate expects 5 arguments, 6 provided
FireBurn commented 1 year ago

The issue might need fixing in vkroots but hopefully @Joshua-Ashton can confirm

FireBurn commented 1 year ago

I think it's related to https://github.com/KhronosGroup/Vulkan-Headers/commit/e8b8e06d092ab406b097907ecaae1a8aae9c7d53 which was worked around in another project with https://github.com/DadSchoorse/vkBasalt/pull/208

TheGreatMcPain commented 1 year ago

I think it's related to KhronosGroup/Vulkan-Headers@e8b8e06 which was worked around in another project with DadSchoorse/vkBasalt#208

I tried vulkan-headers-1.3.243 with that commit reverted and ended up with the same build error.

As a workaround I modified Gentoo's media-libs/vkroots ebuild so that it runs gen/make_vkroots against the vk.xml from vulkan-headers-1.3.239 instead of the system's vk.xml.

FireBurn commented 1 year ago

Thanks for that, I can't see the change in vkroots though, had it been committed yet?

FireBurn commented 1 year ago

Locally I emerged the older vulkan-headers, then vkroots, I was then able to compile gamescope just fine after that

FireBurn commented 1 year ago

Really the vulkan-headers bumps should cause vkroots to rebuild automatically, this probably would have been noticed sooner

chewi commented 1 year ago

Sorry, I was not made aware of this until today, so I haven't addressed this in the Gentoo package yet. It's late, and I'm not sure what the right thing to do is yet, so it'll need to wait a bit longer.

Really the vulkan-headers bumps should cause vkroots to rebuild automatically, this probably would have been noticed sooner

Unfortunately, that's not possible.

FireBurn commented 1 year ago

Pretty sure it is if you add := to the end of the dependency

ionenwks commented 1 year ago

Note that the rebuild is what breaks it, it works if building using e.g. 1.3.239's vk.xml -- then you can upgrade headers after and things will be fine.

ionenwks commented 1 year ago

...rather than always rebuild against latest headers, maybe bundling/pre-generating as needed + known working would make more sense. Essentially like Wine does with make_vulkan (pregen on releases).

chewi commented 1 year ago

Pretty sure it is if you add := to the end of the dependency

That only works when the dependency has subslots, which this one doesn't. You wouldn't normally apply subslots to a headers package. This is a special case, but I still don't want to do it, because it would cause unnecessary rebuilds in many other cases.

TheGreatMcPain commented 1 year ago

...rather than always rebuild against latest headers, maybe bundling/pre-generating as needed + known working would make more sense. Essentially like Wine does with make_vulkan (pregen on releases).

Out of curiosity I replaced /usr/include/vkroots.h with the one from the repository and gamescope compiled successfully.

Perhaps the Gentoo ebuild should just leave the header untouched, and only re-generate it if an IUSE, such as system-vulkan is enabled.

chewi commented 1 year ago

Yeah, just using the bundled vkroots.h was what I was planning to do. Regenerating it just seemed like a good idea when I packaged it. Should sort it later today.

chewi commented 1 year ago

I've now fixed the Gentoo package.