nvpro_core icon indicating copy to clipboard operation
nvpro_core copied to clipboard

Error when compiling with clang on windows.

Open ThomasConrad opened this issue 2 years ago • 2 comments

When trying to compile a simple project using nvpro_core with clang on windows i run into the error below. Commenting out the relevant section in resources.rs (ln 59-63) has fixed it, and it doesn't seem like it immediately affects anything. Is this perhaps something that should be handled?

[build] llvm-rc: Error in ACCELERATORS statement (ID 109): 
[build] Accelerator ID 104: Can only apply ALT, SHIFT or CONTROL to VIRTKEY accelerators
[build] make[3]: *** [CMakeFiles/vk_vulkan_framework_KHR.dir/build.make:190: CMakeFiles/vk_vulkan_framework_KHR.dir/nvpro_core/nvp/resources.rc.res] Error 1
[build] make[3]: *** Deleting file 'CMakeFiles/vk_vulkan_framework_KHR.dir/nvpro_core/nvp/resources.rc.res'
[build] make[2]: *** [CMakeFiles/Makefile2:152: CMakeFiles/vk_vulkan_framework_KHR.dir/all] Error 2
[build] make[1]: *** [CMakeFiles/Makefile2:159: CMakeFiles/vk_vulkan_framework_KHR.dir/rule] Error 2
[build] make: *** [Makefile:169: vk_vulkan_framework_KHR] Error 2
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/thoma/Documents/vulkan_framework/build --config Debug --target vk_vulkan_framework_KHR -j 22 -- exited with code: 2
[build] Build finished with exit code 2

ThomasConrad avatar Mar 22 '23 09:03 ThomasConrad

Absolutely! Thanks for catching this — I think the root cause is we don't have Clang on Windows in our continuous integration test matrix, but it would be good for us to support it. I'll update here once we have a change to nvpro_core that fixes this; in the meantime, commenting out the CMake command to add the resource file is a good workaround.

NBickford-NV avatar Mar 22 '23 09:03 NBickford-NV

Hi @ThomasConrad ! Following up on this - I've now set up clang-cl on my machine via the Visual Studio Installer. Generating the project using

cmake path/to/project -T ClangCL -G "Visual Studio 17 2022"

appears to produce a project that links the resource correctly, but I can see the script also invokes a resource linker other than llvm-rc.

Could you send me the command line you used to generate the CMake project? I'm wondering if I need to be using e.g. MSYS2 or a custom toolchain to reproduce this. Thank you!

NBickford-NV avatar Mar 28 '23 18:03 NBickford-NV