Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix locating moltenvk headers when with_vulkan=True #24903

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

jcar87
Copy link
Contributor

@jcar87 jcar87 commented Aug 12, 2024

Summary

Changes to recipe: qt/6

  • Fix issue on macOS where building qt fails when with_vulkan=True because it does not find the moltenvk headers
  • Record direct dependency on vulkan-headers (these are searched directly by Qt, see here)
  • Record transitive_headers for the vulkan-headers when with_vulkan=True, these are used here: https://github.com/qt/qtbase/blob/v6.7.1/src/gui/vulkan/qvulkaninstance.h#L19-L21 - if these are not found, including <QVulkanWindow> does not properly include the vulkan headers, leading to include errors
  • Fix version conflict when with_vulkan=True - moltenvk and vulkan have strict version requirements and need to be paired with the right versions

Motivation

  • Fix version conflict
  • Fix compiler error:
In file included from /xxx/.conan2/p/qt0cc42066e0980/s/src/qtbase/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm:41:
In file included from /xxx/.conan2/p/qt0cc42066e0980/s/src/qtbase/src/plugins/platforms/cocoa/qcocoaintegration.h:8:
/xxx.conan2/p/qt0cc42066e0980/s/src/qtbase/src/plugins/platforms/cocoa/qcocoawindow.h:19:10: fatal error: 'MoltenVK/mvk_vulkan.h' file not found
#include <MoltenVK/mvk_vulkan.h>
         ^~~~~~~~~~~~~~~~~~~~~~~

Details

  • patch the qt cmake file that handles vulkan headers, to propagate the include path of moltenvk as well

Close #24045
Close #23684

@jcar87
Copy link
Contributor Author

jcar87 commented Aug 12, 2024

Tested on macOS and we now get a successful build, but have not tested this on the consumer side yet - so this may not be fully sufficient

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

Hooks produced the following warnings for commit ab01b40
qt/6.6.3@#3c2178c6dfa3439498b875d1f10e9f60
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\plugins\tls\qschannelbackendd.dll' links to system library 'ncrypt' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\plugins\tls\qschannelbackend.dll' links to system library 'ncrypt' but it is not in cpp_info.system_libs.
qt/6.7.1@#ae061de2ced904397cca2749490a72dd
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\plugins\tls\qschannelbackendd.dll' links to system library 'ncrypt' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\plugins\tls\qschannelbackend.dll' links to system library 'ncrypt' but it is not in cpp_info.system_libs.
qt/6.5.3@#5f01152ab65c7ef6d0d8ab257e9f1e79
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library './plugins/platforms/libqcocoa.dylib' links to system library 'ColorSync' but it is not in cpp_info.frameworks.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library './plugins/platforms/libqcocoa_debug.dylib' links to system library 'ColorSync' but it is not in cpp_info.frameworks.

@jcar87
Copy link
Contributor Author

jcar87 commented Aug 12, 2024

Tested on macOS and we now get a successful build, but have not tested this on the consumer side yet - so this may not be fully sufficient

have managed to test this against the sample vulkan project here: https://github.com/qt/qtbase/tree/v6.7.1/examples/vulkan/hellovulkancubes

Screenshot 2024-08-12 at 14 24 28

so far have only managed to make it work with the shared variant, built with the following options:

-o "qt/*:with_vulkan=True" -o "*:shared=True" -o "spirv-tools/*:shared=False" "-o spirv-cross/*:shared=False" 

otherwise the application might build but not run correctly (for the static version, even if I link the plugins statically, it fails to initialise vulkan, that would require further investigation).

@jcar87
Copy link
Contributor Author

jcar87 commented Aug 12, 2024

@nebrain - apologies it took so long to fix this - if you have the chance to test these fixes, please let us know!

@@ -304,9 +304,6 @@ def validate(self):
if Version(self.version) >= "6.6.1" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "13.1":
raise ConanInvalidConfiguration("apple-clang >= 13.1 is required by qt >= 6.6.1 cf QTBUG-119490")

