Why do I get an error when trying to build or update a Simulink model: Unable to find or locate an installed compiler with Simulink Coder 8.1 (R2011b)?

29 views (last 30 days)
When trying to update or build my Simulink model I get an error which sais that MATLAB is not able to find or locate an installed compiler. I already executed
mex –setup
and have chosen a compatible compiler. The setup seems to be correct, as no errors are shown.
Afterwards, when I try to launch model update, I get the following code error:
Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks.
Use 'mex -setup' to select a supported C-compiler.
and the model error:
** Error **
When I run
mex.getCompilerConfigurations
or when I try to build my model, I get the following error:
Error using mex.CompilerConfigurationFactory/determineLocation (line 271)
and
Unable to find an installed compiler.
Perl file erred finding compiler location with following message:
Perl lib version (5.8.8) doesn’t match executable version (v5.8.9) at C:\Apps\Perl\5.8.8\lib\/Config.pm line 46.
Compilation failed in require at C:\Apps\Perl\5.8.8\lib\/DynaLoader.pm line 25.
BEGIN failed—compilation aborted at C:\Apps\Perl\5.8.8\lib\/DynaLoader.pm line 25.
[...]
Error in mex.getCompilerConfigurations (line 56)
compConfig = process(ccF);
[snip]

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Sep 2015
This issue is caused by the fact having more than one version of Perl installed, whereas there are environment variables that point to this installation.
MATLAB installs its own Perl version, but there are other third-party tools (e.g. CANoe) that are also shipped with such an installation.
To work around this issue, one option is to remove the mentioned Perl installation. MATLAB does not need it since it installs its own Perl version.
If this is not applicable for you, please follow the steps below to find out, which points apply for you that might cause these troubles.
Remarks:
- Please do not edit your path variables if you do not know whether this affects your system and other peolpe working on this machine. In case check back with your system administrator to get sure.
- You will need administrator privileges on your machine to do some of the suggested workarounds.
1) Remove the Perl installation folder from your system PATH environmet variable. You can get the content of it with the following command in MATLAB:
getenv('PATH')
Please check there for any folders that could contain a Perl installation and remove them. It might already help if you move them down in priority on the path.
2) In addition to that, you can check what all of the environment variables are, both inside MATLAB by running
system( 'set' )
and in DOS command line by running
set
There you might find additional variables, that point to a (non-MATLAB) Perl installtion. Typical names are:
PERLLIB
PERL5LIB
PERL5OPT
PERL5SHELL
Please also remove them or create a startup.m file, which contains the following statement for each undesired variable (exemplary here for PERL5LIB):
setenv('PERL5LIB','');
3) You can check for all versions of Perl by using the "Find Files" tool in MATLAB's "edit" menu. More specifically, search for perl (with any file extension) in the "C:" drive (and others), and include all sub-directories. This should clarify how many versions of Perl are installed, where they are, and what is their relative priority on the path.
If you found some installations, you can temporarily rename these folders to check if these installations affect your system.
*******
If you are still having trouble with simulating or building your model, please contact your local MathWorks Technical Support.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2011b

Community Treasure Hunt

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

Start Hunting!