discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] FFTW3 runtime error


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] FFTW3 runtime error
Date: Tue, 04 Mar 2014 11:02:08 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry, forgot to mention: additionally to the solution in my answer to
Sabathy,
add ${FFTW3(F)_LIBRARIES} to your lib/CMakeLists.txt
target_link_libraries, also add: link_directories(${FFTW3F_LIBRARY_DIRS})

Greetings,
Marcus

On 04.03.2014 10:59, Marcus Müller wrote:
> Hi Activecat,
> 
> your sourcecode should be fine - what you see is an error that
> tells you that at runtime, a symbol could not be found. This means
> that the fftw library has not been linked against. On 2014-02-26
> there was a thread on discuss-gnuradio with the subject "Link FFTW3
> in OOT module" featuring Sabathy Mischa and me, could you please
> look into the mailing list archive; the solution to your problem
> should be there :)
> 
> Happy hacking, Marcus
> 
> On 04.03.2014 07:27, Activecat wrote:
>> The implementation header file is as below:
> 
> 
>> #ifndef INCLUDED_ACTIVECAT_FFT1_IMPL_H #define 
>> INCLUDED_ACTIVECAT_FFT1_IMPL_H
> 
>> #include <activecat/fft1.h> #include <fftw3.h>
> 
>> namespace gr { namespace activecat {
> 
>> class fft1_impl : public fft1 { private: int d_N; int
>> d_direction; int d_shift;
> 
>> fftw_complex *d_input; fftw_plan     d_plan;
> 
>> public: fft1_impl(int fft_size, int direction, bool fft_shift); 
>> ~fft1_impl();
> 
>> int work( int noutput_items, gr_vector_const_void_star 
>> &input_items, gr_vector_void_star &output_items); };
> 
>> } // namespace activecat } // namespace gr
> 
>> #endif /* INCLUDED_ACTIVECAT_FFT1_IMPL_H */
> 
> 
> 
>> On Tue, Mar 4, 2014 at 1:55 PM, Activecat <address@hidden> 
>> wrote:
> 
>>> Dear Sir,
>>> 
>>> I am trying to build a custom block with FFT capability. I use 
>>> FFTW3, the FFT stuff runs well as a standalone program before 
>>> integrating into gnuradio.
>>> 
>>> Then I integrate the FFT function into the block, it compiles 
>>> without any error. But when I run the flow graph in GRC, it 
>>> produces following error message.
>>> 
>>> Generating: "/home/sgku/gnuradio/flow_graphs/top_block.py" 
>>> Executing: "/home/sgku/gnuradio/flow_graphs/top_block.py" 
>>> Traceback (most recent call last): File 
>>> "/home/sgku/gnuradio/flow_graphs/top_block.py", line 18, in 
>>> <module> import activecat File 
>>> "/usr/local/lib/python2.7/dist-packages/activecat/__init__.py",
>>>
>>> 
line 45, in <module> from activecat_swig import * File
>>> "/usr/local/lib/python2.7/dist-packages/activecat/activecat_swig.py",
>>>
>>> 
line 26, in <module> _activecat_swig = swig_import_helper() File
>>> "/usr/local/lib/python2.7/dist-packages/activecat/activecat_swig.py",
>>>
>>> 
line 22, in swig_import_helper _mod =
>>> imp.load_module('_activecat_swig', fp, pathname, description) 
>>> ImportError: /usr/local/lib/libgnuradio-activecat.so: undefined
>>>  symbol: fftw_plan_dft_1d
>>>>>> Done
>>> 
>>> 
>>> Below is the implmentation source file:
>>> 
>>> 
>>> namespace gr { namespace activecat {
>>> 
>>> fft1::sptr fft1::make(int fft_size, int direction, bool 
>>> fft_shift) { return gnuradio::get_initial_sptr (new 
>>> fft1_impl(fft_size, direction, fft_shift)); }
>>> 
>>> // constructor fft1_impl::fft1_impl(int fft_size, int
>>> direction, bool fft_shift) : gr::sync_block("fft1",
>>> gr::io_signature::make( 1, 1, sizeof(gr_complex)),
>>> gr::io_signature::make( 1, 1, sizeof(gr_complex))),
>>> d_N(fft_size), d_direction(direction), d_shift(fft_shift) {
>>> d_input = (fftw_complex*) fftw_malloc( sizeof(fftw_complex) *
>>> d_N ); d_plan  = fftw_plan_dft_1d( d_N, d_input, d_input,
>>> FFTW_BACKWARD, FFTW_ESTIMATE );  // later change FFTW_BACKWARD
>>> to d_direction
>>> 
>>> set_output_multiple( d_N ); set_min_noutput_items( d_N ); }
>>> 
>>> // destructor fft1_impl::~fft1_impl() { }
>>> 
>>> int fft1_impl::work( int noutput_items,
>>> gr_vector_const_void_star &input_items, gr_vector_void_star
>>> &output_items) { const gr_complex  *in  =  (const gr_complex *)
>>> input_items[0]; gr_complex        *out =  (gr_complex *)
>>> output_items[0];
>>> 
>>> for (int i=0; i < noutput_items; i++) { d_input[i][0] = 
>>> in[i].real(); d_input[i][1] = in[i].imag(); }
>>> 
>>> fftw_execute( d_plan );
>>> 
>>> for (int i=0; i < noutput_items; i++) { out[i].real( 
>>> d_input[i][0] ); out[i].imag( d_input[i][1] ); }
>>> 
>>> 
>>> return noutput_items; } } /* namespace activecat */ } /* 
>>> namespace gr */
>>> 
>>> 
>>> 
>>> Question: How to solve this error ?
>>> 
>>> Regards, Activecat address@hidden
>>> 
> 
> 
> 
>> _______________________________________________ Discuss-gnuradio 
>> mailing list address@hidden 
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
> 
> _______________________________________________ Discuss-gnuradio
> mailing list address@hidden 
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTFaSgAAoJEBQ6EdjyzlHtj2gIAIIt8PS8OpbpatPGFr6yAWob
IDYN3HfhJ23juTkTW75U8oKCW+TPCFSCjUx/0tWdamBELEJUAm48mx8ZqP/ZQUbS
ry6MvIFOhAIJbBgFY7RewLGI1WNgISxxtSrV+hagRJ/cbTqMIYh0654mS16jwjN/
JmIlnPPSE5ThRg7c0YowSv5YLtYG6tQS41V8QGUlkCYEYmSKZvs8W3oVNOhDXUEQ
IBcE1Udblud+R3iOFqZjz7mXX/VxAlNngTWdDJPPu8VCnGIttTFuc2Eqg4umkwh3
C0/0avWsHklK252E3KcgJEExMhc73asBiKgDsS0q9OzIr5/aqRbJui9Ff6LPs4g=
=72Kz
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]