Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

errors building fftw wrapper using makefile

slarkin712
Beginner
969 Views
I'm trying to build fftw2xf library, but I am having problems using the makefile. I've never used a makefile before, so that is probably the issue. I'm using VS2005, so I open up the command prompt through the VS interface (this sets the directory where nmake and cl files are) then I issue the command:
nmake /F makefile libintel64 compiler=ms precision=MKL_SINGLE

I had problems with getting nmake to find the makefile so I just copied all the files in the fftw2xf folder into the VS\\bin folder where nmake.exe is. Then I used the same command again. I get the following result:'
Microsoft Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.

nmake PLAT=win32e clean lib ARCH=intel64 compiler=ms precision=MKL_SING
LE

Microsoft Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.

del /f/q "..\\..\\lib\\intel64\\fftw2xc_ms.lib"
The system cannot find the path specified.
del /f/q obj
Could Not Find C:\\Program Files (x86)\\Microsoft Visual Studio 8\\vc\\b
if not exist obj md obj
nmake fftw_f77.obj fftw_f77_create_plan.obj fftw_f77_destr
fftw_f77_one.obj fftw_f77_threads.obj fftw_f77_threads_init.obj
eads_one.obj fftw2d_f77_create_plan.obj fftw3d_f77_create_plan.obj
.obj fftwnd_f77_create_plan.obj fftwnd_f77_destroy_plan.obj fftwn
j fftwnd_f77_threads.obj fftwnd_f77_threads_one.obj rfftw_f77.obj
create_plan.obj rfftw_f77_destroy_plan.obj rfftw_f77_one.obj rfft
s.obj rfftw_f77_threads_one.obj rfftw2d_f77_create_plan.obj rfftw
e_plan.obj rfftwnd_f77_complex_to_real.obj rfftwnd_f77_create_plan
d_f77_destroy_plan.obj rfftwnd_f77_one_complex_to_real.obj rfftwnd
l_to_complex.obj rfftwnd_f77_real_to_complex.obj rfftwnd_f77_threa
o_real.obj rfftwnd_f77_threads_one_complex_to_real.obj rfftwnd_f77
_real_to_complex.obj rfftwnd_f77_threads_real_to_complex.obj fftw.o
ck_memory_leaks.obj fftw_create_plan.obj fftw_create_plan_specific
estroy_plan.obj fftw_die.obj fftw_export_wisdom.obj fftw_export_w
e.obj fftw_export_wisdom_to_string.obj fftw_forget_wisdom.obj fft
n.obj fftw_free.obj fftw_import_wisdom.obj fftw_import_wisdom_fro
fftw_import_wisdom_from_string.obj fftw_malloc.obj fftw_one.obj f
x_memory_usage.obj fftw_print_plan.obj fftw_sizeof_fftw_real.obj
.obj fftw_threads_init.obj fftw_threads_one.obj fftw2d_create_pla
d_create_plan_specific.obj fftw3d_create_plan.obj fftw3d_create_pl
obj fftwnd.obj fftwnd_create_plan.obj fftwnd_create_plan_specific
_destroy_plan.obj fftwnd_fprint_plan.obj fftwnd_one.obj fftwnd_pr
fftwnd_threads.obj fftwnd_threads_one.obj rfftw.obj rfftw_creat
rfftw_create_plan_specific.obj rfftw_destroy_plan.obj rfftw_execut
j rfftw_fprint_plan.obj rfftw_one.obj rfftw_print_plan.obj rfftw
rfftw_threads_one.obj rfftw2d_create_plan.obj rfftw2d_create_pla
bj rfftw3d_create_plan.obj rfftw3d_create_plan_specific.obj rfftw
o_real.obj rfftwnd_create_plan.obj rfftwnd_create_plan_specific.ob
estroy_plan.obj rfftwnd_fprint_plan.obj rfftwnd_one_complex_to_rea
nd_one_real_to_complex.obj rfftwnd_print_plan.obj rfftwnd_real_to_
rfftwnd_threads_complex_to_real.obj rfftwnd_threads_one_complex_to
fftwnd_threads_one_real_to_complex.obj rfftwnd_threads_real_to_comp
ary clean_obj compiler=ms precision=MKL_SINGLE

Microsoft Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.

