fftw-3.2.2 with cmake 2.6 linking problem
Lucian Goron
luciangoron at gmail.com
Wed Jan 6 13:48:24 UTC 2010
I use the ubuntu 9.04 jaunty jackalope along with other open source C++
libraries.
Recently I discovered the* fftw-3.2.2* libraries, but trying linking it is
harder then I thought.
Basically, I have to link these libraries *-lfftw3 -lm *but I do not know
how ?
Here is my CMakeLists.txt:
PROJECT (ransac)
cmake_minimum_required(VERSION 2.6)
FIND_PACKAGE(VTK REQUIRED)
IF(NOT VTK_USE_RENDERING)
MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires VTK_USE_RENDERING.")
ENDIF(NOT VTK_USE_RENDERING)
INCLUDE(${VTK_USE_FILE})
SET(CMAKE_CXX_FLAGS "-Wall -Wno-deprecated")
SET(CMAKE_BUILD_TYPE Debug)
INCLUDE_DIRECTORIES (../common/levmar)
LINK_DIRECTORIES (../../common/levmar)
INCLUDE_DIRECTORIES (~/local/DIR/include)
INCLUDE_DIRECTORIES (../common/ann/include)
INCLUDE_DIRECTORIES (../common/ann/lib)
LINK_DIRECTORIES (../../common/ann/lib)
INCLUDE_DIRECTORIES (../common/fftw-3.2.2/.libs)
LINK_DIRECTORIES (../../common/fftw-3.2.2/.libs)
ADD_EXECUTABLE (fftw-test fftw-test.cc
../common/StringTokenizer.cc
../common/CommonANNRoutines.cc
../common/CommonVTKRoutines.cc
../common/CommonIORoutines.cc
../common/Common3DGeomRoutines.cc
../common/CommonTerminalRoutines.cc
../common/ANN-VTK.cc
../common/VTKShapes.cc
../common/CommonPrintRoutines.cc)
TARGET_LINK_LIBRARIES (fftw-test vtkCommon vtkRendering vtkWidgets vtkHybrid
vtkGraphics ANN lapack levmar)
The section of code from* fftw-test.cc* is:
#include "../common/fftw-3.2.2/api/fftw3.h"
...
// points is an <ANNpointArray> with a number of <header.nr_points> 3D
points //
int p = 0;
double *in = (double *) malloc (sizeof(double) * header.nr_points * 3);
// add the the points' coordinates in row major order //
// that means the X values first, then the Y values and at last the Z
values //
for ( int d = 0 ; d < 2; d++ )
for ( int idx = 0 ; idx < header.nr_points; idx++ )
{
in [p] = points[idx][d];
p++;
}
int rank = 3;
fftw_complex *out;
unsigned flags;
// and here is the problem //
fftw_plan forward = fftw_plan_dft_r2c (rank, (const int*) (3 *
header.nr_points), in, out, flags);
fftw_execute (forward);
Finally my bash output is:
goron at lucian:~/work/ransac/build$ make fftw-test
-- Configuring done
-- Generating done
-- Build files have been written to: /home/goron/work/ransac/build
[ 10%] Building CXX object CMakeFiles/fftw-test.dir/fftw-test.cc.o
[ 20%] Building CXX object
CMakeFiles/fftw-test.dir/home/goron/work/common/StringTokenizer.cc.o
[ 30%] Building CXX object
CMakeFiles/fftw-test.dir/home/goron/work/common/CommonANNRoutines.cc.o
[ 40%] Building CXX object
CMakeFiles/fftw-test.dir/home/goron/work/common/CommonVTKRoutines.cc.o
[ 50%] Building CXX object
CMakeFiles/fftw-test.dir/home/goron/work/common/CommonIORoutines.cc.o
[ 60%] Building CXX object
CMakeFiles/fftw-test.dir/home/goron/work/common/Common3DGeomRoutines.cc.o
[ 70%] Building CXX object
CMakeFiles/fftw-test.dir/home/goron/work/common/CommonTerminalRoutines.cc.o
[ 80%] Building CXX object
CMakeFiles/fftw-test.dir/home/goron/work/common/ANN-VTK.cc.o
[ 90%] Building CXX object
CMakeFiles/fftw-test.dir/home/goron/work/common/VTKShapes.cc.o
[100%] Building CXX object
CMakeFiles/fftw-test.dir/home/goron/work/common/CommonPrintRoutines.cc.o
Linking CXX executable fftw-test
CMakeFiles/fftw-test.dir/fftw-test.cc.o: In function `main':
fftw-test.cc:(.text+0x666): undefined reference to `fftw_plan_dft_r2c'
fftw-test.cc:(.text+0x674): undefined reference to `fftw_execute'
collect2: ld returned 1 exit status
make[3]: *** [fftw-test] Error 1
make[2]: *** [CMakeFiles/fftw-test.dir/all] Error 2
make[1]: *** [CMakeFiles/fftw-test.dir/rule] Error 2
make: *** [fftw-test] Error 2
goron at lucian:~/work/ransac/build$
Has somebody encountered this problem before ? *
*
Thank you in advance.*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100106/56ebbba0/attachment.html>
More information about the ubuntu-users
mailing list