Problem with mex setup for FORTRAN
5 次查看(过去 30 天)
显示 更早的评论
I got a error message with
mex -setup FORTRAN.
Error using mex No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2014a/win64.
I am using MATLAB R2014a in Windows 64 bit. I have Intel Visual Fortran Composer XE 2013 in Microsoft Visual Studio 2010 Shell and in Microsoft Visual Studio 2008 Professional Edition.
I tried with C language and do not have any problem.
Thanks. Durga
4 个评论
Geoff Hayes
2014-9-15
What happens if you just run mex -setup? Do you see a list of available compilers?
回答(1 个)
Geoff Hayes
2014-9-16
编辑:Geoff Hayes
2014-9-16
Durga - This is more of a Fortran for Mac answer, but as the behaviour is like yours, I think that you will have to do something similar.
I downloaded the Fortran compiler for my Mac (GNU gfortan), installed the package, ran
mex -setup FORTRAN
and observed a similar error as you
Error using mex
No supported compiler or SDK was found. For options, visit
http://www.mathworks.com/support/compilers/R2014a/maci64.
Running the same with verbose mode enabled I observed
>> mex -setup -v FORTRAN
Verbose mode is on.
... Looking for compiler 'gfortran' ...
... 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 'gfortran -print-file-name=libgfortran.dylib' ...No.
Did not find installed compiler 'gfortran'.
Error using mex
No supported compiler or SDK was found. For options, visit
http://www.mathworks.com/support/compilers/R2014a/maci64.
So the setup runs the command which gfortran. This is not the MATLAB function which but the UNIX version to locate the executable (MATLAB is probably executing system('which gfortran') to find it). The UNIX which uses the PATH environment variable to find the file it is looking for. This suggests that I have to update the PATH variable with the path to gfortran.
If I update the PATH environment variable
setenv('PATH', [getenv('PATH') ':/usr/local/gfortran/bin']);
and then re-run the setup, I observe
>> mex -setup -v FORTRAN
Verbose mode is on.
... Looking for compiler 'gfortran' ...
... Executing command 'which gfortran' ...Yes ('/usr/local/gfortran/bin/gfortran').
<etc.>
Found installed compiler 'gfortran'.
Copied options file from '/Applications/MATLAB_R2014a.app/bin/maci64/mexopts/gfortran.xml' to
'/Users/geoff/.matlab/R2014a/mex_FORTRAN_maci64.xml'.
MEX configured to use 'gfortran' for FORTRAN language compilation.
The above is not ideal because I have to run the setenv('PATH', [getenv('PATH') ':/usr/local/gfortran/bin']); command, so an alternative to this (that updates the PATH once) needs to be found.
So you should try the same - re-run the mex setup with verbose mode enabled and observe the output. You may need to update a similar PATH environment variable with the location of your Fortran compiler executable.
5 个评论
Alec Jacobson
2017-12-26
I'm on Mac but after issuing
mex -setup -v FORTRAN
I only see
Verbose mode is on.
... Looking for compiler 'Intel Fortran Composer XE' ...
... 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 Composer XE'.
And changing the PATH variable did not help. Any suggestions?
Walter Roberson
2017-12-26
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!