Simulink Compiler Errors and Compiler Selection

7 views (last 30 days)
Greg
Greg on 22 Apr 2013
Edited: Severin on 13 Jul 2017
Hi,
I'm trying to compile and run Simulink models on a 32-bit Windows machine which I already know run just fine on a 64-bit Linux machine. The models won't compile, however, giving me exceptionally helpful errors like "Error(s) encountered while building model". When I turn on the verbose accelerator builds, I get a little bit more detail in the command window, with error messages like "ACFT_ENV_Atm_mdllib.lib : fatal error LNK1127: library is corrupt". (ACFT_ENV_Atm being the name of a model file). Anyone ever seen anything like this before?
I'm not sure if this is a related problem or not, but it looks to me like when Simulink is compiling, it's using the LCC default compiler even though I have a different C compiler selected under "mex -setup". At first I was trying to use Visual Studio 2005, but since that isn't on the official list of supported compilers anymore, I went out and got the latest Windows SDK 7.1. When I select either of these under "mex -setup", however, the verbose accelerator build still spits out a lot of lines like "C:/PROGRA~1/MATLAB/R2013a\sys\lcc\bin\lcc" and none at all referencing the location of the compiler, so I have to assume that it's not obeying the selection that I made under "mex -setup". Is there a different place to set compiler options for Simulink? I always thought that Simulink still used the "mex -setup" options, and I could swear that I successfully used that before in R2012a or R2012b. (The Microsoft compilers made my models run much faster than LCC).
- Greg
  3 Comments
Greg
Greg on 26 Apr 2013
Strangely, the problem seems to have gone away when I restarted my computer. (Not sure if I had attempted to restart just MATLAB before I restarted the computer).
Severin
Severin on 13 Jul 2017
Edited: Severin on 13 Jul 2017
Same problem here. Simulink seems to not obey mex -setup. Restarting MATLAB and computer did not solve my problem. I'm running MATLAB R2008a (7.6.0) with Microsoft Visual C++ 2008 as the compiler. I can compile .c file using mex file.c. Compiling a fresh Simulink model with a single Embedded MATLAB Function results in the error:
"%ProgramsDir%\matlab\r2008a\sys\lcc\bin\lccmake" -f untitled_sfun.lmk
The system cannot find the path specified.
Running mex.getCompilerConfigurations('c') outputs:
mex.compilerConfiguration
package: mex
properties:
Name: 'Microsoft Visual C++ 2008'
Manufacturer: 'Microsoft'
Language: 'C++'
Version: '9.0'
Location: 'D:\Program Files (x86)\Microsoft Visual Studio 9.0'
Details: [1x1 mex.compilerConfigurationDetails]
list of methods
How can I fix this issue?

Sign in to comment.

Answers (0)

Categories

Find more on Simulink Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!