How can I debug validator failures in Visual Studio?

SDK for VST 3 audio plug-in and host development.
Post Reply
midiosh
Posts: 8
Joined: Fri Feb 07, 2020 8:40 pm

How can I debug validator failures in Visual Studio?

Post by midiosh »

I'm new to the VST SDK forum and to VST plugin development in general. I'm finding often when I run the VST validator, I get a post build failure with no description or reasons given. This can be hard to debug... Often even after I narrow it down to a single line of code, I still cant figure out why it is crashing.

All I am given in the Error log in Visual Studio is:
Error MSB3073 The Command "... <post build command> ..." exited with code -1073741819

Which, if I understand correctly, essentially is just is saying post build failed. Can anybody give me tips on how to get a more detailed failure description or how to debug this type of message in general?

Full Error Log:
Error MSB3073 The command "setlocal
"C:\Program Files\cmake-3.16.4-win64-x64\bin\cmake.exe" -E copy "C:/Users/../VST_SDK/VST3_SDK/doc/artwork/VST_Logo_Steinberg.ico" "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/PlugIn.ico"
if %errorlevel% neq 0 goto :cmEnd
"C:\Program Files\cmake-3.16.4-win64-x64\bin\cmake.exe" -E copy "C:/Users/.../VST_SDK/VST3_SDK/cmake/modules/../templates/desktop.ini.in" "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/desktop.ini"
if %errorlevel% neq 0 goto :cmEnd
attrib +s "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/desktop.ini"
if %errorlevel% neq 0 goto :cmEnd
attrib +s "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/PlugIn.ico"
if %errorlevel% neq 0 goto :cmEnd
attrib +s "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
setlocal
cd "C:\Users\...\VST_SDK\VST3_SDK\build\bin"
if %errorlevel% neq 0 goto :cmEnd
C:
if %errorlevel% neq 0 goto :cmEnd
"C:\Users\...\VST_SDK\VST3_SDK\build\bin\Debug\validator.exe" "C:/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/Contents/x86_64-win/filterdemo.vst3"
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code -1073741819. filterdemo C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets 149

Wanderer
Posts: 26
Joined: Sun Jun 24, 2018 2:24 pm

Re: How can I debug validator failures in Visual Studio?

Post by Wanderer »

if build is not successful, you need read last lines before this error. This error can be thrown even during validation from successful build (if something bad happen in code). Unfortunetaly I didn't find how to debug it, I use allways release mode and wrote my own log if something is going wrong.

Another solution can be turn off some part of antivirus (or whole antivirus) which can block cmd execution.

midiosh
Posts: 8
Joined: Fri Feb 07, 2020 8:40 pm

Re: How can I debug validator failures in Visual Studio?

Post by midiosh »

Thanks for the Info!

The issue is I cant find any information about the build failure at all in the log (even before the failure).

This is the full Output log copied from Visual Studio:

Code: Select all

 -------------------------------------------------------------
  TestSuite : Single Precision (32 bit) Tests
  -------------------------------------------------------------

  [Process Test]
  [Succeeded]
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: The command "setlocal
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: "C:\Program Files\cmake-3.16.4-win64-x64\bin\cmake.exe" -E copy "C:/Users/.../VST_SDK/VST3_SDK/doc/artwork/VST_Logo_Steinberg.ico" "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/PlugIn.ico"
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: "C:\Program Files\cmake-3.16.4-win64-x64\bin\cmake.exe" -E copy "C:/Users/.../VST_SDK/VST3_SDK/cmake/modules/../templates/desktop.ini.in" "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/desktop.ini"
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: attrib +s "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/desktop.ini"
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: attrib +s "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/PlugIn.ico"
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: attrib +s "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3"
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmErrorLevel
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: exit /b %1
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmDone
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: setlocal
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: cd "C:\Users\...\VST_SDK\VST3_SDK\build\bin"
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: C:
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: "C:\Users\...\VST_SDK\VST3_SDK\build\bin\Debug\validator.exe" "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/Contents/x86_64-win/filterdemo.vst3"
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmErrorLevel
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: exit /b %1
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmDone
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
  C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :VCEnd" exited with code -1073741819.
Done building target "PostBuildEvent" in project "filterdemo.vcxproj" -- FAILED.

Done building project "filterdemo.vcxproj" -- FAILED.

Build FAILED.

