KhronosGroup / Vulkan-Samples

One stop solution for all Vulkan samples
Apache License 2.0
4.3k stars 638 forks source link

Failed to compile because of ktx #625

Closed wumo closed 1 year ago

wumo commented 1 year ago

OS: Windows 10 Visual Studio 2019 CMake 3.24.2

Build log:

====================[ Build | vulkan_samples | Debug ]==========================
"C:\Program Files\JetBrains\CLion 2022.3\bin\cmake\win\x64\bin\cmake.exe" --build G:\Projects\Vulkan-Samples\cmake-build-debug --target vulkan_samples -j 12
[0/2] Re-checking globbed directories...
[1/413] Building C object third_party\CMakeFiles\ktx.dir\ktx\lib\vkloader.c.obj
FAILED: third_party/CMakeFiles/ktx.dir/ktx/lib/vkloader.c.obj 
C:\PROGRA~2\MICROS~2\2019\PROFES~1\VC\Tools\MSVC\1429~1.301\bin\Hostx86\x86\cl.exe  /nologo -DBASISD_SUPPORT_KTX2_ZSTD=0 -DBASISU_NO_ITERATOR_DEBUG_LEVEL -DKTX_API=__declspec(dllexport) -DKTX_FEATURE_WRITE=0 -DLIBKTX -DROOT_PATH_SIZE=27 -DVK_NO_PROTOTYPES -DVK_USE_PLATFORM_WIN32_KHR -IG:\Projects\Vulkan-Samples\third_party\ktx\include -IG:\Projects\Vulkan-Samples\third_party\ktx\lib -IG:\Projects\Vulkan-Samples\third_party\ktx\lib\basisu\zstd -IG:\Projects\Vulkan-Samples\third_party\ktx\lib\basisu\transcoder -IG:\Projects\Vulkan-Samples\third_party\ktx\other_include -IG:\Projects\Vulkan-Samples\third_party\vulkan\include /DWIN32 /D_WINDOWS -DDEBUG=0 /Zi /Ob0 /Od /RTC1 -MDd /showIncludes /Fothird_party\CMakeFiles\ktx.dir\ktx\lib\vkloader.c.obj /Fdthird_party\CMakeFiles\ktx.dir\ktx.pdb /FS -c G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vk_funcs.h(29): warning C4005: 'VK_NO_PROTOTYPES': macro redefinition
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c: note: see previous definition of 'VK_NO_PROTOTYPES'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(98): error C2373: 'ktxVulkanDeviceInfo_Create': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(126): note: see declaration of 'ktxVulkanDeviceInfo_Create'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(143): error C2373: 'ktxVulkanDeviceInfo_Construct': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(130): note: see declaration of 'ktxVulkanDeviceInfo_Construct'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(192): error C2373: 'ktxVulkanDeviceInfo_Destruct': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(135): note: see declaration of 'ktxVulkanDeviceInfo_Destruct'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(208): error C2373: 'ktxVulkanDeviceInfo_Destroy': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(137): note: see declaration of 'ktxVulkanDeviceInfo_Destroy'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(590): error C2373: 'ktxTexture_VkUploadEx': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(139): note: see declaration of 'ktxTexture_VkUploadEx'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(1134): error C2373: 'ktxTexture_VkUpload': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(145): note: see declaration of 'ktxTexture_VkUpload'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(1152): error C2373: 'ktxTexture1_VkUploadEx': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(148): note: see declaration of 'ktxTexture1_VkUploadEx'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(1174): error C2373: 'ktxTexture1_VkUpload': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(154): note: see declaration of 'ktxTexture1_VkUpload'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(1192): error C2373: 'ktxTexture2_VkUploadEx': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(157): note: see declaration of 'ktxTexture2_VkUploadEx'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(1214): error C2373: 'ktxTexture2_VkUpload': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(163): note: see declaration of 'ktxTexture2_VkUpload'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(1231): error C2373: 'ktxTexture1_GetVkFormat': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(170): note: see declaration of 'ktxTexture1_GetVkFormat'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(1250): error C2373: 'ktxTexture2_GetVkFormat': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(173): note: see declaration of 'ktxTexture2_GetVkFormat'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(1264): error C2373: 'ktxTexture_GetVkFormat': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(167): note: see declaration of 'ktxTexture_GetVkFormat'
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vkloader.c(1548): error C2373: 'ktxVulkanTexture_Destruct': redefinition; different type modifiers
G:\Projects\Vulkan-Samples\third_party\ktx\include\ktxvulkan.h(83): note: see declaration of 'ktxVulkanTexture_Destruct'
[2/413] Building C object third_party\CMakeFiles\volk.dir\volk\volk.c.obj
[3/413] Building CXX object third_party\CMakeFiles\imgui.dir\imgui\imgui_demo.cpp.obj
[4/413] Building CXX object third_party\CMakeFiles\imgui.dir\imgui\imgui_widgets.cpp.obj
[5/413] Building CXX object third_party\CMakeFiles\imgui.dir\imgui\imgui_draw.cpp.obj
[6/413] Building CXX object third_party\CMakeFiles\astc.dir\astc\Source\astc_integer_sequence.cpp.obj
[7/413] Building CXX object third_party\CMakeFiles\astc.dir\astc\Source\astc_weight_align.cpp.obj
[8/413] Building CXX object third_party\CMakeFiles\glslang-default-resource-limits.dir\glslang\StandAlone\ResourceLimits.cpp.obj
[9/413] Building C object third_party\CMakeFiles\ktx.dir\ktx\lib\vk_funcs.c.obj
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vk_funcs.h(29): warning C4005: 'VK_NO_PROTOTYPES': macro redefinition
G:\Projects\Vulkan-Samples\third_party\ktx\lib\vk_funcs.c: note: see previous definition of 'VK_NO_PROTOTYPES'
[10/413] Building CXX object third_party\CMakeFiles\imgui.dir\imgui\imgui.cpp.obj
[11/413] Building CXX object third_party\CMakeFiles\astc.dir\astc\Source\astc_pick_best_endpoint_format.cpp.obj
[12/413] Building CXX object third_party\CMakeFiles\astc.dir\astc\Source\astc_color_quantize.cpp.obj
ninja: build stopped: subcommand failed.