if self.settings.os == "Macos" and self.dependencies["double-conversion"].options.shared:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This restriction is artificial and not related to Qt itself, but rather Conan or Conan Center - lifting it. Have managed to reproduce the original problems, if issues are reported will propose a more robust fix (otherwise, this is not currently causing issues on CI).

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 2 (50eef9f4276fbbb8a642916dad7893b50d44cf50):

  • qt/6.5.3:
    All packages built successfully! (All logs)

  • qt/6.7.1:
    All packages built successfully! (All logs)

  • qt/6.6.3:
    All packages built successfully! (All logs)


Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 2 (50eef9f4276fbbb8a642916dad7893b50d44cf50):

  • qt/6.6.3:
    All packages built successfully! (All logs)

  • qt/6.7.1:
    All packages built successfully! (All logs)

  • qt/6.5.3:
    All packages built successfully! (All logs)

Copy link
Contributor

Hooks produced the following warnings for commit 50eef9f
qt/6.5.3@#cbf48815bf7347e5d1b7e3fb1730251f
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library './plugins/platforms/libqcocoa.dylib' links to system library 'ColorSync' but it is not in cpp_info.frameworks.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library './plugins/platforms/libqcocoa_debug.dylib' links to system library 'ColorSync' but it is not in cpp_info.frameworks.
qt/6.7.1@#44d104c8767294a0f80623d38ba5909a
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\plugins\tls\qschannelbackendd.dll' links to system library 'ncrypt' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\plugins\tls\qschannelbackend.dll' links to system library 'ncrypt' but it is not in cpp_info.system_libs.
qt/6.6.3@#e036f48b7636827645dfd943b4e3b5dc
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\plugins\tls\qschannelbackend.dll' links to system library 'ncrypt' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\plugins\tls\qschannelbackendd.dll' links to system library 'ncrypt' but it is not in cpp_info.system_libs.

Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@neobrain
Copy link
Contributor

@nebrain - apologies it took so long to fix this - if you have the chance to test these fixes, please let us know!

Thanks for working on this! Indeed Qt builds fine without any workarounds for me now.

Sadly I haven't been able to get my actual application running though, similarly to the example you tried. It's failing to pick up the VkInstance extensions required to use MoltenVK. I haven't been able to look more deeply into it yet however. With my custom Qt recipe I previously got it working while also pointing VK_ICD_FILENAMES=<path to MoltenVK_icd.json> and QT_VULKAN_LIB=<path to libMoltenVK.dylib>, but this doesn't seem to work for this PR.

@conan-center-bot conan-center-bot merged commit a650bac into conan-io:master Aug 13, 2024
19 of 20 checks passed
@jcar87 jcar87 deleted the lcc/bugfix/qt-macos-vulkan branch August 13, 2024 07:55
@jcar87
Copy link
Contributor Author

jcar87 commented Aug 13, 2024

@nebrain - apologies it took so long to fix this - if you have the chance to test these fixes, please let us know!

Thanks for working on this! Indeed Qt builds fine without any workarounds for me now.

Sadly I haven't been able to get my actual application running though, similarly to the example you tried. It's failing to pick up the VkInstance extensions required to use MoltenVK. I haven't been able to look more deeply into it yet however. With my custom Qt recipe I previously got it working while also pointing VK_ICD_FILENAMES=<path to MoltenVK_icd.json> and QT_VULKAN_LIB=<path to libMoltenVK.dylib>, but this doesn't seem to work for this PR.

Thanks for trying this out @neobrain!
If there is a reproducible example to report, we can look into this.

The example from https://github.com/qt/qtbase/tree/v6.7.1/examples/vulkan/hellovulkancubes does seem to work without modifications to either the example or the recipe, but only when Qt is shared.

Are you using shared Qt or static builds? Any info would help, and we can open an issue to track this, thanks!

@neobrain
Copy link
Contributor

neobrain commented Sep 10, 2024

Are you using shared Qt or static builds? Any info would help, and we can open an issue to track this, thanks!

Good news: I finally got around to clean up my application code and look into this again, and it seems that everything is working fine now!

For reference, my setup is the following:

  • Shared Qt with Vulkan (i.e. MoltenVK) enabled
  • -DVULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 used globally
  • -DVK_USE_PLATFORM_MACOS_MVK=1 used globally

To run the application, conanrun.sh must still be sourced (but I don't need to override VK_ICD_FILENAMES and QT_VULKAN_LIB like before).

@jcar87
Copy link
Contributor Author

jcar87 commented Sep 11, 2024

Hi @neobrain !! Happy to hear it is working now, thanks for taking the time to test this out and report back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants