[Insight-users] Insight-users Digest Questions - Problems Building FFTW From Review

Antonio Gómez Barquero agb1 at alu.upct.es
Mon Nov 21 04:14:03 EST 2011


 

Hi Calvin

 

I also had the same problem some months ago, and I solved it making some
changes in the configuration of ‘Visual Studio 2008’, here I tell you the
process:

 

1.       Download the file “fftw-3.3dll32.zip from fftw org website (
<http://www.fftw.org/install/windows.html>
http://www.fftw.org/install/windows.html)

 

2.       In order to link to these .dll files from Visual C++, you need to
create .lib "import libraries" for them, and can do so with the "lib"
command that comes with VC++.  In particular, run:

     lib /def:libfftw3-3.def

     lib /def:libfftw3f-3.def

     lib /def:libfftw3l-3.def

 

In “Tools > Visual Studio 2008 Command Prompt” without opening any project,
just Visual. Once you are in the console, you go with the ‘cd’ command to
the root where the folder is placed and once there you run the three lines
above, and then the ‘lib files are created.

 

3.       Copy the folder where the libs are created and then copy it inside
the project folder where we want to use it and rename the folder to
“FFTW_LIBS”. In this folder the necessary files are the ones that have the
‘*.dll’ , ‘*.lib’ and the ‘fftw3.h’.

 

 

4.       Inclusion of the libs in the project: “Project > Properties >
Configuration Properties > Linker > Entry > Additional dependencies” and
then we include the three new libs files:

 

libfftw3-3.lib 

libfftw3f-3.lib

libfftw3l-3.lib

 

5.       Inclusion of the path where the libs are:

a.       “Project > Properties > Configuration Properties > Linker > General
> Additional libs directory” , and there we write “./FFTW_LIBS”.

b.      “Project > Properties > Configuration Properties > Depuration >
Environment” , and there we write “./FFTW_LIBS”.

 

6.       Inclusion of the path where the ‘.dll’ file is. In “Project >
Properties > Configuration Properties > Depuration > Environment”. In the
variable ‘enviroment’ we have to specify where the file ‘libfftw3-3.dll’ and
we write “PATH = .\FFTW_LIBS”

 

After all of this steps, you just have to add “ #include fftw3.h” and use
the fftw functions!

My visual Studio is in Spanish, so sorry if any of the word is not perfect
translated.

 

Hope it helps!

 

Antonio Gómez Barquero

 

 

 

 

De: insight-users-bounces at itk.org [mailto:insight-users-bounces at itk.org] En
nombre de Calvin Lefebvre
Enviado el: viernes, 18 de noviembre de 2011 19:07
Para: insight-users at itk.org
Asunto: [Insight-users] Insight-users Digest Questions - Problems Building
FFTW From Review

 

Hi Insight-users,

 

I am currently trying to use FFTW from the "Review" directory option but I
am having a great deal of difficulty and I would appreciate any help.

 

Attempt1

 

Step 1

 

I download the windows version for FFTW dll files from
http://www.fftw.org/install/windows.html and used lib.exe to create the .lib
(import libraries). So now I have the following new three lib files:

 

libfftw3-3.lib

libfftw3f-3.lib

libfftw3l-3.lib

 

Step 2

 

I then modified the CMakelist for compiling the ITK by adding 


SET(CMAKE_MODULE_PATH ${ITK_SOURCE_DIR}/CMake) 
OPTION(USE_FFTWD "Use double precision FFTW if found" ON) 
OPTION(USE_FFTWF "Use single precision FFTW if found" ON) 
FIND_PACKAGE( FFTW ) 

IF(USE_FFTWF) 
    LINK_LIBRARIES(${FFTWF_LIB}) 
ENDIF(USE_FFTWF) 

IF(USE_FFTWD) 
    LINK_LIBRARIES(${FFTWD_LIB}) 
ENDIF(USE_FFTWD)

 

Step 3

 

Next I configure ITK in CMake. I set ITK_USE_REVIEW, USE_FFTWD and USE_FFTWF
to "On". I get the following error

 

CMake Error: The following variables are used in this project, but they are
set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake
files:

FFTWD_LIB (ADVANCED)

linked by target "ITKAlgorithms" in directory
C:/Users/clefebvr/Desktop/InsightToolkit-3.20.1/Code/Algorithms

FFTWF_LIB (ADVANCED)

linked by target "ITKAlgorithms" in directory
C:/Users/clefebvr/Desktop/InsightToolkit-3.20.1/Code/Algorithms

FFTW_INCLUDE_PATH

...

 

So, in CMake it mentions that it cannot find FFTWD_LIB, FFTWD_THREADS_LIB,
FFTWF_LIB, FFTWF_THREADS_LIB and FTTW_INCLUDE_PATH. So I set the path
in CMake          as the following

 

FFTWD_LIB, FFTWD_THREADS_LIB to libfftw3-3.lib

FFTWF_LIB, FFTWF_THREADS_LIB to libfftw3f-3.lib

FTTW_INCLUDE_PATH to directory of fftw3.h

 

I configured and generated in CMake without any errors and there was no
problem building ITK in visual studios 2008. When I try and build my own
project with itkFFTWComplexToComplexImageFilter.h                  I get I
get several errors that are similar to the following

 

itkGaborImageSourceTest.obj : error LNK2019: unresolved external symbol
__imp_fftwf_destroy_plan referenced in function "protected: virtual __cdecl
itk::FFTWComplexToComplexImageFilter<float,2>::~FFTWComplexToComplexImageFil
ter<float,2>(void)" (??1?$FFTWComplexToComplexImageFilter at M$01 at itk@@MEAA at XZ)

 

Attempt 2

 

I also tried a different modification to the CMakelist file for the ITK
configuration by adding 

 

SET(CMAKE_MODULE_PATH ${ITK_SOURCE_DIR}/CMake)

option(USE_FFTWD "Use double precision fftw if found" ON)

option(USE_FFTWF "Use single precision fftw if found" ON)

option(USE_SYSTEM_FFTW "Use an installed version of fftw" OFF)

if (USE_FFTWD OR USE_FFTWF)

        if(USE_SYSTEM_FFTW)

       find_package( FFTW )

       link_directories(${FFTW_LIBDIR})

        else(USE_SYSTEM_FFTW)

       link_directories(${ITK_DIR}/fftw/lib)

       include_directories(${ITK_DIR}/fftw/include)

        endif(USE_SYSTEM_FFTW)

endif(USE_FFTWD OR USE_FFTWF)

 

It did not show any FFTWD_LIB, FFTWD_THREADS_LIB, FFTWF_LIB,
FFTWF_THREADS_LIB and FTTW_INCLUDE_PATH errors in CMake. Regardless I
continued and no errors occurred generating in CMake, and building ITK in
visual studio. Again, when I tried to build my project with
itkFFTWComplexToComplexImageFilter.h from the Review folder I get several
errors that are similar to the following

 

itkGaborImageSourceTest.obj : error LNK2019: unresolved external symbol
__imp_fftwf_destroy_plan referenced in function "protected: virtual __cdecl
itk::FFTWComplexToComplexImageFilter<float,2>::~FFTWComplexToComplexImageFil
ter<float,2>(void)" (??1?$FFTWComplexToComplexImageFilter at M$01 at itk@@MEAA at XZ)

 

 

I compiled CMake with the Visual Studios 2008 64 bit option.

 

Thanks for the help,

 

Calvin

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111121/1ad33391/attachment.htm>


More information about the Insight-users mailing list