CMake outputs:

"C:\Program Files\JetBrains\CLion 2022.3\bin\cmake\win\x64\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=C:/Program Files/JetBrains/CLion 2022.3/bin/ninja/win/x64/ninja.exe" -G Ninja -S G:\Projects\Vulkan-Samples -B G:\Projects\Vulkan-Samples\cmake-build-debug
-- The C compiler identification is MSVC 19.29.30147.0
-- The CXX compiler identification is MSVC 19.29.30147.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at bldsys/cmake/global_options.cmake:72:
  Syntax Warning in cmake code at column 41

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMakeLists.txt:31 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Program Files/JetBrains/CLion 2022.3/bin/cmake/win/x64/share/cmake-3.24/Modules/CMakeDependentOption.cmake:75 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'ENABLE_HLSL'.
Call Stack (most recent call first):
  third_party/glslang/CMakeLists.txt:101 (CMAKE_DEPENDENT_OPTION)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in third_party/glslang/CMakeLists.txt:
  A logical block opening on the line

    G:/Projects/Vulkan-Samples/third_party/glslang/CMakeLists.txt:142 (if)

  closes on the line

    G:/Projects/Vulkan-Samples/third_party/glslang/CMakeLists.txt:144 (endif)

  with mis-matching arguments.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- spirv-tools not linked - illegal SPIRV may be generated for HLSL
-- SPIRV-Cross: Finding Git version for SPIRV-Cross.
-- Found Git: C:/Users/wumo/scoop/shims/git.exe (found version "2.38.1.windows.1") 
-- SPIRV-Cross: Git hash: a89dea3c
-- Found PythonInterp: C:/Users/wumo/scoop/apps/python/current/python.exe (found version "3.11") 
SPIRV-Cross:  Testing will be disabled for SPIRV-Cross. Could not find glslang or SPIRV-Tools build under external/. To enable testing, run ./checkout_glslang_spirv_tools.sh and ./build_glslang_spirv_tools.sh first.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE  
-- Using Win32 for window creation
-- Build type: Debug
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
CMake Warning (dev) at C:/Program Files/JetBrains/CLion 2022.3/bin/cmake/win/x64/share/cmake-3.24/Modules/CMakeDependentOption.cmake:89 (message):
  Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
  Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
  third_party/cli11/CMakeLists.txt:66 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Program Files/JetBrains/CLion 2022.3/bin/cmake/win/x64/share/cmake-3.24/Modules/CMakeDependentOption.cmake:89 (message):
  Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
  Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
  third_party/cli11/CMakeLists.txt:70 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Program Files/JetBrains/CLion 2022.3/bin/cmake/win/x64/share/cmake-3.24/Modules/CMakeDependentOption.cmake:89 (message):
  Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
  Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
  third_party/cli11/CMakeLists.txt:82 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Program Files/JetBrains/CLion 2022.3/bin/cmake/win/x64/share/cmake-3.24/Modules/CMakeDependentOption.cmake:89 (message):
  Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
  Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
  third_party/cli11/CMakeLists.txt:94 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Program Files/JetBrains/CLion 2022.3/bin/cmake/win/x64/share/cmake-3.24/Modules/CMakeDependentOption.cmake:89 (message):
  Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
  Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
  third_party/cli11/CMakeLists.txt:102 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Doxygen not found, building docs has been disabled
