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

Mexopts / Mex Function Editing

postaquestion
Novice
749 Views

I'm having a problem running the mex function in Matlab 7.3.0.267 (R2006b) 64-bit with the Intel Visual Fortran Compiler 10.0 for Windows. Could you perhapse provide me with information how I can modify the mexopts file?

Thanks in advance.

0 Kudos
7 Replies
Steven_L_Intel1
Employee
749 Views
I think we need some more information. What exactly is the problem you are having? What does your current mexopts file look like?
0 Kudos
christoph_bauer
Beginner
749 Views

The mexopts file looks like this:

@echo off

rem INTELF10OPTS.BAT

rem

rem Compile and link options used for building MEX-files

rem using the Intel Fortran Cmpiler, Version 9.0

rem

rem $Revision: 1.1.6.4 $ $Date: 2006/06/23 19:04:58 $

rem

rem ********************************************************************

rem General parameters

rem ********************************************************************

set MATLAB=%MATLAB%

set IFORT_COMPILER90=%IFORT_COMPILER90%

set LINKERDIR=%MSSdk%

set PATH=%IFORT_COMPILER90%EM64TBin;%LINKERDIR%BinWin64x86AMD64;%LINKERDIR%Bin;%LINKERDIR%BinWinNT;%PATH%

set INCLUDE=%IFORT_COMPILER90%EM64TInclude;%LINKERDIR%Include;%LINKERDIR%Includecrt;%LINKERDIR%Includecrtsys;%LINKERDIR%Includemfc;%LINKERDIR%Includeatl;%INCLUDE%

set LIB=%IFORT_COMPILER90%EM64TLib;%LINKERDIR%LibAMD64;%LINKERDIR%LibAMD64atlmfc;%LIB%

set MW_TARGET_ARCH=win64

rem ********************************************************************

rem Compiler parameters

rem ********************************************************************

set COMPILER=ifort

set COMPFLAGS=/fpp /Qprec "/I%MATLAB%/extern/include" -c -nologo -DMATLAB_MEX_FILE /fixed

set OPTIMFLAGS=/MD -Ox -DNDEBUG

set DEBUGFLAGS=/MD -Zi

set NAME_OBJECT=/Fo

rem ********************************************************************

rem Linker parameters

rem ********************************************************************

set LIBLOC=%MATLAB%externlibwin64microsoft

set LINKER=link

set LINKFLAGS=/DLL /EXPORT:MEXFUNCTION /MAP /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /implib:%LIB_NAME%.lib /NOLOGO

set LINKOPTIMFLAGS=

set LINKDEBUGFLAGS=/debug

set LINK_FILE=

set LINK_LIB=

set NAME_OUTPUT="/out:%OUTDIR%%MEX_NAME%.mexw64"

set RSP_FILE_INDICATOR=@

rem ********************************************************************

rem Resource compiler parameters

rem ********************************************************************

set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res"

set RC_LINKER=

set POSTLINK_CMDS=del "%OUTDIR%%MEX_NAME%.map"

and I am getting this report

--> "ifort /fpp /Qprec "/IC:PROGRA~3MATLABR2006b/extern/include" -c -nologo -DMATLAB_MEX_FILE /fixed /FoC:DOCUME~1auer2LOCALS~1Tempmex_3E5D61C5-0C37-40D5-58AB-213FD0F36DA8yprimefg.obj /MD -Ox -DNDEBUG -DMX_COMPAT_32 yprimefg.f"

Contents of C:DOCUME~1auer2LOCALS~1Tempmex_3E5D61C5-0C37-40D5-58AB-213FD0F36DA8mex_tmp.rsp:
C:DOCUME~1auer2LOCALS~1Tempmex_3E5D61C5-0C37-40D5-58AB-213FD0F36DA8yprimefg.obj


--> "link "/out:yprimefg.mexw64" /DLL /EXPORT:MEXFUNCTION /MAP /LIBPATH:"C:PROGRA~3MATLABR2006bexternlibwin64microsoft" libmx.lib libmex.lib libmat.lib /implib:C:DOCUME~1auer2LOCALS~1Tempmex_3E5D61C5-0C37-40D5-58AB-213FD0F36DA8 emplib.lib /NOLOGO @C:DOCUME~1auer2LOCALS~1Tempmex_3E5D61C5-0C37-40D5-58AB-213FD0F36DA8mex_tmp.rsp "

Der Befehl "link" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

&n bsp; C:PROGRA~3MATLABR2006BBINMEX.PL: Error: Link of 'yprimefg.mexw64' failed.

0 Kudos
Steven_L_Intel1
Employee
749 Views
If I am translating the German correctly, it is saying that it cannot find "link", probably because the path to it is not set up correctly.

I see:

set LINKERDIR=%MSSdk%

Is the MSSdk environment variable defined?
0 Kudos
christoph_bauer
Beginner
749 Views

You are right, it can not find the linker, but now i have modified the envirioment variable, because there is the xilink linker with fortran, but then it says

xilink: executing 'link'

C:PROGRA~3MATLABR2006BBINMEX.PL: Error: Link of 'yprimefg.mexw64' failed.

0 Kudos
Steven_L_Intel1
Employee
749 Views
Usually there is some other message preceding that one that indicates the real error.
0 Kudos
christoph_bauer
Beginner
749 Views

There is no other message:

--> "ifort /fpp /Qprec "/IC:PROGRA~3MATLABR2006b/extern/include" -c -nologo -DMATLAB_MEX_FILE /fixed /FoC:DOCUME~1auer2LOCALS~1Tempmex_66E4E064-95F3-473D-4291-1FAE70BF1924yprimefg.obj /MD -Ox -DNDEBUG -DMX_COMPAT_32 yprimefg.f"

Contents of C:DOCUME~1auer2LOCALS~1Tempmex_66E4E064-95F3-473D-4291-1FAE70BF1924mex_tmp.rsp:
C:DOCUME~1auer2LOCALS~1Tempmex_66E4E064-95F3-473D-4291-1FAE70BF1924yprimefg.obj


--> "xilink "/out:yprimefg.mexw64" libmx.lib @C:DOCUME~1auer2LOCALS~1Tempmex_66E4E064-95F3-473D-4291-1FAE70BF1924mex_tmp.rsp "

xilink: executing 'link'

C:PROGRA~3MATLABR2006BBINMEX.PL: Error: Link of 'yprimefg.mexw64' failed.

0 Kudos
Steven_L_Intel1
Employee
749 Views
I would try to repeat the xilink command with the .rsp file, from a command prompt. It seems that something is being hidden from you.

Personally, I would recommend against using xilink as the link command. Use ifort to link instead.
0 Kudos
Reply