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

LINK error 2019 using MKL FFTW and Matlab on 64-bit Windows XP

david_sallngc_com
731 Views
Hi!

I have unsuccessfully been trying to compile a mexfunction in Matlab using FFTW on a 64-bit OS. It works perfectly on my 32-bit Windows XP computer. I can build either a static or dynamic binary and it works great. For the 32-bit OS, I compile using,

> mex foo.f90 mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libguide40.lib fftw3xf_ms.lib

where I generated the fftw3xf_ms.lib file using Microsoft Visual Studio 2005.

This generated foo.mex32 and it works perfectly. I then went to the 64-bit Windows XP computer and invoked the command,

> mex foo.f90 mkl_em64t mkl_intel_thread.lib mkl_core.lib libguide40.lib fftw3xf_ms.lib

where all of the libraries are located in the em64t\lib MKL directory. This time, however, I get the link error, 2019, where all of the FFTW library calls are unrecognized. I also modified the mex command with the exact path names to each file but this did not work either.

If I compile foo.f90 and comment out the FFTW calls within the code, the executable runs perfectly.

Is there soemthing I am missing going to the 64-bit OS?

Thank you very much for your help.

Sincerely,

David
0 Kudos
4 Replies
Steven_L_Intel1
Employee
731 Views
Please post a few of the linker error messages with the full and complete text. My guess is that either you're linking against 32-bit FFTW libraries or you have some interface declarations that explicitly specify the external name and improperly include a leading underscore decoration.
0 Kudos
david_sallngc_com
731 Views
Please post a few of the linker error messages with the full and complete text. My guess is that either you're linking against 32-bit FFTW libraries or you have some interface declarations that explicitly specify the external name and improperly include a leading underscore decoration.

Hi Steve!

After reading your response, I went and looked more closely how I generated the MKL FFTW library, fftw3xf_ms.lib. I believe that I did indeed create it in 32-bit mode and have corrected that but I still have errors. This is what I have done,

1) Opened a command window from Visual Studio 2005 and envoked the bat file, vcvarsamd64.bat which set the environmental variables for X64 build.

2) cd c:program filesIntelMKL10.0.5.025interfacesfftw3xf

3) Ran the makefile,
nmake libem64t compiler=ms

This last step generated the file, fftw3xf_ms.lib and put it in the directory, c:program filesintelmkl10.0.5.025em64tlib

I then tried to create my mexfunction by invoking the command in the Matlab command window,

> mex foo.f90 'c:program filesintelmkl10.0.5.025em64tlibmkl_em64t.lb' 'c...libmkl_intel_thread.lib' 'c:...libmkl_core.lib' 'c:...liblibguide40.lib' 'c:...libfftw3xf_ms.lib'

Now Im get a lot of link errors such as,

LIBCMT.lib(tidtable.obj) : error LNK2005: _encode_pointer already defined in MSVRCT.lib(MSVCR80.dll)
...
LIBCMT.lib(name1.obj) : error LNK2005: name2 already defined in MSVCRT.lib (name 3)

where name1 = crtheap, fflush, memcpy, ...), name2 = _decode_pointer, _unlock, etc... name3 = MSVCR80.dll, cinitexe.obj, etc...)

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs, use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs, use /NODEFAULTLIB:library
libifcoremd.lib(libifcoremain.obj) : error LNK2019: unresolved external symbol MAIN__ referenced in function main

Am I any closer?!

Thank you very much for your help.

Sincerely,

David
0 Kudos
Steven_L_Intel1
Employee
731 Views
First, you should start your command prompt with Start > Intel Software Development Tools > Intel Fortran Compiler 11.x.xxx > Build environment for appliations running on Intel 64. This gives you access to both Fortran and MSVC.

When you build the libraries, you have to choose which C libraries you're going to use. I recommend explicitly setting this rather than relying on defaults. /MT is a good choice - that's the ifort default. This is why you are getting the conflict errors.


0 Kudos
david_sallngc_com
731 Views
First, you should start your command prompt with Start > Intel Software Development Tools > Intel Fortran Compiler 11.x.xxx > Build environment for appliations running on Intel 64. This gives you access to both Fortran and MSVC.

When you build the libraries, you have to choose which C libraries you're going to use. I recommend explicitly setting this rather than relying on defaults. /MT is a good choice - that's the ifort default. This is why you are getting the conflict errors.



Hi Steve!

Thank you very much for your help.

Sincerely,

David
0 Kudos
Reply