nvcc exits with code 1, no error output.

I’m despairing in getting the CUDA SDK to run on Windows 10 with Visual Studio 2017 on my laptop (with a Geforce 1050 Max-Q).

For any .cu file I want to compile - no matter if its from examples or from other code that compiles perfectly fine on other machines, nvcc on my machine just returns 1 without giving any additional information, even when specifying the “–verbose” flag; no matter whether I run the command from Visual Studio or from the VS command line.

Example (excuse the german snippets, visual studio is installed in german as this is the system language):

1>------ Erstellen gestartet: Projekt: add_cuda, Konfiguration: Debug x64 ------
1>Compiling CUDA source file add.cu...
1>
1>C:\experiments\cuda\add_cuda>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio017\Community\VC\Tools\MSVC4.16.27023\bin\HostX86\x64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static  -g   -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64\Debug\vc141.pdb /FS /Zi /RTC1 /MDd " -o x64\Debug\add.cu.obj "C:\experiments\cuda\add_cuda\add.cu"
1>C:\Program Files (x86)\Microsoft Visual Studio017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.1.targets(762,9): error MSB3721: Der Befehl ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio017\Community\VC\Tools\MSVC4.16.27023\bin\HostX86\x64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static  -g   -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64\Debug\vc141.pdb /FS /Zi /RTC1 /MDd " -o x64\Debug\add.cu.obj "C:\experiments\cuda\add_cuda\add.cu"" wurde mit Code 1 beendet.
1>Die Erstellung des Projekts "add_cuda.vcxproj" ist abgeschlossen -- FEHLER.
========== Erstellen: 0 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 übersprungen ==========

Or

C:\>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio017\Community\VC\Tools\MSVC4.16.27023\bin\HostX86\x64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static  -g   -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64\Debug\vc141.pdb /FS /Zi /RTC1 /MDd " --verbose -o x64\Debug\add.cu.obj "C:\experiments\cuda\add_cuda\add.cu"

C:\>echo %errorlevel%
1

C:\>

when running above failing command in a x86_x64 command prompt (if I run it in a x64 command prompt I of course get a message ‘nvcc fatal : Compiler ‘cl.exe’ in PATH different than the one specified with -ccbin’). But as you can see, there is no output whatsoever.

So what could go wrong here? I have uninstalled and re-installed the CUDA SDK 2 times already, without any change.

How can I get more info on what is going on? Is nvcc writing a log file of some kind?

Nobody an idea what I can do? Is nvcc really that much of a black box that if it fails, it’s bad luck, no chance of finding out what’s wrong?

Fortunately in the meantime I got it to run under Ubuntu 19.04 on the same machine…

Anybody has a solution for it?