CUDA compiler error: could not set up environment

Hi Bretch,

Im getting this error as well trying to compile Blender 2.93 alpha in Windows 10 with Visual Studio v16.9.2
and CUDA:

nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2021 NVIDIA Corporation
Built on Thu_Jan_28_19:41:49_Pacific_Standard_Time_2021
Cuda compilation tools, release 11.2, V11.2.142
Build cuda_11.2.r11.2/compiler.29558016_0

My card is a Gefroce GTX 970.

I haven´t done any changes to my blender repositoy and Im compiling using:
make release > …\BuildLog.txt
inside the blender directory inside my repository directory.

I’m having this error since a few days ago and I would like to avois to patch myself my repo.

Generating kernel_optix.ptx
CUSTOMBUILD : nvcc warning : The ‘compute_35’, ‘compute_37’, ‘compute_50’, ‘sm_35’, ‘sm_37’ and ‘sm_50’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). [G:\blender-git\build_windows_Release_x64_vc16_Release\intern\cycles\kernel\cycles_kernel_cuda.vcxproj]
nvcc fatal : Could not set up the environment for Microsoft Visual Studio using ‘C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/…/…/…/…/…/…/…/VC/Auxiliary/Build/vcvars64.bat’
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(240,5): error MSB8066: Compilaci¢n personalizada de “G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_sm_35.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_sm_35.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_sm_37.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_sm_37.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_sm_50.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_sm_50.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_sm_52.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_sm_52.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_sm_60.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_sm_60.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_sm_61.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_sm_61.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_sm_70.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_sm_70.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_sm_75.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_sm_75.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_sm_86.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_sm_86.cubin.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\filter_compute_75.ptx.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_compute_75.ptx.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\9697bdaecbd336892a6eeee18de27a28\cycles_kernel_cuda.rule” terminada con el c¢digo 1. [G:\blender-git\build_windows_Release_x64_vc16_Release\intern\cycles\kernel\cycles_kernel_cuda.vcxproj]
CUSTOMBUILD : nvcc warning : The ‘compute_35’, ‘compute_37’, ‘compute_50’, ‘sm_35’, ‘sm_37’ and ‘sm_50’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). [G:\blender-git\build_windows_Release_x64_vc16_Release\intern\cycles\kernel\cycles_kernel_optix.vcxproj]
nvcc fatal : Could not set up the environment for Microsoft Visual Studio using ‘C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/…/…/…/…/…/…/…/VC/Auxiliary/Build/vcvars64.bat’
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(240,5): error MSB8066: Compilaci¢n personalizada de “G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_optix.ptx.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\7fe1b758a87f97ad13a94b9aee9c4d37\kernel_optix_shader_raytrace.ptx.rule;G:\blender-git\build_windows_Release_x64_vc16_Release\CMakeFiles\9697bdaecbd336892a6eeee18de27a28\cycles_kernel_optix.rule” terminada con el c¢digo 1. [G:\blender-git\build_windows_Release_x64_vc16_Release\intern\cycles\kernel\cycles_kernel_optix.vcxproj]

Can you fix it in master please?

Thanks in advance,
David

Moving to a new topic since this seems unrelated. 2.93 already has the fix for the error in the original topic.

The relevant error message is this one:

nvcc fatal : Could not set up the environment for Microsoft Visual Studio using
‘C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/…/…/…/…/…/…/…/VC/Auxiliary/Build/vcvars64.bat’

I’ve never encountered that myself, but maybe one of the suggestions here will help:


Reinstalling CUDA and/or Visual Studio may also help.

I’ve seen issues like this when the path environment variable is screwy, what’s the output of

set path

on the command line?

Hi Bretch and LazyDodo,

Sorry I couldnt had a look to this until now.
First an apology because I didn’t noticed the error was different.

I ALWAYS use the x64 Native Tools Command Prompt for VS 2019 that initializes always the vcvarsall.bat:


** Visual Studio 2019 Developer Command Prompt v16.9.2
** Copyright © 2021 Microsoft Corporation


[vcvarsall.bat] Environment initialized for: ‘x64’

A set path with this prompt gives me:

