Search code examples
c++vulkanfile-not-found

compiler can't find vulkan's H264 codec header file


I get 'vulkan/vulkan.h' file not found due to a different error on vulkan_core.h: vk_video/vulkan_video_codec_h264std.h' file not found after running a script using vulkan.h header file. The thing is that I have manually checked that the header file exists and that there's no typo

I have downloaded and set up latest vulkan sdk as recommended in the official documentation, following every step for my system (Fedora Linux). placing source of setup-env.sh in .bashrc, checked that every environment variable needed had a value (except VK_LAYER_PATH which i read that its not needed). And runned vkvia on the terminal successfully without any errors.

I check that everything works fine by running a test script which includes vulkan/vulkan.h header file. But basically, I get an error: 'vk_video/vulkan_video_codec_h264std.h' file not found
on vulkan-core.h l-8374 (#include "vk_video/vulkan_video_codec_h264std.h")

As I previously said, I manually checked that both vulkan/vulkan.h and vk_video/vulkan_video_codec_h264std.h exists.

x86_64/include/vk_video directory:

vulkan/vulkansdk-linux-x86_64-1.3.268.0/1.3.268.0/x86_64/include/vk_video/
├── vulkan_video_codec_h264std_decode.h
├── vulkan_video_codec_h264std_encode.h
├── vulkan_video_codec_h264std.h
├── vulkan_video_codec_h265std_decode.h
├── vulkan_video_codec_h265std_encode.h
├── vulkan_video_codec_h265std.h
└── vulkan_video_codecs_common.h


Well, since it seems like I have to, and even though I dont know how you could reproduce the error on another system, I don't even know if it's vulkan's fault or mine, here's some additional info that you may want to know:
smallest script where the error happens (any with vulkan header file)

#include <vulkan/vulkan.h>

int main() {
    return 0;
}

every error message I've gotten because of this

  • By the compiler on the script above:
fatal error: 'vulkan/vulkan.h' file not found
    2 | #include <vulkan/vulkan.h>
      |          ^~~~~~~~~~~~~~~~~
1 error generated.
  • By the compiler on vulkan_core.h
clang++: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
/home/owos/vulkan/vulkansdk-linux-x86_64-1.3.268.0/1.3.268.0/x86_64/include/vulkan/vulkan_core.h:8374:10: fatal error: 'vk_video/vulkan_video_codec_h264std.h' file not found
 8374 | #include "vk_video/vulkan_video_codec_h264std.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

additional information

  • Compiler: Clang
$ clang++ -v
clang version 17.0.4 (Fedora 17.0.4-1.fc39)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/13
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/13
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
  • Compiler Flags: -Wall -Wextra -g3 -std=c++20 (tried with gcc as well, same c++ version, same error)
  • OS: Fedora Linux 39 (GNOME)
  • Vulkan version installed: 1.3.268.0
    If you need vulkaninfo content,email me: [email protected] and I'll give it to you, since its too long to fit in a post

Solution

  • I have met the same issue when compiling a project and solved it. Not sure whether we have the same cause of the problem, I will share my solution anyway:

    • Analysis: Following the error message, the parent folder of vulkan_core.h , the vulkan, is found to be in /usr/local/include, where no folder called vk_video can be loaded. This is caused by an incomplete cp provided by the official guidance: screenshot from vulkanSDK installation guide

    • Solution: Therefore, you might need to cp the vk_video folder togerther with the vulkan folder under your installation file 1.3.268.0/x86_64/include by this:

      cd <your-folder>/1.3.268.0/x86_64/include

      sudo cp -r vk_video/ /usr/local/include/

      Then try to compile it again.

    Hope it will help you and good luck with your program! (This is literally my first answer via this platform, please feel free to correct me if improperly behaved.)