Can I use Simulink Accelerator/Rapid Accelerator modes and code generation products on a Mac with Xcode 4.2 or higher?

1 view (last 30 days)
With a fresh install of Mac OS X 10.6 or later and a fresh install of Xcode 4.2 or later I am unable to use the Simulink Accelerator modes or the Code Generation functionality.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Dec 2012
* Description of the issue *
If you use the Simulink accelerator modes or coder functionality, you may see errors like:
1.
When using Simulink Accelerator modes, errors such as:
In file included from /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h:15,
from ../slprj/ert/_sharedutils/rtwtypes.h:24,
from Controller.h:21,
from Controller.c:17:
/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h:15:25: error: no include path in which to search for limits.h
gmake: *** [Controller.o] Error 1
### Build procedure for model: 'Controller' aborted due to an error.
Error using rtwbuild (line 228)
Error(s) encountered while building model "Controller"
2.
When generating code using MATLAB or Simulink Coder, errors such as:
??? Build error: Compilation returned error status code 2. See the target build log in the report for further
details.
Error in ==> hello_world Line: 1 Column: 1 Code generation failed: Open error report.
* Steps to apply the patch *
This bug has been fixed in Release 2012b (R2012b). For previous product releases, read below for any possible workarounds:
In order to utilize the Simulink Accelerator/Coder functionality using Xcode 4.2 or higher, follow the steps below:
1. The general MATLAB Xcode 4.2+ patch must be applied. See the related solution 1-FR6LXJ for detailed steps (link below). The MATLAB version, Mac OS version, and Xcode version requirements in this solution are the same as those specified in 1-FR6LXJ.
Please confirm that the patch was applied correctly before proceeding. In order to do so, you can test by compiling and running a simple MEX file:
Run the code below in the MATLAB command window to copy an example MEX file into the current folder, compile the MEX file and then run it.
system(['cp "' matlabroot '/extern/examples/mex/yprime.c" .'])
pause(5)
mex yprime.c
pause(5)
yprime(1, [1 : 4])
If the above code returns
ans =
2.0000 8.9685 4.0000 -1.0947
then MEX is working properly and the patch was applied correctly. If the above confirmation step fails, please check the troubleshooting guidelines in solution 1-FR6LXJ.
2. After applying the MATLAB Xcode patch in Step 1, download the appropriate Simulink patch for your Simulink version, attached to this solution:
makePatch_R2011a.patch
makePatch_R2011b.patch
makePatch_R2012a.patch
These instructions assume you download it to the default location Safari uses, namely the “Downloads” folder of your home folder.
* NOTE *
A Simulink patch is not required for R2012b.
3. Start MATLAB, if it is not already running.
4. In the MATLAB command window, type:
>> cd(matlabroot)
>> !unzip -o ~/Downloads/makePatch_R2011a.patch
or
>> cd(matlabroot)
>> !unzip -o ~/Downloads/makePatch_R2011b.patch
or
>> cd(matlabroot)
>> !unzip -o ~/Downloads/makePatch_R2012a.patch
depending on the patch downloaded.
5. Restart MATLAB and Simulink.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2011a

Community Treasure Hunt

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

Start Hunting!