Error using mex on Catalina: "xcodebuild: error: SDK "macosx10.15.4" cannot be located"

9 Ansichten (letzte 30 Tage)
After upgrading to MacOS Catalina, I am getting the following error when using the "mex" command:
Error using mexxcodebuild: error: SDK "macosx10.15.4" cannot be located.xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx10.15.4 -find clang 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory)xcrun: error: unable to find utility "clang", not a developer tool or in PATH
What is the cause of this error and how can I fix it?
 

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 12 Mai 2020
Bearbeitet: MathWorks Support Team am 24 Nov. 2020
This is due to an issue where when the "mexopts" files query the SDK version, "macosx10.15.4" is returned when the name of the SDK is actually just "macosx10.15" (major and minor version, no patch number).
In order to work around this, run the following in MATLAB:
>> cd(prefdir)
>> mex -setup % or mex -setup C++
Find the XML files in the Current Folder called "mex_C_maci64.xml" and/or "mex_C++_maci64.xml". Then change the following line:
<SDKVER>  <cmdReturns name="xcrun -sdk macosx --show-sdk-version"/>
</SDKVER>
to 
<SDKVER>
<cmdReturns name="xcrun -sdk macosx --show-sdk-version | awk 'BEGIN {FS=&quot;.&quot;} ; {print $1&quot;.&quot;$2}'"/>
</SDKVER>
Now MATLAB will be able to find the correct SDK. It may require a restart of MATLAB or of the computer.
Please see the following External Bug Report (EBR) for more details:

Weitere Antworten (0)

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by