C:\Windows\System32>set path
Path=
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\\Extensions\Microsoft\IntelliCode\CLI;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCPackages;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools\x64;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools;
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\\x64;
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\devinit;
C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64;
C:\Program Files (x86)\Windows Kits\10\bin\x64;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\\MSBuild\Current\Bin;
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\libnvvp;
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;
C:\potrace-1.14.win64\;
C:\Program Files\Intel\iCLS Client\;
C:\ProgramData\Oracle\Java\javapath;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\Program Files\doxygen\bin;
C:\Program Files\TortoiseSVN\bin;
C:\Program Files\TortoiseHg\;
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
C:\Strawberry\c\bin;
C:\Strawberry\perl\site\bin;
C:\Strawberry\perl\bin;
C:\Program Files\Git LFS;
C:\Program Files\Calibre2\;
C:\Program Files\dotnet\;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\WINDOWS\System32\OpenSSH\;
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;
C:\Program Files\CMake\bin;
C:\Program Files\nodejs\;
C:\Program Files\Git\cmd;
C:\Rust\bin;
C:\php;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\WINDOWS\System32\OpenSSH\;
C:\Program Files\TortoiseGit\bin;
C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.3.1\;
C:\Program Files (x86)\IncrediBuild;
C:\Users\David\AppData\Local\Programs\Python\Python37\Scripts\;
C:\Users\David\AppData\Local\Programs\Python\Python37\;
C:\Users\David\.cargo\bin;
C:\Users\David\AppData\Local\Microsoft\WindowsApps;
C:\Users\David\AppData\Local\Pandoc\;
C:\Users\David\AppData\Roaming\npm;
C:\Users\David\AppData\Local\GitHubDesktop\bin;
C:\Users\David\AppData\Local\atom\bin;
C:\Users\David\AppData\Local\Microsoft\WindowsApps;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\x64\bin;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

So looks like VS is in the path.

If I do a set path from a normal Command Promt I get this (notice all the VS paths missing):

C:\WINDOWS\system32>set path
Path=
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\libnvvp;
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;
C:\potrace-1.14.win64\;
C:\Program Files\Intel\iCLS Client\;
C:\ProgramData\Oracle\Java\javapath;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\Program Files\doxygen\bin;
C:\Program Files\TortoiseSVN\bin;
C:\Program Files\TortoiseHg\;
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
C:\Strawberry\c\bin;
C:\Strawberry\perl\site\bin;
C:\Strawberry\perl\bin;
C:\Program Files\Git LFS
C:\Program Files\Calibre2\;
C:\Program Files\dotnet\;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\WINDOWS\System32\OpenSSH\;
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;
C:\Program Files\CMake\bin;
C:\Program Files\nodejs\;
C:\Program Files\Git\cmd;
C:\Rust\bin;
C:\php;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\WINDOWS\System32\OpenSSH\;
C:\Program Files\TortoiseGit\bin;
C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.3.1\;
C:\Program Files (x86)\IncrediBuild;
C:\Users\David\AppData\Local\Programs\Python\Python37\Scripts\;
C:\Users\David\AppData\Local\Programs\Python\Python37\;
C:\Users\David\.cargo\bin;
C:\Users\David\AppData\Local\Microsoft\WindowsApps;
C:\Users\David\AppData\Local\Pandoc\;
C:\Users\David\AppData\Roaming\npm;
C:\Users\David\AppData\Local\GitHubDesktop\bin;
C:\Users\David\AppData\Local\atom\bin;
C:\Users\David\AppData\Local\Microsoft\WindowsApps

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

For the moment opening I solved the compìling opening the solution generated (even with the error) and compiling from the IDE.

I will investigate why this discrepancies on the path and why VS dissapeared from a normal command prompt, maybe has to do with Windows 10 removing it and wanting people use Power Shell???

I will post my findings. But any ideas are welcome.

Thanks in advance
David.

HI Bretch and LazyDodo,

Building from the ide finished but then trying to launch it from a previous shortcut from my Desktop gave me another error about wrong parallel configuration.

To make it short, I decided to run the build from Powershell, finished (so definetly the command prompt problems must be a path thing), tried to run from the shortcut same wrong parallel conf.

Afraid that it could be for trying build over build I went the fearless route. Deleted the whole buil dir. Build it from Powershell with a make clean release.

Tried to run with the old shortcut, bad idea, same wrong parallel configuration. So deleted the shortcut and run the blender.exe, run it flawlessly.

Redone the shortcut and now it works.

I will investigate how to fix the path problem. In the meantime I will use Powershell.

Thanks in advance,
David

none of that made a whole lot of sense to me, but the important thing is you’re up and running! :slight_smile: