nvcc fatal : Host compiler targets unsupported OS.

Could anyone let me know what exact condition triggers this error from NVCC?
nvcc fatal : Host compiler targets unsupported OS.

I am building a project on windows using msbuild 15.0.

I was able to build the exact same project without external dependencies. But, when I add some dependencies to the parent directories, it fails like below (modifed contents…)
I am debugging this, and would like to know the exact condition this error is triggered to fix the build import files.

1>------ Build started: Project: Decoder, Configuration: Release x64 ------
1>Compiling CUDA source file …\helpers.cu…
1>D:\DecoderBuild>“D:\packages\CudaSdk.10.1.0\bin\nvcc.exe” -gencode=arch=compute_50,code=“sm_50,compute_50” --use-local-env -ccbin “D:\packages\VisualCppTools.14.15.26732.1\build\native…\lib\native\bin\amd64” -x cu -o x64\Release\helpers.cu.obj “D:\mtmain\private\mt\tools\PureNeuralMT\Marian_GitSubmodule\src\translator\helpers.cu”
1>nvcc fatal : Host compiler targets unsupported OS.
1>D:\mtmain\packages\CudaSdk.10.1.0\extras\visual_studio_integration\MSBuildExtensions\CUDA 10.1.targets(764,9): error MSB3721: The command
1>Done building project “DecoderBuild.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

It’s complaining about the host compiler of course.

The host compiler specification is in the -ccbin switch.

With a properly set up CUDA 10.1 install on Visual Studio on windows 10 I would expect

-ccbin "C:\Program Files (x86)\Microsoft Visual Studio019\Professional\VC\Tools\MSVC4.20.27508\bin\HostX86\x64"

So I would be suspicious of

-ccbin "D:\packages\VisualCppTools.14.15.26732.1\build\native\..\..\lib\native\bin\amd64"

Since I don’t know what that is, I can’t be any more specific. My suggestion would be to set up your build environment so it mimics the host compiler selected in a proper visual studio install of CUDA, in that environment/OS.

Thanks for the quick reply!

"-ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64"”
This works well on my project as well.

But, in my situation, I have to make a build environment without VS (cpp) compiler installed.
I can use a nuget package which contains a visual cpp compiler (cl.exe).

I copied the contents of “D:\packages\VisualCppTools.14.15.26732.1\build\native…\lib\native\bin\amd64” into the visual studio directory. “C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64”, and confirmed that the cl.exe itself works fine (even they are the same).

I would like to get some more detailed error message or condition for the host compiler error in order to find the wrong flag or setting in my msbuild file.

I have found that nvcc.exe looks for a specific file ‘VC\Auxiliary\Build\vcvarsall.bat’ relative to any parent directory of CL.exe.
There is not setting or option for this. This is hard-coded in the binary. (cuda 10.1)

Hope this could become configurable.

I had to change some of my packages to match this directory structure.