Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29246 Discussions

problems compiling Fortran on Snow Leopard

Kevin_Johnson
Beginner
903 Views
After installing Intel Fortran Compiler Professional Edition for Mac OS* X 11.1 on a new MacBook Pro running 10.6 with XCode 3.2,
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
0 Kudos
4 Replies
TimP
Honored Contributor III
903 Views
A command line argument -lgfortranbegin would work only with an old version of gfortran, but would conflict with ifort, which is the topic of this forum. I don't know what you mean by 10.6 or 10.6.1.
0 Kudos
Kevin_Johnson
Beginner
903 Views
Quoting - tim18
A command line argument -lgfortranbegin would work only with an old version of gfortran, but would conflict with ifort, which is the topic of this forum. I don't know what you mean by 10.6 or 10.6.1.


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

0 Kudos
Kevin_Johnson
Beginner
903 Views
I should add that when installing the Intel compiler, I selected the trial button in the GUI, and was never asked at any point for the license which they had sent me separately (though it was in a folder on my Desktop). I presume the compiler t found it but I'm not sure how. Anyway tis would be separate from the gfortran problem, no?
0 Kudos
Kevin_Johnson
Beginner
903 Views
Also, shouldn't the Intel compiler show up as a choice under the MATLAB "mex -setup" command?



0 Kudos
Reply