How to configure for Vulkan?



  • Hello,

    I want to use 5.10 with Vulkan support. I couldn't find any information is it available in prebuilt version for the Linux, but since the provided example doesn't work out of the box I assume I need to build qt myself. When I call configure I get:

    Qt Gui:
      Vulkan ................................. no
    

    Though I have VULKAN_SDK defined and PATH contains the path to the SDK as well.

    Here it tells about Windows and Android but no any word about Linux.

    I tried to enable the feature while configuring with ../configure -feature-vulkan (though very confusing - ../configure -list-features doesn't lists vulkan feature at all) and got the output:

    ERROR: Feature 'vulkan' was enabled, but the pre-condition 'libs.vulkan' failed. Check config.log for details.
    

    The file config.log unfortunately is not very informative:

    Command line: -feature-vulkan
    

  • Lifetime Qt Champion

    Hi,

    You should add the -v option to configure. It should give you more information about what is going on regarding Vulkan.



  • @SGaist
    You're right, it helped a little. Now I have the output:

    Checking for Vulkan... 
    Trying source 0 (type pkgConfig) of library vulkan ...
    + /usr/bin/pkg-config --exists --silence-errors vulkan
    pkg-config did not find package.
      => source produced no result.
    Trying source 1 (type makeSpec) of library vulkan ...
    + cd /home/nc/Qt/5.10.1/Src/qt5.10.1/config.tests/qpa/vulkan && /home/nc/Qt/5.10.1/Src/qt5.10.1/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared use_gold_linker warn_off console single_arch" /home/nc/Qt/5.10.1/Src/qtbase/config.tests/qpa/vulkan
    + cd /home/nc/Qt/5.10.1/Src/qt5.10.1/config.tests/qpa/vulkan && MAKEFLAGS= /usr/bin/make
    > g++ -c -pipe -O2 -std=gnu++11 -w -fPIC  -I/home/nc/Qt/5.10.1/Src/qtbase/config.tests/qpa/vulkan -I. -I/home/nc/Qt/5.10.1/Src/qtbase/mkspecs/linux-g++ -o vulkan.o /home/nc/Qt/5.10.1/Src/qtbase/config.tests/qpa/vulkan/vulkan.cpp
    > /home/nc/Qt/5.10.1/Src/qtbase/config.tests/qpa/vulkan/vulkan.cpp:42:27: fatal error: vulkan/vulkan.h: No such file or directory
    > compilation terminated.
    > Makefile:170: recipe for target 'vulkan.o' failed
    > make: *** [vulkan.o] Error 1
     => source failed verification.
    test config.gui.libraries.vulkan FAILED
    

    First thing to notice - the configurator tries to search for the package, but I didn't install Vulkan via package, I just downloaded SDK and ran it manually. Next I see that path to Vulkan headers is undefined. I added it to the PATH but without luck. How else can I provide -I gcc flag to generate correct makefile?


  • Lifetime Qt Champion

    PATH is for application discovery, it has nothing to do with header files.

    You can use the -I option of configure to add additional search paths. Beware that contrary to the compiler option, you need to leave a space between the option and the path you want to give. You'll likely also need to use the -L option in order to find the Vulkan libraries.



  • @SGaist thank you, you're right and I need to read help more carefully.

    So I successfully configured and output gives me:

    Qt Gui:
      Vulkan ................................. yes
    

    I build the library with make, next installed it with make install but still can't make it work. This time it tells me

    /usr/local/Qt-5.10.1/include/QtGui/QVulkanFunctions:1: error: qvulkanfunctions.h: No such file or directory
    

    Indeed this file is not there. But why? For example, qvulkanwindow.h was installed, and QVulkanFunctions too. But what's wrong with qvulkanfunctions.h?

    Upd: I manually copied this header to installation folder and finally was able to compile the example. Looks like somebody forgot to add this header to installation file list.


  • Lifetime Qt Champion

    Did you re-run configure from a clean state ?

    What I recommend is to use out of source builds so if you need to start over you just nuke the folder you use and start from fresh. That way you keep the sources clean.



  • Yes, did it twice. Looks like an error in generated make file. Anyway, everything working now, thank you.



  • Hi, I have same problem, I don't know how to enable vulkan in QT GUI.

    When run configurate said:

    Qt Gui:
       Vulkan ................................. no
    

    Also, when I run the test (/usr/local/Qt/5.10.1/Src/config.tests/qpa/vulkan) compiling good, but throw core exception the ./vulkan generate.

    I have install Vulkan sdk in /usr/local/VulkanSDK/1.0.68.0/x86_64 and enviroment:

    VULKAN_SDK=/usr/local/VulkanSDK/1.0.68.0/x86_64
    VK_LAYER_PATH=/usr/local/VulkanSDK/1.0.68.0/x86_64/etc/explicit_layer.d
    PATH=/usr/local/VulkanSDK/1.0.68.0/x86_64/bin:/home/jose/bin:/home/jose/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/VulkanSDK/1.0.68.0/x86_64:/snap/bin
    
    

    And when I open the Samples in QT (/usr/local/Qt/Examples/Qt-5.10.1/vulkan/hellovulkanwindow) build error in:

    /usr/local/Qt/Examples/Qt-5.10.1/vulkan/hellovulkanwindow/hellovulkanwindow.cpp:51: In file included from ../../vulkan/hellovulkanwindow/hellovulkanwindow.cpp:51:0:
    
    Line  51 is: #include "hellovulkanwindow.h" 
    

    Thank.



  • You need to tell configure where the sdk is. Please read the comment from SGaist.



  • @nikitablack How? I don't use QT before.



  • You need to run configure and pass arguments, for example:

    configure -I $VULKAN_SDK/include -L $VULKAN_SDK/lib -v -feature-vulkan
    


  • The bash said:

    ERROR: Feature 'vulkan' was enabled, but the pre-condition 'libs.vulkan' failed.

    And $VULKAN_SDK is correct folder.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.