nvpro-samples / nvpro_core

shared source code and resources needed for the samples to run
Apache License 2.0
473 stars 113 forks source link

Error when compiling with clang on windows. #48

Closed ThomasConrad closed 4 weeks ago

ThomasConrad commented 1 year ago

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
NBickford-NV commented 1 year ago

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 commented 1 year ago

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!

mklefrancois commented 4 weeks ago

If the problem persists, please reopen the issue with reproducible information.