nvpro-samples / vk_raytracing_tutorial_KHR

Ray tracing examples and tutorials using VK_KHR_ray_tracing
Apache License 2.0
1.31k stars 138 forks source link

Could NOT find VulkanSDK (missing: VULKAN_LIB VULKANSDK_SHADERC_LIB) #63

Open SoarCode opened 1 year ago

SoarCode commented 1 year ago

Hi guys,

I am trying to get started with the raytracing tutorial. I cloned the repos and try to run cmake .. inside of the build dir. I get the following error:

C:\Users\olive\source\repos\vk_raytracing_tutorial_KHR\build>cmake ..
-- BASE_DIRECTORY = /cygdrive/c/Users/olive/source/repos
-- CMAKE_CURRENT_SOURCE_DIR = /cygdrive/c/Users/olive/source/repos/vk_raytracing_tutorial_KHR
-- Vulkan Library        : VULKAN_LIB-NOTFOUND
-- Vulkan ShaderC Library: VULKANSDK_SHADERC_LIB-NOTFOUND
-- VULKANSDK_ROOT_DIR = C:/VulkanSDK/1.3.250.0
CMake Error at /usr/share/cmake-3.23.2/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find VulkanSDK (missing: VULKAN_LIB VULKANSDK_SHADERC_LIB)
Call Stack (most recent call first):
  /usr/share/cmake-3.23.2/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /cygdrive/c/Users/olive/source/repos/nvpro_core/cmake/find/FindVulkanSDK.cmake:175 (find_package_handle_standard_args)
  /cygdrive/c/Users/olive/source/repos/nvpro_core/cmake/setup.cmake:375 (find_package)
  CMakeLists.txt:34 (_add_package_VulkanSDK)

-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/Users/olive/source/repos/vk_raytracing_tutorial_KHR/build/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/Users/olive/source/repos/vk_raytracing_tutorial_KHR/build/CMakeFiles/CMakeError.log".

Content of the Error Log:

Detecting C compiler ABI info failed to compile with the following output:
Change Dir: /cygdrive/c/Users/olive/source/repos/vk_raytracing_tutorial_KHR/build/CMakeFiles/CMakeTmp

Run Build Command(s):/cygdrive/c/ProgramData/chocolatey/bin/make.exe -f Makefile cmTC_be15f/fast && C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe  -f CMakeFiles/cmTC_be15f.dir/build.make CMakeFiles/cmTC_be15f.dir/build
make[1]: Entering directory 'C:/Users/olive/source/repos/vk_raytracing_tutorial_KHR/build/CMakeFiles/CMakeTmp'
make[1]: *** No rule to make target '/usr/share/cmake-3.23.2/Modules/CMakeCCompilerABI.c', needed by 'CMakeFiles/cmTC_be15f.dir/CMakeCCompilerABI.c.o'.  Stop.
make[1]: Leaving directory 'C:/Users/olive/source/repos/vk_raytracing_tutorial_KHR/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_be15f/fast] Error 2

Detecting CXX compiler ABI info failed to compile with the following output:
Change Dir: /cygdrive/c/Users/olive/source/repos/vk_raytracing_tutorial_KHR/build/CMakeFiles/CMakeTmp

Run Build Command(s):/cygdrive/c/ProgramData/chocolatey/bin/make.exe -f Makefile cmTC_df34b/fast && C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe  -f CMakeFiles/cmTC_df34b.dir/build.make CMakeFiles/cmTC_df34b.dir/build
make[1]: Entering directory 'C:/Users/olive/source/repos/vk_raytracing_tutorial_KHR/build/CMakeFiles/CMakeTmp'
make[1]: *** No rule to make target '/usr/share/cmake-3.23.2/Modules/CMakeCXXCompilerABI.cpp', needed by 'CMakeFiles/cmTC_df34b.dir/CMakeCXXCompilerABI.cpp.o'.  Stop.
make[1]: Leaving directory 'C:/Users/olive/source/repos/vk_raytracing_tutorial_KHR/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_df34b/fast] Error 2