C:\Users\...\VST_SDK\my_plugins\filterdemo\source\plugprocessor.cpp(143,8): warning C4189: 'tempDelayBufIdx': local variable is initialized but not referenced
EXEC : warning : No snapshots in Bundle.
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: The command "setlocal
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: "C:\Program Files\cmake-3.16.4-win64-x64\bin\cmake.exe" -E copy "C:/Users/.../VST_SDK/VST3_SDK/doc/artwork/VST_Logo_Steinberg.ico" "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/PlugIn.ico"
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: "C:\Program Files\cmake-3.16.4-win64-x64\bin\cmake.exe" -E copy "C:/Users/.../VST_SDK/VST3_SDK/cmake/modules/../templates/desktop.ini.in" "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/desktop.ini"
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: attrib +s "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/desktop.ini"
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: attrib +s "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/PlugIn.ico"
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: attrib +s "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3"
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmErrorLevel
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: exit /b %1
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmDone
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: setlocal
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: cd "C:\Users\...\VST_SDK\VST3_SDK\build\bin"
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: C:
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: "C:\Users\...\VST_SDK\VST3_SDK\build\bin\Debug\validator.exe" "C:/Users/.../VST_SDK/VST3_SDK/build/VST3/Debug/filterdemo.vst3/Contents/x86_64-win/filterdemo.vst3"
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmErrorLevel
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: exit /b %1
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmDone
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
C:\Program Files (x86)\Microsoft Visual Studio\...\Microsoft.CppCommon.targets(149,5): error MSB3073: :VCEnd" exited with code -1073741819.
    2 Warning(s)
    1 Error(s)

Time Elapsed 00:00:03.02
========== Build: 0 succeeded, 1 failed, 28 up-to-date, 0 skipped ==========
You can see I copied from the end of the last part of the build which reported [Succeeded]. Is there any information I'm missing here that could give me more info? It just seems odd to have a validator which doesn't report the reasons it fails.

Thanks for your help!

Wanderer
Posts: 26
Joined: Sun Jun 24, 2018 2:24 pm

Re: How can I debug validator failures in Visual Studio?

Post by Wanderer »

hmm, it is hard to say where is the problem. This is full build output? When this start throw this error? Did you create your project with CMAKE, or your custom prjoect?

User avatar
ygrabit
Posts: 184
Joined: Fri Jun 17, 2016 7:52 am
Location: Hamburg
Contact:

Re: How can I debug validator failures in Visual Studio?

Post by ygrabit »

Do you have the User Right to write in the targetted folder ?
Note for Windows:
In order to be able to create Symbolic Link you have to set the correct group policy, for this you can use the following:
>Run gpedit.msc
Navigate to Computer configuration => Windows Settings => Security Settings =>Local Policies => User Rights Assignment => Create symbolic links
Here you can set which users can create symbolic links.

an another solution is to start your Visual as Administrator...
YVan Grabit

midiosh
Posts: 8
Joined: Fri Feb 07, 2020 8:40 pm

Re: How can I debug validator failures in Visual Studio?

Post by midiosh »

Sorry for the late reply, somehow I missed this. I still haven't found an effective way to debug validator errors...
I have tried running Visual Studio as administrator, although my account is administrator so that shouldn't be the issue.

Just to be clear I get this same error for literally any type of bug in my code, and I'm never given any information about the cause of the error. I'm not looking for help debugging a specific error so much as I'm just wondering if others receive a detailed description of errors that occur during the builds/tests completed by the VST SDK Validator. It's very tedious to debug errors with no error report.

willpirkle
Posts: 67
Joined: Tue Jun 21, 2016 12:53 pm

Re: How can I debug validator failures in Visual Studio?

Post by willpirkle »

My ASPiK users and I run into this on occasion.

It is because either the validator failed or because the final .vst3 failed to write to its target folder, which on Windows is a protected directory. Running VS as admin requires more than just logging in as admin and then running VS. Since you didn't get compile warnings, it looks like the code may compile OK but the error is deeper. There are four things I do:

1) Plugin Compiles? To test this, go to the Post-Build Event and set "Use in Build" to NO, then recompile. If the plugin compiles, you will see the message like this, showing that it was written to it's "first" destination in the /Debug folder.

1>DemoVolumePlugin.vcxproj -> C:\ALL_SDK\VST_SDK\VST3_SDK\myprojects\DemoVolumePlugin\win_build\VST3\Debug\DemoVolumePlugin.vst3\Contents\x86_64-win\DemoVolumePlugin.vst3

If you get this, then the Plugin is compiling, but of course you could still have deeper issues.So, go back and set the "Use in Build" back to YES.

2) logging from the Post-Build script: you can track the process of the Post-Build script using @echo in strategic locations. For example, to see if the validator is being run you could edit the script like this:

@echo --- Running Validator ---
C:\ALL_SDK\VST_SDK\VST3_SDK\myprojects\DemoVolumePlugin\win_build\bin\Debug\Debug\validator.exe C:/ALL_SDK/VST_SDK/VST3_SDK/myprojects/DemoVolumePlugin/win_build/VST3/Debug/DemoVolumePlugin.vst3/Contents/x86_64-win/DemoVolumePlugin.vst3

You can also place these around the chunk that copies the .vst3 from its /Debug folder to it's final destination by looking for "cmake.exe" -E copy."

@echo --- Copying Plugin ---
C:\Program Files\CMake\bin\cmake.exe" -E copy........./SNIP/

3) logging from the validator: you have all the code for the validator executable in your project, and you can add some more debug logging to that as well. There are numerous places to log from, but the starting place would be Validator::run ( )

Code: Select all

int Validator::run ()
{
	if (infoStream)
		*infoStream << "---> Validator::run CALLED!\n";

	// defaults
	bool useGlobalInstance = true;
        etc . . . . . 
If you poke around you can find the tests as well.

4) logging from the Plugin code - if the validator is failing, you can log messages from the plugin itself. You can place logging code all over the place, but a starting point is in your class factory definition and the InitModule( ) functions. Here is the class factory (only the last bit is shown):

Code: Select all

	Steinberg::Vst::ASPiK::VST3Plugin::createInstance)		// function pointer called when this component should be instanciated
	printf("---> createInstance in factory \n");
END_FACTORY
and

Code: Select all

bool InitModule(){
	printf("---> Factory: InitModule\n");
	return true;
}
After implementing a few of these, you can see what the top of my output window looks like:

Code: Select all

1>DemoVolumePlugin.vcxproj -> C:\ALL_SDK\VST_SDK\VST3_SDK\myprojects\DemoVolumePlugin\win_build\VST3\Debug\DemoVolumePlugin.vst3\Contents\x86_64-win\DemoVolumePlugin.vst3
1>		Copy PlugIn.ico and desktop.ini and change their attributes.
1>---Changing Directories---
1>--- Running Validator ---
1>---> Validator::run CALLED!
1>* Loading module...
1>
1>	C:/ALL_SDK/VST_SDK/VST3_SDK/myprojects/DemoVolumePlugin/win_build/VST3/Debug/DemoVolumePlugin.vst3/Contents/x86_64-win/DemoVolumePlugin.vst3
1>
1>---> Factory: InitModule
1>---> Class Factory called
1>* Scanning classes...
1>
Hopefully, one of these strategies will help you find the issue. For most of my users, this has to do with Admin privileges and not being able to write the plugin (as Yvan was pointing out).

Will

Wanderer
Posts: 26
Joined: Sun Jun 24, 2018 2:24 pm

Re: How can I debug validator failures in Visual Studio?

Post by Wanderer »

Hmm and can you compile some VST example without this failure? Maybe you forgot compile validator? (depends of how you created your project)
Or try check if everything is on right place (if everything is under path from error list) (not only your plugin files but validator and etc...)

and maybe willpirkle have truth. I run VStudio as administrator and never had of this problem. Except when I didn't right plugin setup project or vst is not compiled right.

willpirkle
Posts: 67
Joined: Tue Jun 21, 2016 12:53 pm

Re: How can I debug validator failures in Visual Studio?

Post by willpirkle »

Yes, I can compile the sample plugins from VST3 SDK along with all of my own ASPiK VST3 plugins - no problems.

My installation directories are all default.

Will Pirkle

midiosh
Posts: 8
Joined: Fri Feb 07, 2020 8:40 pm

Re: How can I debug validator failures in Visual Studio?

Post by midiosh »

Hi Will,

Thanks for the great tips!

Good suggestions on adding comments to the POST_BUILD script and changing "Use In Build" to NO. This didn't reveal anything but is a good starting point.

After digging around the Validator Code I realized that there ARE print logs that provide more information (INFO and ERROR levels), BUT since they never flush the std::cout prints, they are never shown in the console.

I added "std::endl" to the end of every cout print in the Validator code and now I can see them.

Maybe I'm missing something, but it seems odd that they would have these logs but never flush them to console -- Any idea why?

Thanks again.

P.S. I'm a musician and an electrical engineer and I recently started doing VST plugin development as a hobby project. I'm actually using your textbook "Designing Audio Effect Plugins in C++" as a reference -- It's a very well written book, especially for someone like me who's interested in digging into the DSP math / analog modelling aspects. Thanks for that!

Post Reply