|
| 1 | +# Troubleshooting Guide |
| 2 | + |
| 3 | +This directory contains troubleshooting tips for the AutoDRIVE Simulink API, which can help debug build/runtime errors, and assist in installing the necessary dependencies and setting up the correct configuration. |
| 4 | + |
| 5 | +## Potential Errors: |
| 6 | + |
| 7 | +Some of the examples require code generation, which may lead to build errors if not installed. |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +Some of the examples require GPU code generation, which may lead to build errors if not installed properly. |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +The MEX compiler setup is version-specific and can lead to version-mismatch errors if not installed properly. |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +## Potential Fixes: |
| 20 | + |
| 21 | +Download and install the [MATLAB Support for MinGW-w64 C/C++/Fortran Compiler](https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c-fortran-compiler) support package. This can also be done using MATLAB Add-On Explorer. |
| 22 | + |
| 23 | +Setup the GPU MEX compiler by following the steps below: |
| 24 | + |
| 25 | +1. Install Microsoft Visual Studio with `Desktop development with C++` workload selected [Tested with Visual Studio 2019 (V16.11.49)] |
| 26 | + |
| 27 | +  |
| 28 | + |
| 29 | +2. Install NVIDIA CUDA [Tested with CUDA 11.8 (V11.8.89)] |
| 30 | + |
| 31 | + > [!NOTE] |
| 32 | + > It is important to install CUDA after installing Visual Studio so that CUDA can configure Visual Studio settings during installation. |
| 33 | +
|
| 34 | +  |
| 35 | + |
| 36 | +3. Setup the MEX Compiler by running `mex -setup C` and `mex -setup C++` in MATLAB Command Window and selecting `Microsoft Visual C++ 2019 (C)` as the compiler. |
| 37 | + |
| 38 | +  |
| 39 | + |
| 40 | +4. Set the Simulink build process toolchain to `NVIDIA CUDA (w/Microsoft Visual C++ 2019) | nmake` (selecting `Automatically locate an installed toolchain` should choose this already) |
| 41 | + |
| 42 | +  |
| 43 | + |
| 44 | +> [!WARNING] |
| 45 | +> - MATLAB/Simulink requires specific versions of Visual Studio and CUDA to be installed. Please refer to the official GPU Coder requirements [here](https://www.mathworks.com/support/requirements/gpu-coder.html). |
| 46 | +> - MATLAB/Simulink is known to have trouble working with Visual Studio 2022. Please refer to an official thread about this issue [here](https://www.mathworks.com/matlabcentral/answers/2158705-mexcuda-can-t-find-visual-studio-2022-but-mex-can?s_tid=srchtitle). |
0 commit comments