nvpro_core icon indicating copy to clipboard operation
nvpro_core copied to clipboard

FindVulkanSDK not finding glslangValidator/glslc on Linux

Open timo-oster opened this issue 1 year ago • 2 comments

I just tried to compile vk_mini_path_tracer on my Linux machine and ran into an issue with FindVulkanSDK. I specified the location of my VulkanSDK via the VULKAN_SDK environment variable, and it was able to find the vulkan headers, library, shaderc library, but not the glslc and glslangValidator executables. I believe this is due to an incorrect use of the find_file command in line 134/135:

    find_file(GLSLANGVALIDATOR VULKANSDK_ROOT_DIR "glslangValidator" HINTS ${VULKANSDK_ROOT_DIR}"../bin/glslangValidator")
    find_file(GLSLC VULKANSDK_ROOT_DIR "glslc" HINTS ${VULKANSDK_ROOT_DIR}"../bin/glslc")

this does not comply with the documentation of how the find_file command works (you are supposed to pass the target variable first and the file name to search for second), and it also seems to use the VULKANSDK_ROOT_DIR variable in an incorrect way. For me, it is set to the dir above the bin/, lib/, etc. and it does not have a slash at the end. Appending ../bin/glslc to that makes no sense in multiple ways. I managed to get it working by changing the two lines to this, although I'm not sure that we can rely on VULKANSDK_ROOT_DIR not ending with a slash in all situations:

    find_file(GLSLANGVALIDATOR "glslangValidator" HINTS "${VULKANSDK_ROOT_DIR}/bin")
    find_file(GLSLC "glslc" HINTS "${VULKANSDK_ROOT_DIR}/bin")

timo-oster avatar Jun 29 '23 11:06 timo-oster