I faced an error “No supported compiler or SDK was found.” when I tried to compile mexlised cpp file on MATLAB2015a (Mac 10.10.5).
MATLAB complains as fellow when “mex -setup” command is issued.
“No supported compiler or SDK was found.” which means that either no compiler has been installed on your system or not properly been linked with MATLAB’s mex.
The following link worked for my case and I could successfully compile mexlised cpp files.
And the attached xcode7_mexopts
Hope this save some your time.
Here is a workaround for setting up mex in MATLAB2015a within MacOS Yosemite.
You need to install two software packages: Command Line Tools (CLT) and gfortran.
1. Installation of CLT
Simply download the following and install. (You need Xcode 6.3 or higher as a prerequisite).
2. Installation of gfortlan
go to the following site and download gfortran 5.0
Direct download link for gfortran 5.0
You will have gfortran-5.0-bin.tar in your downloaded folder.
Open terminal console and type the following for gfortran installation
sudo tar -xvf gfortran-5.0-bin.tar -C /.
Note that don’t forget “/.” at the end of the command line.
You will see some log messages copying files into your /usr/local/bin and related folders.
For verification, just type “mex -setup FORTRAN” in MATLAB console. This should show you the following message.
MEX configured to use 'gfortran' for FORTRAN language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:
I got the following error message when compiling a Simulink S-function.
/Applications/MATLAB_R2013a.app/bin/mex: line 305: llvm-gcc-4.2: command not found
The following thread resolves my issue and explain why the error occurs.
1. Open the /Applications/MATLAB_R2013a.app/bin/mexopts.sh file with your favorite editor. (You might need a root permission for this).
2. Change the following:
# CC='xcrun -sdk macosx10.7 clang'
CC='xcrun -sdk macosx10.8 clang'
# MW_SDK_TEMP="find `xcode-select -print-path` -name MacOSX10.7.sdk"
MW_SDK_TEMP="find `xcode-select -print-path` -name MacOSX10.8.sdk"
# CXX='xcrun -sdk macosx10.7 clang++'
CXX='xcrun -sdk macosx10.8 clang++'
You also had to do “mex – setup” from MATLAB console for copying mexopts.sh to your user directory.