MEX cannot find a supported compiler in MATLAB R2015b after I upgraded to Xcode 8.0

I installed Xcode 8.0 on my Mac and tried to use MEX. But I received the following error at the MATLAB command prompt. Please help, thanks.
>> mex -setup
Error using mex
No supported compiler or SDK was found. For options, visit

 Réponse acceptée

Go to the folder /Applications/MATLAB_R2015b.app/bin/maci64/mexopts and edit the files clang++_maci64.xml and clang_maci64.xml . In both of those files, search for lines containing the string MacOSX10.10.sdk or MacOSX10.11.sdk . Duplicate the line and change it to MacOSX10.12.sdk . You will need to change 4 lines total in each of the two files, a line that mentions dirExists then a line that mentions cmdReturns and then the same two again.
Now, go into either Applications or LaunchPad and find your XCode icon, and launch it. You will need to agree to the license terms. If XCode launches without presenting the license terms dialog then you have already agreed for that version and do not need to repeat it.
The edits and the license agreement having been done, you should now be able to go into MATLAB and use
mex -setup C
mex -setup C++

14 commentaires

Fortunately I had gone through this just a couple of days earlier and the relevant location was still in my shell history.
Nice, my problem has been solved! Thanks a lot!~
Error using mex
In file included from clandmark/matlab_interface/flandmark_interface_mex.cpp:15:
In file included from ../libclandmark/Flandmark.h:14:
In file included from ../libclandmark/CLandmark.h:14:
In file included from ../libclandmark/CAppearanceModel.h:15:
In file included from ../libclandmark/CLoss.h:15:
../libclandmark/CTypes.h:17:10: fatal error: 'CLandmarkConfig.h' file not found
#include "CLandmarkConfig.h"
^
1 error generated.
Error in compile_mex (line 37)
eval(['mex -v -O -largeArrayDims flandmark_interface_mex.cpp ' include
libclandmark ' -output ./mex/flandmark_interface']);
But I have the header file in
$ ls /usr/local/include/CLandmarkConfig.h
/usr/local/include/CLandmarkConfig.h
Any idea how to fix it? Thanks.
I would need to see more about compile_mex to say how to do it properly. Generally speaking at some point you need to add -I/usr/local/include to the variable given the name include there.
You saved me Walter, thanks !
I've tried to do this but it keeps telling me I don't have permissions to change these files, or even save in this directory. I ls -l and I should have write permissions, and I tried chmod 777 but am not permitted to change permissions. It seems like a matlab thing and not a user permissions issue. Recommendations? (Matlab 2015b; Xcode 8.2.1, MacOS 10.11.6)
If you are comfortable with an editor such as vi then you can use the terminal application to sudo to edit the files
I did try using sudo and replaced those lines but it didn't work. I also tried installing Xcode 7.3.1 instead of 8 b/c there seems to be a problem with 8 and OS10.11, but I still can't get it to work (I made sure that in the mexopts files it says 10.11, which is sdk I do have). I have a feeling there are path issues, but I'm not sure where to look/check/update. e.g. https://www.mathworks.com/matlabcentral/answers/246507-why-can-t-mex-find-a-supported-compiler-in-matlab-r2015b-after-i-upgraded-to-xcode-7-0#answer_194526 suggests copying sdks to /Library/Developer/CommandLineTools/Platforms but my /Library/Developer/CommandLineTools folder doesn't have a Platforms subdirectory.
I installed Xcode 8.2.1 (the newest) on OS-X El Capitan (10.11.6). I ran XCode in order to go through its software license agreement. I started up Terminal, and did
cd /Applications/MATLAB_R2015b.app/bin/maci64/mexopts
sudo ksh
I used the vi editor to modify clang++_maci64.xml and clang_maci64.xml to include references to 10.11 and 10.12 . The files are set to readonly, so I told vi to force writing to them.
Then I went into MATLAB and told it to
mex -setup C
mex -setup C++
Looking at the output of mex -v -setup C I can see that it is the 10.12 references that it matched against.
I have attached the two files. Unzip this into a convenient directory, and copy the two enclosed files into /Applications/MATLAB_R2015b.app/bin/maci64/mexopts (which will require that you sudo or otherwise authenticate)
Thanks a lot!It is really helpful! ^-^
Works also for later versions of XCode (10) and MacOSX (Mojave).
Thanks a million.
The solution from Walter worked for me too. Thanks!
I changed "10.12" references to my current SDK version "13.3" (4 instances in each clang++_maci64.xml and clang_maci64.xml) and "No supported compiler or SDK was found" issue was resolved
Ventura 13.4, Xcode 14.3.1

Connectez-vous pour commenter.

Plus de réponses (4)

I followed the above steps.I could see MacOSX10.12.sdk already there. but still i am not able to figure out the problem
OS:MACOS i am using Xcode_beta,MATLAB2016b..
>> mex -setup C Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
Error using mex No supported compiler or SDK was found.
Can anyone please help me regarding this where i am going wrong ?

1 commentaire

Go into Launcher, click on XCode. Or find it in Applications and double-click it. When it starts up it will ask you to confirm that you accept the license. Once you accept it, mex will work.

Connectez-vous pour commenter.

Walter Roberson's answers have solved my problems perfectly. Thanks so much.
I installed Xcode 11.3.1 on my Mac (OS Catalina 10.15.5) and tried to use MEX. I followed Walter's steps above, but I am still getting the following error:
Error using mex
No supported compiler was found. For options, visit
https://www.mathworks.com/support/compilers.
Please help. Thanks in advance.

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by