GCC Error When Compiling My Matlab® Simulink® Model for Windows OS with Veristand.tlc

Updated Apr 12, 2023

Reported In

Software

  • VeriStand
  • LabVIEW Model Interface Toolkit

Issue Details

I'm trying to build a simple Simulink® model for my Windows target in VeriStand 2019 R3 or later. When I build it, I get the following error:
  • ​​​​"gcc error: unrecognized command line option '-m32'"
  • No output dll, but correct source files and make file
This doesn't happen when building the same model for a Linux target.

Solution

This error will be present whenever the MATLAB® software pulls a wrong version for the GCC Compiler instead of the required WinGW-W64.

The first thing you need to do is to verify you're installing all the software and components needed to generate a Simulink® model for a Windows target.

If the error still persist, please follow these steps:

1. Install the correct MinGW-w64 - for 32&64 bit Windows Compiler for VeriStand:

  1. Download the MinGW-w64 - for 32 and 64 bit Windows (NOTE: please wait for the download to start automatically)
  2. To install the MinGW-w64 compiler you just need to unzip the "x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z" file to any location where you can run executables with your Windows User. If you’re not sure where you can do this, please ask your IT department.​​​
  3. Edit the System Environment Variables:
  1. Navigate to the System Environment Variables (Windows Start » Control Panel » System » Advanced » Environment Variables)
  2. Add a new System Variable with the Variable Name NI_MINGW_WIN32
  3. The variable value must be the path pointing to the bin directory of the downloaded and unzipped "x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z" where the gcc.exe is located which is the correct GCC Compiler for Veristand for the compilation of Models for the Windows OS.
  • For example "C:\VeriStand\2019\ModelInterface\mingw64\bin"
  • So we would want it to look like this for example:

 

2. Restart your application. Can also restart computer if problem persists.

3. You can now compile a Windows compatible model for use in VeriStand by selecting VeriStand.tlc as the compiler, and VeriStand Compiler for Windows Targets as the toolchain. This process is described in the VeriStand manual .

Additional Information

NOTE: 
The MATLAB provided Add-on MinGW-w64 C/C++ Compiler does not support building 32-bit dlls, so you will need to install one that does support buidling 32-bit dlls.
You can find the one such toolchain here: MinGW-w64 - for 32 and 64 bit Windows Compiler (x86_64-win32-sjlj) 

MATLAB®, Simulink®, and Real-Time Workshop® are registered trademarks of The MathWorks, Inc. All other trademarks are the property of their respective owners.