Problem with mex setup for FORTRAN

22 ビュー (過去 30 日間)
Durga Lal Shrestha
Durga Lal Shrestha 2014 年 9 月 9 日
コメント済み: Walter Roberson 2017 年 12 月 26 日
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
Geoff Hayes 2014 年 9 月 15 日
What happens if you just run mex -setup? Do you see a list of available compilers?
Durga Lal Shrestha
Durga Lal Shrestha 2014 年 9 月 15 日
編集済み: Durga Lal Shrestha 2014 年 9 月 15 日
This is what I got with
mex -setup
MEX configured to use 'Microsoft Visual C++ 2008 (C)' for C language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN

サインインしてコメントする。

回答 (1 件)

Geoff Hayes
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
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
Walter Roberson 2017 年 12 月 26 日

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by