set include=..\\..\\include;..\\..\\include\\fftw;%include%
cl /c /MT /DMKL_SINGLE /Foobj\\ wrappers\\fftw_f77.c
NMAKE : fatal error U1077: '.\\cl.EXE' : return code '0xc0000135'
Stop.
NMAKE : fatal error U1077: '.\\nmake.EXE' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '.\\nmake.EXE' : return code '0x2'
Stop.

The cl.EXE error is: "The specified file already has a notification GUID associated with it."

Does anyone know what I'm doing wrong?

Thanks,
Sean
0 Kudos
6 Replies
Dmitry_B_Intel
Employee
969 Views
Hi Sean,

Copying the parts of MKL installation into VS\bin folder was wrong move. In theVS2005 command prompt window you should go to MKL\examples\fftw2xf folder (cd c:\Program Files\...etc...) and run 'nmakelibintel64 compiler=ms precision=MKL_SINGLE' in that folder.

Thanks
Dima
0 Kudos
slarkin712
Beginner
969 Views
Thanks, that did it. I was actually able to build the library by creating a new project in VS2005, but it was quite a bit of work and the .lib that it produced was very large. Now that I got the .lib to build with the makefile, I'm having problems linking to it from my main project. It should be as simple as copying the .lib file into my source code directlory for my VS2005 project. And then add the library name "fftw2xf_ms.lib" as an additional dependency in the project properties. I'm using the original fftw header files. When I try to compile the project I get link errors like this:

error LNK2019: unresolved external symbol rfftwnd_one_real_to_complex referenced in function "struct _array_2d_ * __cdecl Real2DFFT(struct _array_2d_ *)"

Which tells me that the fftw2xf_ms.lib is not being recognized or its functions are not exposed correctly. Is there something else I should be doing to get my project to link to the fftw2xf_ms.lib?
0 Kudos
slarkin712
Beginner
969 Views
I have still been unable to solve the link errors, but I may know why they are occuring. I compiled my main project for win32, as opposed to x64 that I was trying, and the link errors are gone. So most likely the fftw2xf_ms.lib is not being recognized by the linker because it is x86 and not x64. I verified this by setting a linker command to link for x64 when using the makefile to build the fft lib. I get an error saying that the obj files are not for x64. Is there a way I can force the compiler to compile x64 .obj files? I tried setting the PATH environment variable so cl.exe would be called from my Program Files folder(which is the x64 folder) rather than the Program Files (x86) folder. This gave me some error messages as well. Any ideas?
0 Kudos
Dmitry_B_Intel
Employee
969 Views
At the command prompt where you built the fft lib you can issue command 'cl -V' and seethe compiler banner. If it says '... for 80x86' then it is 32-bit compiler of course, and the 32-bit library should be build with 'nmake libia32 ...'. If the compiler says '... for x64' then the 64-bit fftw2 library should be build with 'nmake libintel64 ...'.
Probably it is the environment mess that confuses the tools. VS provides environment setters that do this in a more elaborate way than just setting PATH. For instance, to arrangefor x64 development in a command prompt window one is expected to run "c:\Program Files (x86)\Microsoft Visual Studio \VC\vcvarsall.bat x64".
I hope this helps.
Dima
0 Kudos
slarkin712
Beginner
969 Views
Thanks again Dima. Yesterday I was trying to find exactly what you were describing in regards to the x64 vars.bat file. I couldn't find it in either versions of VS that I have installed. When you mentioned that that was the proper way I searched again. I looked at the vcvarsall.bat file and noticed that one of the options was amd64. I don't have an amd64 processor, but I gave it a try anyway. So I used the vcvarsamd64.bat file inside the ...\VC\bin\amd64 folder and everything compiled for 64-bit(x64). I linked this lib to my x64 project and everything compiles fine now. Why does Microsoft call the folder "amd64" when it's actually x64? It confuses me.
0 Kudos
Dmitry_B_Intel
Employee
969 Views
Hi Sean,

MS uses two names for the same thing. For instance, the 'vcvarsall.bat' file I mentioned contains these lines:

[bash]if /i %1 == amd64     goto amd64
if /i %1 == x64       goto amd64
...

:amd64
if not exist "%~dp0binamd64vcvarsamd64.bat" goto missing
call "%~dp0binamd64vcvarsamd64.bat"
goto :eof
[/bash]

MS VS installation should provide start menu item like 'Microsoft Visual Studio->...->Visual Studio Command Prompt for x64 development' which is supposed to open command window with proper environment.

Thanks
Dima
0 Kudos
Reply