Error using mex 'No supported compiler was found' on Mac.

조회 수: 43 (최근 30일)
Hannah West
Hannah West 2019년 7월 8일
편집: Shams Rashid 2024년 4월 27일 0:14
I am trying to run a c++ program in Matlab. To do this I am using mex. I have a mac.
I was trying to get my c++ files to run but that wasn't working so to begin with I have been trying to use this example provided by MATLAB: https://uk.mathworks.com/help/matlab/matlab_external/build-an-executable-mex-file.html
Each time I run the command 'mex timestwo.c' I recieve the same error as when I was trying to get my own programme to run. The error says:
'Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
Error using mex
No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.'
This seems to be a very common problem and I have looked through all the guidance I can find but I am still recieving the same error. I have xcode 10.x and MATLAB 2019a and I have accepted the Xcode licence.
Thank you in advance
  댓글 수: 2
Jan
Jan 2019년 7월 8일
Matlab needs a installed compiler for the compilations. Did you install XCode? If so, which version? What is the output of:
mex -setup
?
Hannah West
Hannah West 2019년 7월 9일
Thanks Jan for the quick response. I am using Xcode Version 10.2.1 (10E1001). The output of 'mex -setup' is the same error I was receiving before.
'Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
Error using mex
No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.'
But I have installed xcode and I have accepted the license.
Thanks
Hannah

댓글을 달려면 로그인하십시오.

답변 (2개)

Jan
Jan 2019년 7월 9일
편집: Jan 2019년 7월 9일
Posting the error message offers new insights. Did you try this already - in a command shell of the operating system:
sudo xcodebuild -license accept
  댓글 수: 5
Richard DeFazio
Richard DeFazio 2021년 7월 1일
Combining these two worked for me. Typing Hannah's second comment:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
followed by Jan's comment:
sudo xcodebuild -license accept
PAUL SERNA TORRE
PAUL SERNA TORRE 2023년 11월 27일
After installing XCode from the App store, I ran the two lines that Richard typed. Then the accelerator and rapid accelerator are running now. I am using Matlab 2023b and my mac version is Ventura 13.5.1.

댓글을 달려면 로그인하십시오.


Shams Rashid
Shams Rashid 2024년 4월 27일 0:11
편집: Shams Rashid 2024년 4월 27일 0:14
I want to post my experience in case anyone else has a similar issue. After updating to macOS Sonoma 14.4.1 from macOS 12.x (yes, not updating sooner is very bad practice!), I found that one of my previously compiled mex files was no longer working. It ran without errors, but the output produced was in the order of 1^10 and incorrect. I updated my Matlab version, then updated Xcode to the latest version, and the mex file would not compile. I then followed the instructions on this page. I ran the commands:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
and then
sudo xcodebuild -license accept
after which the mex file compiled, but it still produced the incorrect output. I finally found a solution in this link:
I followed those instructions and replaced int * with mwIndex * in the C file, compiled it, and then it finally worked and produced the expected output! So I guess the problem had to do with going from a 32-bit system to a 64-bit system. Funny thing is that the 32-bit version of the mex file worked OK on macOS 12.
My computer is a 16-inch 2019 MacBook Pro, Intel processor.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by