Problem with mex setup for FORTRAN

6 visualizaciones (últimos 30 días)
Durga Lal Shrestha
Durga Lal Shrestha el 9 de Sept. de 2014
Comentada: Walter Roberson el 26 de Dic. de 2017
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 comentarios
Geoff Hayes
Geoff Hayes el 15 de Sept. de 2014
What happens if you just run mex -setup? Do you see a list of available compilers?
Durga Lal Shrestha
Durga Lal Shrestha el 15 de Sept. de 2014
Editada: Durga Lal Shrestha el 15 de Sept. de 2014
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

Iniciar sesión para comentar.

Respuestas (1)

Geoff Hayes
Geoff Hayes el 16 de Sept. de 2014
Editada: Geoff Hayes el 16 de Sept. de 2014
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 comentarios
Alec Jacobson
Alec Jacobson el 26 de Dic. de 2017
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?

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by