Clear Filters
Clear Filters

Matlab 2016a mac - gfortran and intel compilers

6 views (last 30 days)
Hello
I have managed to get mex (2016a) working with mac sierra and the latest xcode (clang) using the instructions given elsewhere on this list. However I couldn't do the same for gfortran and the latest intel compilers (icc and ifort 17) even after modifying the xml files to accommodate the same changes made in the clang files. Here is the output of the command "mex -v -setup FORTRAN".
>> mex -v -setup FORTRAN
Verbose mode is on.
... Looking for compiler 'gfortran' ...
... Looking for environment variable 'DEVELOPER_DIR' ...No.
... Executing command 'which gfortran' ...No.
... Looking for file '/usr/local/bin/gfortran' ...Yes.
... Looking for folder '/usr/local/bin' ...Yes.
... Executing command 'which gfortran' ...No.
... Looking for file '/usr/local/bin/gfortran' ...Yes.
... Executing command '/usr/local/bin/gfortran -print-file-name=libgfortran.dylib' ...Yes ('/usr/local/Cellar/gcc/6.1.0_1/lib/gcc/6/libgfortran.dylib').
... Looking for folder '/usr/local/Cellar/gcc/6.1.0_1/lib/gcc/6' ...Yes.
... Executing command 'which gfortran' ...No.
... Looking for file '/usr/local/bin/gfortran' ...Yes.
... Executing command '/usr/local/bin/gfortran -print-file-name=libgfortranbegin.a' ...Yes ('libgfortranbegin.a').
... Looking for folder 'libgfortranbegin.a' ...No.
Did not find installed compiler 'gfortran'.
... Looking for compiler 'Intel Fortran' ...
... Looking for environment variable 'IFORT_COMPILER17' ...No.
... Looking for environment variable 'IFORT_COMPILER16' ...No.
... Looking for environment variable 'IFORT_COMPILER15' ...No.
... Looking for environment variable 'IFORT_COMPILER14' ...No.
... Looking for environment variable 'IFORT_COMPILER13' ...No.
... Executing command 'which ifort' ...No.
Did not find installed compiler 'Intel Fortran'.
Error using mex
No supported compiler or SDK was found. For options, visit
http://www.mathworks.com/support/compilers/R2016a/maci64.html.
Note that, on a terminal, the command "which ifort" returns "/usr/local/bin/ifort" and "ifort --version" returns "ifort (IFORT) 17.0.4 20170411".
I know that the above compilers (gfortran 6, ifort and icc 17) are not supported but I wonder whether someone out there got them working somehow.
Many thanks
Ed

Answers (1)

Walter Roberson
Walter Roberson on 24 Jul 2017
Before you run the mex setup, use
setenv('PATH', [getenv('PATH') ':/usr/local/bin'] )
  4 Comments
Ed Mendes
Ed Mendes on 2 Mar 2020
If you do not have sudo installed in your system, you can log in as root and issue a command that allows matlab to find the compiler.
Walter Roberson
Walter Roberson on 2 Mar 2020
The sudo would have to be typed in the Terminal app that you can find in the Utilities folder of Applications
Alternately, inside MATLAB you could use
!sudo ln -s /opt/intel /opt/intel/compiler
The ! tells MATLAB to send the command to your login shell.

Sign in to comment.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!