You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is your question?
I'm developing a CUDA project using conan, CMake and MSVC build tools. After update from CUDA 11.x to CUDA 12.6, any project using conan CMake toolchain fails to configure during CUDA compiler test. It also reproduces in my more complex project GitHub actions Windows build job (example).
The problematic line in CUDA 12.6.targets is the following:
I suspect it has something to do with CMAKE_POLICY_DEFAULT_CMP0091="NEW" and runtime option - it looks like it's not propagated properly. Is there any way to work around this issue?
Environment details
OS: Windows 11 24H2
Conan: 2.9.1
CUDA: 12.6
Visual Studio 2022 17.11.5, MSVC 19.41.34123
CMake 3.30.5
conanfile.py:
from conan import ConanFile
from conan.tools.cmake import cmake_layout
class DummyProj(ConanFile):
name = "dummy"
generators = "CMakeDeps", "CMakeToolchain"
settings = "os", "build_type", "compiler", "arch"
build_policy = "missing"
def layout(self):
cmake_layout(self)
CMakeLists.txt:
cmake_minimum_required(VERSION 3.23)
project(dummy VERSION 0.1.0 LANGUAGES CUDA CXX)
Steps to reproduce: conan install . -s build_type=Release --build=missing
Preset CMake variables:
CMAKE_POLICY_DEFAULT_CMP0091="NEW"
CMAKE_TOOLCHAIN_FILE:FILEPATH="generators\conan_toolchain.cmake"
-- Using Conan toolchain: C:/Users/Jakub/Desktop/Development/dummy_cuda/build/generators/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: Setting CMAKE_MSVC_RUNTIME_LIBRARY=$<$<CONFIG:Release>:MultiThreadedDLL>
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.26100.
-- The CXX compiler identification is MSVC 19.41.34123.0
-- The CUDA compiler identification is NVIDIA 12.6.77
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - failed
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeTestCUDACompiler.cmake:59 (message):
The CUDA compiler
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: 'C:/Users/Jakub/Desktop/Development/dummy_cuda/build/CMakeFiles/CMakeScratch/TryCompile-jhqlit'
Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_0b9ce.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
MSBuild version 17.11.9+a69bbaaf5 for .NET Framework
Build started 11/7/2024 7:29:45 PM.
Project "C:\Users\Jakub\Desktop\Development\dummy_cuda\build\CMakeFiles\CMakeScratch\TryCompile-jhqlit\cmTC_0b9ce.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_0b9ce.dir\Debug\".
Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.
Creating directory "C:\Users\Jakub\Desktop\Development\dummy_cuda\build\CMakeFiles\CMakeScratch\TryCompile-jhqlit\Debug\".
Creating directory "cmTC_0b9ce.dir\Debug\cmTC_0b9ce.tlog\".
InitializeBuildStatus:
Creating "cmTC_0b9ce.dir\Debug\cmTC_0b9ce.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
Touching "cmTC_0b9ce.dir\Debug\cmTC_0b9ce.tlog\unsuccessfulbuild".
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.6.targets(277,17): error MSB4023: Cannot evaluate the item metadata "%()". Parameter "metadataName" cannot have zero length. [C:\Users\Jakub\Desktop\Development\dummy_cuda\build\CMakeFiles\CMakeScratch\TryCompile-jhqlit\cmTC_0b9ce.vcxproj]
Done Building Project "C:\Users\Jakub\Desktop\Development\dummy_cuda\build\CMakeFiles\CMakeScratch\TryCompile-jhqlit\cmTC_0b9ce.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Jakub\Desktop\Development\dummy_cuda\build\CMakeFiles\CMakeScratch\TryCompile-jhqlit\cmTC_0b9ce.vcxproj" (default target) (1) ->
(AddCudaCompileMetadata target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.6.targets(277,17): error MSB4023: Cannot evaluate the item metadata "%()". Parameter "metadataName" cannot have zero length. [C:\Users\Jakub\Desktop\Development\dummy_cuda\build\CMakeFiles\CMakeScratch\TryCompile-jhqlit\cmTC_0b9ce.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.74
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
CMake without conan toolchain works fine. cmake .
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.26100.
-- The CXX compiler identification is MSVC 19.41.34123.0
-- The CUDA compiler identification is NVIDIA 12.6.77
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Configuring done (10.1s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/Jakub/Desktop/Development/dummy_cuda
Have you read the CONTRIBUTING guide?
I've read the CONTRIBUTING guide
The text was updated successfully, but these errors were encountered:
I suspect it has something to do with CMAKE_POLICY_DEFAULT_CMP0091="NEW" and runtime option - it looks like it's not propagated properly. Is there any way to work around this issue?
Could you please check this? If you could remove the CMAKE_POLICY_DEFAULT_CMP0091 both from the CMakePresets.json and conan_toolchain.cmake generated files before calling cmake --preset to check if it works, then do the same with the runtime-option (btw, what is this runtime option?)
Maybe @jcar87 who has more experience than me with CUDA could help too.
It worked after removing the runtime library-related code from generated conan_toolchain.cmake.
After some trial and error, it turned out that the minimal set of changes that solves the CUDA configuration failure is removing setting the runtime with CMAKE_MSVC_RUNTIME_LIBRARY from conan_toolchain.cmake:
So I tried to just use regular CMake with this option, and voila, it failed again. CMakeLists.txt:
cmake_minimum_required(VERSION 3.23)
set(CMAKE_MSVC_RUNTIME_LIBRARY "$<$<CONFIG:Release>:MultiThreadedDLL>")
project(dummy VERSION 0.1.0 LANGUAGES CXX CUDA)
cmake .
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.26100.
-- The CXX compiler identification is MSVC 19.41.34123.0
-- The CUDA compiler identification is NVIDIA 12.6.77
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - failed
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeTestCUDACompiler.cmake:59 (message):
The CUDA compiler
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe"
is not able to compile a simple test program.
...
"C:\Users\Jakub\Desktop\Development\dummy_cuda\CMakeFiles\CMakeScratch\TryCompile-7m8wyt\cmTC_554e7.vcxproj" (default target) (1) ->
(AddCudaCompileMetadata target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.6.targets(277,17): error MSB4023: Cannot evaluate the item metadata "%()". Parameter "metadataName" cannot have zero length. [C:\Users\Jakub\Desktop\Development\dummy_cuda\CMakeFiles\CMakeScratch\TryCompile-7m8wyt\cmTC_554e7.vcxproj]
...
So it looks like an incompatibility between CMake and Visual Studio CUDA integration.
Is there any way to disable setting the CMAKE_MSVC_RUNTIME_LIBRARY in conan CMake toolchain (e.g. via conanfile.py)?
What is your question?
What is your question?
I'm developing a CUDA project using conan, CMake and MSVC build tools. After update from CUDA 11.x to CUDA 12.6, any project using conan CMake toolchain fails to configure during CUDA compiler test. It also reproduces in my more complex project GitHub actions Windows build job (example).
The problematic line in
CUDA 12.6.targets
is the following:I suspect it has something to do with
CMAKE_POLICY_DEFAULT_CMP0091="NEW"
and runtime option - it looks like it's not propagated properly. Is there any way to work around this issue?Environment details
conanfile.py:
CMakeLists.txt:
Steps to reproduce:
conan install . -s build_type=Release --build=missing
cmake --preset conan-default
CMake without conan toolchain works fine.
cmake .
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: