- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get the following results:
cd /Applications/MATLAB_R2009b.app/extern/examples/mex
%-----Test Fortran complier-----:
mex yprimef.F yprimefg.F
% Test your *.mexmaci64 file:
yprimef(1,1:4)
% ans = 2 8.9685 4 -1.0947
ans =
2.0000 8.9685 4.0000 -1.0947
ld: library not found for -lgfortranbegin
collect2: ld returned 1 exit status
mex: link of ' "yprimef.mexmaci64"' failed.
??? Error using ==> mex at 221
Unable to complete successfully.
I just noticed I am using 10.6 rather than 10.6.1 - could that be it?
Obviously a library is missing or not in the right place, for one thing.
Thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In more detail:
My problem is that I have been unable to create a Fortran-based mex file in MATLAB because of failure to compile and/or link the source files. I am testing a very simple example (given below).
My setup is:
Hardware: new MaxBook Pro
OS: OS X 10.6.2
Developer software: XCode 3.2
Application: MATLAB R2009b
Fortran Compiler: Intel Professional 11.1 trial copy
Previous compiler: gfortran 4.2.3 from r.research.att.com/tools/
This was my first attempt to create mex files, so initially I installed a version of gfortran and had no success getting it to compile. I edited the mexopt.sh file etc as per various user posts I could find, still no luck. Finally I uninstalled gfortran using the terminal commands and restored the original mexopt.sh file from a backup copy.
Then I obtained a trial copy of Intel Fortran Compiler Professional 11.1 and installed it apparently without problems.
I used the "mex -setup" command from within MATLAB in the command window:
>> mex -setup
Options files control which compiler to use, the compiler and link command
options, and the runtime libraries to link against.
Using the 'mex -setup' command selects an options file that is
placed in ~/.matlab/R2009b and used by default for 'mex'. An options
file in the current working directory or specified on the command line
overrides the default options file in ~/.matlab/R2009b.
To override the default options file, use the 'mex -f' command
(see 'mex -help' for more information).
The options files available for mex are:
1: /Applications/MATLAB_R2009b.app/bin/gccopts.sh :
Template Options file for building gcc MEX-files
2: /Applications/MATLAB_R2009b.app/bin/mexopts.sh :
Template Options file for building MEX-files via the system ANSI compiler
0: Exit with no changes
Enter the number of the compiler (0-2):
I entered "2".
Next I ran this simple test of the compiler:
mex yprimef.F yprimefg.F
yprimef(1,1:4)
which gave the output:
/Applications/MATLAB_R2009b.app/bin/mex: line 997: gfortran: command not found
mex: compile of ' "yprimef.F"' failed.
??? Error using ==> mex at 221
Unable to complete successfully.
Apparently gfortran is still lurking in there somwewhere, or I have failed to point things to the correct directory somwhow, etc.
Any thoughts?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page