How to setup gfortran on Mac OSX 10.9 and MatLab R2014a?

4 ビュー (過去 30 日間)
Nathan
Nathan 2014 年 4 月 5 日
コメント済み: Stephen Shank 2014 年 9 月 7 日
MatLab 2014a Mac OSX 10.9.2 Maverick Mex gfortran configuration
I'm trying to configure using mex -setup FORTRAN and I'm getting the message:
mex -setup FORTRAN Error using mex No supported compiler or SDK was found.
But I have gfortran 4.6.4 installed via fink. The website says that 4.3.x is supported, but isn't gfortran backward compatible in their revisions; therefore, 4.6.4 or even 4.8.2 (the latest for OSX 10.9 as of this posting) should work right? How does one set the fortran compiler options?
Is it best to finesse things with a higher version of gfortran or to install the exact version in the MatLab compatibility chart calls for? Why did the C and C++ portions of the gcc package work just fine and not the gfortran? What happened to the MEXOPTS.sh file in R2014a?
  4 件のコメント
Stephen Shank
Stephen Shank 2014 年 5 月 7 日
編集済み: Stephen Shank 2014 年 5 月 7 日
Any comment on the backward compatibility question of gfortran? I installed gcc4.3 via MacPorts which gave me "gfortran-mp-4.3." I showed mex where this was located (using the link below). The timesTwo.F example compiles and can be invoked from the MATLAB command line. However, the yprime.F example compiles but unfortunately crashes MATLAB when invoked. It would be nice to be able to use the latest available binary from the gfortran binaries page. But when I try this, I get the following error:
Error using mex Undefined symbols for architecture x86_64: "_mexfunction_", referenced from: -exported_symbol[s_list] command line option ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
and am not sure how to proceed...
Stephen Shank
Stephen Shank 2014 年 9 月 7 日
Well, this is embarrassing... but fortunately I resolved the issue above. Turns out the Fortran yprime examples are dependent on TWO files. So running
mex -v yprimef.F yprimefg.F
did the trick. I cannot read Fortran but need to get some code compiled, so I hope this comment will be useful to someone in a similar situation.

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

採用された回答

Ken Atwell
Ken Atwell 2014 年 4 月 7 日
Try:
>> mex -v <filename.f>
This will give you verbose output that should help pinpoint why MEX can't find gfortan. Copy and paste the full output into this Answer.
  5 件のコメント
Ken Atwell
Ken Atwell 2014 年 4 月 9 日
編集済み: Ken Atwell 2014 年 4 月 10 日
See http://www.mathworks.com/matlabcentral/answers/116922-mex-cannot-find-gfortran-compiler-mac-os for the situation where the Terminal window can "find" gfortran, but MEX cannot.
Nathan
Nathan 2014 年 4 月 9 日
@ Ken,
Thanks a million for your posts! After following the suggestions in the link directly above I was able to add the path to the startup.m file and finish following the example above with success.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by