Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
david.sallngc.com
July 2, 2009 9:26 AM PDT
LINK error 2019 using MKL FFTW and Matlab on 64-bit Windows XP
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
Steve Lionel (Intel)
Total Points:
114,605
Status Points:
114,605
Black Belt
July 2, 2009 11:09 AM PDT
Rate
 
#1
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.



david.sallngc.com
July 2, 2009 2:09 PM PDT
Rate
 
#2 Reply to #1
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 files\Intel\MKL\10.0.5.025\interfaces\fftw3xf

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 files\intel\mkl\10.0.5.025\em64t\lib

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

> mex foo.f90 'c:\program files\intel\mkl\10.0.5.025\em64t\lib\mkl_em64t.lb' 'c\...\lib\mkl_intel_thread.lib' 'c:\...\lib\mkl_core.lib' 'c:\...\lib\libguide40.lib' 'c:\...\lib\fftw3xf_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

Steve Lionel (Intel)
Total Points:
114,605
Status Points:
114,605
Black Belt
July 2, 2009 4:52 PM PDT
Rate
 
#3 Reply to #2
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.





david.sallngc.com
July 2, 2009 8:25 PM PDT
Rate
 
#4 Reply to #3
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




Intel Software Network Forums Statistics

8445 users have contributed to 31553 threads and 100398 posts to date.
In the past 24 hours, we have 10 new thread(s) 30 new posts(s), and 43 new user(s).

In the past 3 days, the most popular thread for everyone has been Lost in MKL The most posts were made to TBB on linux segfaulting The post with the most views is Hi,if you were using imsl yo

Please welcome our newest member nonamez