-- Windows platform detected
-- Warnings as Errors Enabled
-- Sample `compute_nbody` - BUILD
-- Sample `dynamic_uniform_buffers` - BUILD
-- Sample `hdr` - BUILD
-- Sample `hello_triangle` - BUILD
-- Sample `hlsl_shaders` - BUILD
-- Sample `hpp_compute_nbody` - BUILD
-- Sample `hpp_dynamic_uniform_buffers` - BUILD
-- Sample `hpp_hdr` - BUILD
-- Sample `hpp_hello_triangle` - BUILD
-- Sample `hpp_hlsl_shaders` - BUILD
-- Sample `hpp_instancing` - BUILD
-- Sample `hpp_separate_image_sampler` - BUILD
-- Sample `hpp_terrain_tessellation` - BUILD
-- Sample `hpp_texture_loading` - BUILD
-- Sample `hpp_texture_mipmap_generation` - BUILD
-- Sample `hpp_timestamp_queries` - BUILD
-- Sample `instancing` - BUILD
-- Sample `separate_image_sampler` - BUILD
-- Sample `terrain_tessellation` - BUILD
-- Sample `texture_loading` - BUILD
-- Sample `texture_mipmap_generation` - BUILD
-- Sample `timestamp_queries` - BUILD
-- Sample `buffer_device_address` - BUILD
-- Sample `conditional_rendering` - BUILD
-- Sample `conservative_rasterization` - BUILD
-- Sample `debug_utils` - BUILD
-- Sample `descriptor_indexing` - BUILD
-- Sample `dynamic_rendering` - BUILD
-- Sample `fragment_shading_rate` - BUILD
-- Sample `fragment_shading_rate_dynamic` - BUILD
-- Sample `graphics_pipeline_library` - BUILD
-- Sample `memory_budget` - BUILD
-- Sample `open_gl_interop` - BUILD
-- Sample `portability` - BUILD
-- Sample `push_descriptors` - BUILD
-- Sample `ray_queries` - BUILD
-- Sample `ray_tracing_reflection` - BUILD
-- Sample `raytracing_basic` - BUILD
-- Sample `raytracing_extended` - BUILD
-- Sample `synchronization_2` - BUILD
-- Sample `vertex_dynamic_state` - BUILD
-- Sample `16bit_arithmetic` - BUILD
-- Sample `16bit_storage_input_output` - BUILD
-- Sample `afbc` - BUILD
-- Sample `async_compute` - BUILD
-- Sample `command_buffer_usage` - BUILD
-- Sample `constant_data` - BUILD
-- Sample `descriptor_management` - BUILD
-- Sample `hpp_pipeline_cache` - BUILD
-- Sample `hpp_swapchain_images` - BUILD
-- Sample `layout_transitions` - BUILD
-- Sample `msaa` - BUILD
-- Sample `multi_draw_indirect` - BUILD
-- Sample `multithreading_render_passes` - BUILD
-- Sample `pipeline_barriers` - BUILD
-- Sample `pipeline_cache` - BUILD
-- Sample `render_passes` - BUILD
-- Sample `specialization_constants` - BUILD
-- Sample `subpasses` - BUILD
-- Sample `surface_rotation` - BUILD
-- Sample `swapchain_images` - BUILD
-- Sample `texture_compression_basisu` - BUILD
-- Sample `texture_compression_comparison` - BUILD
-- Sample `wait_idle` - BUILD
-- Sample `profiles` - BUILD
-- Plugin `batch_mode` - BUILD
-- Plugin `benchmark_mode` - BUILD
-- Plugin `data_path` - BUILD
-- Plugin `file_logger` - BUILD
-- Plugin `force_close` - BUILD
-- Plugin `fps_logger` - BUILD
-- Plugin `screenshot` - BUILD
-- Plugin `start_sample` - BUILD
-- Plugin `stop_after` - BUILD
-- Plugin `window_options` - BUILD
-- Configuring done
-- Generating done
-- Build files have been written to: G:/Projects/Vulkan-Samples/cmake-build-debug

[Finished]
gpx1000 commented 1 year ago

I also use CLion, it looks like you do have it setup correctly. The redefinition errors are strange to me based around the logs you have posted. Could you do me a favor; let's get you to dump your environment variables if possible so we can ensure those are setup correctly. Let's also verify that you can get it to build with the command line directly. (make a new build folder, and configure/build via the command line the way that is outlined in the documentation). Once we validate that it's building; that'll help me figure out if there's a missing configuration in CLion, I'll happily help you get CLion working as well.

wumo commented 1 year ago

@gpx1000 I managed to compile by generating Visual Studio 2019 solution.

gpx1000 commented 1 year ago

Sounds good, is this issue safe to close then or does the issue presist?

wumo commented 1 year ago

@gpx1000 Yes, this issue can be closed.