Hey everyone,
On a brand new win 11 installation, I installed VS 2022 build tools, then VS 2022 Community Edition (because the CUDA installer said it needs Visual Studio), then I installed the latest CUDA toolkit (12.2).
Now I’m running a build script which calls:
“nvcc” “-ccbin=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\cl.exe” “-Xcompiler” “-nologo” “-Xcompiler” “-MD” “-G” “-Xcompiler” “-Z7” “-Xcompiler” “-Brepro” “-Xcompiler” “-W4” “-o” “D:\dev\WIP\target\debug\build\linkcuda-e0c66e31158bc793\out\eec0cf039ec00ea9-hvm2.o” “-c” “D:\dev\WIP\linkcuda/…/cuda/hvm2.cu”
This build script works on another laptop that has Win 10 and VS 2019.
But on this new Win11 laptop, I get:
Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32824 for x64
Copyright (C) Microsoft Corporation. All rights reserved.tmpxft_00003c40_00000000-2.cpp
nvcc fatal : Host compiler targets unsupported OS.
Any idea why? :)
Btw, I already saw this thread but I didn’t see a solution there.
Someone wrote there:
I have found that nvcc.exe looks for a specific file ‘VC\Auxiliary\Build\vcvarsall.bat’ relative to any parent directory of CL.exe.
Is that still true with CUDA 12.2? (That post is from 2019.)
And the last reply on that thread says:
on windows, the only supported host compiler is cl.exe, the compiler that ships with Visual Studio.
But that’s what I’m using (!)
For VS 2019, the location of vcvarsall.bat
is usually C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall. bat
.
But I installed VS 2022.
In the folder C:\Program Files (x86)\Microsoft Visual Studio\2022
, I don’t have a folder named Community
, I only have a folder named BuildTools
, but I had also installed the community edition (after installing just the build tools), see this screenshot from VS Installer:
(In fact, when I search for vcvarsall.bat
inside the folder C:\Program Files (x86)\Microsoft Visual Studio
, I don’t have this file at all. So it doesn’t seem to be part of VS2022 anymore. I do have VsDevCmd.bat
though, and my VS Dev Console works fine.)
Is NVCC still expecting this file, or is the root cause for this error another one?
I appreciate if you can help me make it work :)