- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Fellow developpers,
I' m currently trying to use fortran source code in the Matlab software using the mex tool.
I'm working on linux, using fedora 15, the 32bits OS.
The mex configuration file, mexopts.sh, has the following contents:
FC='ifort'
FFLAGS='-fexceptions'
FFLAGS="$FFLAGS -fPIC"
FLIBS="$RPATH $MLIBS -lm"
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
LD="$COMPILER"
LDEXTENSION='.mexglx'
LDFLAGS="-shared -m32 -Wl,--version-script,$TMW_ROOT/extern/lib/$Arch/$MAPFILE -Wl,--no-undefined"
LDOPTIMFLAGS='-O'
LDDEBUGFLAGS='-g'
POSTLINK_CMDS=':'
I tried to compile the "timestwo.F" example located in "/opt/Matlab/extern/examples/refbook".
I successfully manage to create *.mexglx file.
The problem occures when I try to use to fortran command in Matlab.
I have the following error message:
>>timestwo(2)
??? Invalid MEX-file '/home/Lopez/CFD/SPARTAN/mex/timestwo.mexglx':
/opt/Matlab/bin/glnx86/../../sys/os/glnx86/libifport.so.5: undefined symbol:
__FFresetseed.
Everything go fine is I use the gfortran compiler instead of ifort in the mexopts.sh file (FC='gfortran') and I have the following results:
>> timestwo(2)
ans =
4
Did I misted something with the ifort compiler ?
Thanks.
I' m currently trying to use fortran source code in the Matlab software using the mex tool.
I'm working on linux, using fedora 15, the 32bits OS.
The mex configuration file, mexopts.sh, has the following contents:
FC='ifort'
FFLAGS='-fexceptions'
FFLAGS="$FFLAGS -fPIC"
FLIBS="$RPATH $MLIBS -lm"
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
LD="$COMPILER"
LDEXTENSION='.mexglx'
LDFLAGS="-shared -m32 -Wl,--version-script,$TMW_ROOT/extern/lib/$Arch/$MAPFILE -Wl,--no-undefined"
LDOPTIMFLAGS='-O'
LDDEBUGFLAGS='-g'
POSTLINK_CMDS=':'
I tried to compile the "timestwo.F" example located in "/opt/Matlab/extern/examples/refbook".
I successfully manage to create *.mexglx file.
The problem occures when I try to use to fortran command in Matlab.
I have the following error message:
>>timestwo(2)
??? Invalid MEX-file '/home/Lopez/CFD/SPARTAN/mex/timestwo.mexglx':
/opt/Matlab/bin/glnx86/../../sys/os/glnx86/libifport.so.5: undefined symbol:
__FFresetseed.
Everything go fine is I use the gfortran compiler instead of ifort in the mexopts.sh file (FC='gfortran') and I have the following results:
>> timestwo(2)
ans =
4
Did I misted something with the ifort compiler ?
Thanks.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MATLAB only supports specific versions of the Intel compiler (often older versions only). You should check their website and your MATLAB documents for required IFORT version(s).
To get older compilers (often needed for MATLAB), read this: http://software.intel.com/en-us/articles/older-version-product/
I'm no MATLAB expert, but just looking at the error looks like MATLAB is picking up library ifcore.so.5 from a matlab directory and NOT the Intel compiler library directory. 'libifcore' is the Intel Fortran runtime library. It looks like MATLAB packaged one with their kit. HOWEVER, their version may be from the 11.1 compiler or older. Again, what version of the Intel compiler are you using and is it supported by Mathworks? You cannot mix and match versions.
On thing to try is to make sure the Intel library path to the compiler comes BEFORE the MATLAB path. Try this before running matlab
source /opt/intel/bin/compilervarsh.sh intel64
this is for the 12.x compilers. In the 11.1 compilers you source '/bin/ifortvars.sh intel64'
Again, the key is to find your version of MATLAB, consult your MATLAB requirements doc(s) or README(s) to find out what version of the Intel compiler is supported, and get that version of the Intel compiler.
ron
To get older compilers (often needed for MATLAB), read this: http://software.intel.com/en-us/articles/older-version-product/
I'm no MATLAB expert, but just looking at the error looks like MATLAB is picking up library ifcore.so.5 from a matlab directory and NOT the Intel compiler library directory. 'libifcore' is the Intel Fortran runtime library. It looks like MATLAB packaged one with their kit. HOWEVER, their version may be from the 11.1 compiler or older. Again, what version of the Intel compiler are you using and is it supported by Mathworks? You cannot mix and match versions.
On thing to try is to make sure the Intel library path to the compiler comes BEFORE the MATLAB path. Try this before running matlab
source /opt/intel/bin/compilervarsh.sh intel64
this is for the 12.x compilers. In the 11.1 compilers you source '
Again, the key is to find your version of MATLAB, consult your MATLAB requirements doc(s) or README(s) to find out what version of the Intel compiler is supported, and get that version of the Intel compiler.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> On thing to try is to make sure the Intel library path to the compiler comes BEFORE the MATLAB path.
Not always. If the user has DLLs that came with Matlab and were compiled with an older version of Intel Fortran, those DLLs will contain references to the runtime DLLs of that old version. Resolving them with identically named entry points in a newer Intel Fortran DLL may cause problems. It is tricky to combine runtime libraries from two different versions of Intel Fortran into the same MEX executable.
Not always. If the user has DLLs that came with Matlab and were compiled with an older version of Intel Fortran, those DLLs will contain references to the runtime DLLs of that old version. Resolving them with identically named entry points in a newer Intel Fortran DLL may cause problems. It is tricky to combine runtime libraries from two different versions of Intel Fortran into the same MEX executable.

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