FFTW3 runtime error

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

import activecat
File
“/usr/local/lib/python2.7/dist-packages/activecat/init.py”, line 45,
in

from activecat_swig import *
File
“/usr/local/lib/python2.7/dist-packages/activecat/activecat_swig.py”,
line
26, in
_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
[email protected]

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 */

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

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 M. and me, could you
please look into the mailing list archive; the solution to your
problem should be there :slight_smile:

Happy hacking,
Marcus

On 04.03.2014 07:27, Activecat wrote:

class fft1_impl : public fft1 { private: int d_N; int d_direction;
} // namespace activecat } // namespace gr

I am trying to build a custom block with FFT capability. I use
“/home/sgku/gnuradio/flow_graphs/top_block.py”, line 18, in

Done

fftw_execute( d_plan );
Question: How to solve this error ?

Regards, Activecat [email protected]

_______________________________________________ Discuss-gnuradio
mailing list [email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTFaQQAAoJEBQ6EdjyzlHtjCcH/1cqqf9PSSAc5FmNIH45I6Uy
0A7/Rhqb5nwjBjVlRe0UXrVk7EAAK/PwDQgliMw8oZ+5KuqhqVfFtx3Vch9Rs75a
Hmprl8fEDanKyfVa0cKyhmJCyuRFE29R8XxdAt07HalJqh1clhXOo6vkoZTQeDmh
gm2NOflIdEtWk2kggo92Ii23El8xbQeWhaM1/OXTyqOR7d+V6U4aF6BwirJ4oPos
uOXfKxteqjetMhIm50FClQyKpS/gRLIvhhVz3P2Yc2tJM8GlLvH0gP+5M1MeKh5j
yJTbYzbHByFsAIT39zyFDrmz5FU1+pbwSKe0dLM1/HrclZHSkiW2dWREx7UYEHg=
=clWo
-----END PGP SIGNATURE-----

-----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. wrote:

Happy hacking, Marcus

namespace gr { namespace activecat {
&input_items, gr_vector_void_star &output_items); };

Dear Sir,
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
import activecat File
“/usr/local/lib/python2.7/dist-packages/activecat/init.py”,

line 45, in from activecat_swig import * File

“/usr/local/lib/python2.7/dist-packages/activecat/activecat_swig.py”,

line 26, in _activecat_swig = swig_import_helper() File

“/usr/local/lib/python2.7/dist-packages/activecat/activecat_swig.py”,

line 22, in swig_import_helper _mod =

d_N ); d_plan = fftw_plan_dft_1d( d_N, d_input, d_input,
input_items[0]; gr_complex *out = (gr_complex *)

_______________________________________________ Discuss-gnuradio
mailing list [email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________ Discuss-gnuradio
mailing list [email protected]
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-----

Dear Marcus,

Thank you very much.
As according to your guideline, the runtime error has been solved.
With some minor modification to the work() function, now the flow graph
executes without any error.

Cheers,
Activecat

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs