MATLAB: Arduino Test Connection build fails with error “Build failed: The third-party library files may be corrupted. Uninstall the support package, reinstall it and launch this hardware setup process again”

arduinohardwareMATLABpackagesimulinksupport

On MATLAB R2020a, after installing Simulink Support Package for Arduino Hardware, I get the following error on build stage of Test Connection:
Build failed: The third-party library files may be corrupted. Uninstall the support package, reinstall it and launch this hardware setup process again
How to fix this?

Best Answer

Try the following:
  1. Uninstall the Simulink Support Package for Arduino Hardware
  2. Remove all the left over files in C:\ProgramData\MATLAB\SupportPackages\R2020a\
  3. Close all MATLAB sessions and reopen it with 'Run as administrator' option
  4. Install the Simulink Support Package for Arduino Hardware again and Test Connection
If this does not work for you and if you have multiple versions of MATLAB installed, then try the following:
  1. Remove all previous versions of MATLAB (versions with the support package installed)
  2. Remove all the left over files in C:\ProgramData\MATLAB\SupportPackages\
  3. Close all MATLAB sessions
  4. Install the MinGW-w64 C/C++ compiler
  5. Reopen MATLAB with 'Run as administrator' option
  6. Install support package again.
  7. Once it's done, your need to make sure the environment variables has the path for this support package. To do so, search "Advanced system settings" from the start menu. Then go to "Environment Variables". Look at the section for user variables. There is a 'PATH' variable. Click Edit, and then make sure that the variable value is 'C:\ProgramData\MATLAB\SupportPackages\R2020a'
  8. Test Connection for Arduino
Related Question