I installed the latest VulkanSDK and also got it running with some simple triangle demo code.

Kind regards, Oliver

ipener commented 1 year ago

I'm having the same issue when building vk_raytracing_tutorial_KHR on the NVIDIA® Jetson Orin™ Nano Developer Kit. Vulkan 1.3 is supported on Jetson Linux 35.1 and the loader is already pre-installed at /usr/lib/aarch64-linux-gnu/tegra/libvulkan.so.1.3.204. I've also downloaded the Vulkan-Headers and moved them to /usr/include/. Khronos Group's Vulkan-Samples project automatically links against the pre-installed loader and runs fine without having to install the latest Vulkan® SDK. Here's the error I get:

-- BASE_DIRECTORY = /home/nvidia
-- CMAKE_CURRENT_SOURCE_DIR = /home/nvidia/vk_raytracing_tutorial_KHR
-- Vulkan Library        : VULKAN_LIB-NOTFOUND
-- Vulkan ShaderC Library: VULKANSDK_SHADERC_LIB-NOTFOUND
-- VULKANSDK_ROOT_DIR = /usr
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find VulkanSDK (missing: VULKAN_LIB VULKANSDK_SHADERC_LIB
  GLSLANGVALIDATOR)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  /home/nvidia/nvpro_core/cmake/find/FindVulkanSDK.cmake:175 (find_package_handle_standard_args)
  /home/nvidia/nvpro_core/cmake/setup.cmake:375 (find_package)
  CMakeLists.txt:34 (_add_package_VulkanSDK)

-- Configuring incomplete, errors occurred!
See also "/home/nvidia/vk_raytracing_tutorial_KHR/build/CMakeFiles/CMakeOutput.log".

Surprisingly, CMakeError.log isn't generated. As these are official sample projects, it would be great if the CMake scripts fully supported Jetson Linux.

ipener commented 11 months ago

Manually installing Vulkan-Headers and glslang and patching cmake/find/FindVulkanSDK.cmake fixes the issue.

diff --git a/cmake/find/FindVulkanSDK.cmake b/cmake/find/FindVulkanSDK.cmake
index b0fe473..b4e6040 100644
--- a/cmake/find/FindVulkanSDK.cmake
+++ b/cmake/find/FindVulkanSDK.cmake
@@ -128,7 +128,7 @@ if (VULKANSDK_ROOT_DIR)

   if (UNIX)
     unset(VULKAN_LIB)
-    find_library(VULKAN_LIB NAMES vulkan HINTS "$ENV{VULKAN_SDK}/lib")
+    find_library(VULKAN_LIB NAMES libvulkan.so.1.3.204 HINTS "$ENV{VULKAN_SDK}/lib")
     get_filename_component(VULKAN_LIB_DIR ${VULKAN_LIB} DIRECTORY)
     find_library(VULKANSDK_SHADERC_LIB "libshaderc_combined.a" HINTS ${VULKAN_LIB_DIR})
     find_file(GLSLANGVALIDATOR VULKANSDK_ROOT_DIR "glslangValidator" HINTS ${VULKANSDK_ROOT_DIR}"../bin/glslangValidator")
@@ -175,7 +175,6 @@ SET(VULKANSDK_SHADERC_LIB ${VULKANSDK_SHADERC_LIB}          CACHE PATH "Path to
 find_package_handle_standard_args(VulkanSDK DEFAULT_MSG
     VULKANSDK_INCLUDE_DIR
     VULKAN_LIB
-    VULKANSDK_SHADERC_LIB
     GLSLANGVALIDATOR
 )

Here's a detailed walkthrough.

NBickford-NV commented 11 months ago

Hi all! We wound up replacing our FindVulkanSDK.cmake script with CMake's built-in find_package(Vulkan) module in https://github.com/nvpro-samples/nvpro_core/commit/9cf7b4814bd2046d0048c5ed56176ae51c3f5cb5 . Could you delete your CMake cache and try running it again, and let me know if it fixes this issue for you? Thank you!