- Open MATLAB and execute the following command. MATLAB will prompt to select a compiler, choose an alternate compiler that is installed in the system.
MEX cannot find Fortran Compiler on macOS Monterey with MATLAB R2022a
3 次查看(过去 30 天)
显示 更早的评论
My mac is running MacOS 12.2.1, and I have Xcode 13.1, gfortran 10.2 installed. However, when I tried
>> mex('-v', '-setup', 'Fortran')
I got the following messages:
********
>> Verbose mode is on.
... Looking for compiler 'Intel Fortran Composer XE' ...
... Looking for environment variable 'ONEAPI_ROOT' ...No.
... Looking for environment variable 'ONEAPI_ROOT' ...No.
... Looking for environment variable 'IFORT_COMPILER21' ...No.
... Looking for environment variable 'IFORT_COMPILER20' ...No.
... Looking for environment variable 'IFORT_COMPILER19' ...No.
... Looking for environment variable 'IFORT_COMPILER18' ...No.
... Executing command 'which ifort' ...No.
Did not find installed compiler 'Intel Fortran Composer XE'.
********
It seems MATLAB was looking for ifort rather than gfortran.
To Install Intel® Fortran Compiler Classic for Mac OS*, I downloaded the installer from https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html#fortran
Then I tried to install ifort, however, it didn't work out. After the installation, typing ifort in my terminal command line still showed
$ command not found: ifort
and mex still didn't work.
I'm getting very negative about all these things now, would anybody help me with this?
0 个评论
回答(1 个)
Maneet Kaur Bagga
2023-9-15
Hi Joe,
The error encountered is because MATLAB R2022a does not supports Gfortran for Mac OS. The last release with Gfortran support for Mac OS was R2015a.
To choose an alternate compiler please refer to the following workaround:
mex('-setup', 'Fortran')
Please refer to the following documentation to refer to the Supported and Compatible Compilers:
For a similar error please refer to the following MATLAB Answer:
Hope this helps!
Thank You
Maneet Bagga
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Troubleshooting in MATLAB Compiler SDK 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!