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>
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!

Yes.
"-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.

1 Like

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.

1 Like

Although cl.exe compiles fine
Does cuda 11.8 support intel openAPI?
Even if I specify the host compiler as “Intel C++ Compiler 2022” in Visual Studio
As a command line option
-ccbin “C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64”
is set.

Launch Intel oneAPI command line and manually

nvcc -rdc=true -O2 kernel.cu -o kernel -ccbin “C:\Program Files (x86)\Intel\oneAPI\compiler\2022.1.0\windows\bin\icx.exe”
If I specify

Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2022.1.0 Build 20220316
Copyright (C) 1985-2022 Intel Corporation.

nvcc fatal : Host compiler targets unsupported OS.

icx is started and a message is output, but after that nvcc cannot recognize the OS and dies.

OS is win10

supported host compilers for each platform are listed in the relevant installation guides.

on windows, the only supported host compiler is cl.exe, the compiler that ships with Visual Studio.