PacktPublishing / Mastering-Graphics-Programming-with-Vulkan

MIT License
562 stars 76 forks source link

Include error <spirv_cross/spirv.h> on Linux #7

Closed mslinklater closed 1 year ago

mslinklater commented 1 year ago

The chapter 1 target builds fine... chapter 2 fails with:

[build] /home/link/Code/Mastering-Graphics-Programming-with-Vulkan/source/chapter2/./graphics/spirv_parser.hpp:9:10: fatal error: spirv_cross/spirv.h: No such file or directory [build] 9 | #include <spirv_cross/spirv.h> [build] | ^~~~~ [build] compilation terminated.

File is present in the LunarG SDK but the current build scripts don't add it in the include paths.

theWatchmen commented 1 year ago

Thanks, the change might have been lost when porting changes from our internal repo. We'll get it sorted.

theWatchmen commented 1 year ago

I had another look on my Linux system and chapter 2 compiles fine. The CMake file already adds the Vulkan include folder: https://github.com/PacktPublishing/Mastering-Graphics-Programming-with-Vulkan/blob/main/source/chapter2/CMakeLists.txt#L45. You could try and add message(FATAL_ERROR ${Vulkan_INCLUDE_DIRS}) in the CMake file to make sure the right include folder is being selected.

mslinklater commented 1 year ago

This seems to be some clash between the default apt repo version of the VulkanSDK and the LunarG SDK I manually downloaded. I can find the header fine inside the LunarG folder (spirv_cross/spirv.h) but its in a different path (usr/include/spirv/1.2/spirv.h) in my default system include folder.

Ideally I would only have one Vulkan SDK installed but I don't want to remove the apt repo one as I have other Vulkan projects that work fine and they might break.... anyway... now I know what the issue is I can easily work around it 8).

I'll close this issue as it's not the fault of your code... it's my local setup which is a bit borken. Thanks for your help !