vsvars32.bat not found Error on compiling samples with vsvars32.bat

I would like to try the CUDA SDK 3.0 with Visual C++ 2008 but when i try to compil one sample it’s failed with the folowing error :

I have put the vsvars32.bat in the right path (C:/Program Files/Microsoft Visual Studio 9.0/VC/bin/…/…/…) but without success.

I searched the forum and on internet everything about ‘vsvars32.bat’ but nothing.

Thank you for help.

I have the same problem and would be happy if someone can help

I had the same problem. The operating system was Windows 7 64-bit and I had installed both the 64-bit versions of the CUDA toolkit (and of the GPU Computing SDK code samples) and of the Windows SDK. At that point I expected to be able to setup a Visual C++ environment through vcvars32.bat or vcvars64.bat and run nvcc, but I got the same error message that you did.

I then installed Visual C++ 2008 Express (as well as the 2010 by mistake; it shouldn’t make a difference) and the error message changed to:

At that point it would have been possible for me to compile a 32-bit executable by passing nvcc the -m32 option, though I only realized so later. (Trial and error seem to show that there is no need to change the CUDA environment variables to point to the 32-bit directories in order compiling. However, it is necessary to change the PATH so that it points to C:\CUDA\bin.)

I later used some of Dr.Synth’s suggestions: I created a vcvarsamd64.bat file (which can be empty: its contents seem to be irrelevant) under “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64”. From then on I seem to be able to target 64-bit builds from the command line. His other suggestions should allow you to build under Visual C++ too.

I have fixed the same problem by copying the vsvars32.bat file into folder

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools

Hope this helps

Paolo

Hi,

I’ve got the same problem. I was trying to compile ‘kernel.cu’ file to ‘kernel.cubin’. The file ‘kernel.cu’ was in C:\CUDA\bin\

[codebox]nvcc kernel.cu --cubin[/codebox]

My error message is similar:

[codebox]nvcc fatal : Visual Studio configuration file ‘vsvars32.bat’ could not be found for installation at ‘C:\CUDA\bin/…/bin/…/…/…’[/codebox]

So, the directory indicates to C:\ . I copied ‘vsvars32.bat’ there, but no effect. I copied it to C:\CUDA\bin, but no effect.

I would copy it to C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\ like Paolo said, but it was already there! External Image

Any ideas, how to solve this problem?

Those error messages are quite misleading. To check which files nvcc is failing to open you might want to try out Process Monitor. With it you can do the following:

[list=1]

[*]Run Process Monitor.

[*]Inside it, create a filter targeting nvcc (e.g. filter by process name nvcc.exe).

[*]Again inside it, clear the captured events to have a clear view.

[*]Launch nvcc to trip the error and capture the events.

[*]Examine the bottom of the list of captured events to find which file failed to load (at the top of it you will find likely find many unrelated failures, such as the PATH search for some files

.

This was how I found that, when installing the Microsoft C/C++ 32 and 64 bit compilers through the VS2008-compatible Windows 7 SDK there were two files which the 64-bit version of nvcc wanted:

    [*][font=“Courier New”]C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat[/font]. To make things work, I created the missing directory, copied into it [font=“Courier New”]C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat[/font] and renamed the copied file.

    [*][font=“Courier New”]C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat[/font]. I “solved” this issue by copying into that directory [font=“Courier New”]C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat[/font] and renaming the copied file.

Cheers.

1 Like