Hi Ben,
I didn’t find my error, so i decide to proceed with another method:
I use a project which works.
I create the file : rfid_file.cc and rfid_file.h
I modify the file rfid.i
I use the command: ./boostrap
./configure
./make
./make configure
And i have no errors :-),
But i have an error after that, when i import my block in my file .py.
*
Traceback (most recent call last):
File “./test.py”, line 20, in
from gnuradio import rfid
File “/usr/local/lib/python2.7/dist-packages/gnuradio/rfid.py”, line
24,
in
_rfid = swig_import_helper()
File “/usr/local/lib/python2.7/dist-packages/gnuradio/rfid.py”, line
20,
in swig_import_helper
_mod = imp.load_module(‘_rfid’, fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/gnuradio/_rfid.so:
undefined symbol: _Z14rfid_make_fileiP5state
*
Do you know why?
- This is my file: rfid_file.cc
*#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <rfid_file.h>
#include <gr_io_signature.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#ifndef READER_VARS
#include “reader_vars.h”
#endif
#include <sys/time.h>
#include <float.h>
#include <signal.h>
#include <math.h>
bool trigger_next_cycle = false;
static itimerval timer;
rfid_file_sptr
rfid_make_file(int dec2, state * reader_state2)
{
return rfid_file_sptr(new rfid_file(dec2, reader_state2));
}
rfid_file::rfid_file(int dec2, state * reader_state2):
gr_block(“rfid_file”, gr_make_io_signature (1, 1, sizeof(float)),
gr_make_io_signature (1,1,sizeof(float)))
{
printf(“test1”);
}
rfid_file::~rfid_file()
{
}
int
rfid_file::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const float * in = (const float *)input_items[0];
float * out = (float * )output_items[0];
int nout = 0;
int debug_out_cnt = 0;
out[0] = in[0];
consume_each(noutput_items);
printf(“test2”);
return nout;
}
void
rfid_file::forecast (int noutput_items, gr_vector_int
&ninput_items_required)
{
unsigned ninputs = ninput_items_required.size ();
for (unsigned i = 0; i < ninputs; i++){
ninput_items_required[i] = noutput_items;
}
}*
- This is my file rfid_file.h
*#ifndef INCLUDED_RFID_FILE_H
#define INCLUDED_RFID_FILE_H
#include <gr_block.h>
#include <gr_message.h>
#include <gr_msg_queue.h>
#include “reader_vars.h”
class rfid_file;
typedef boost::shared_ptr<rfid_file> rfid_file_sptr;
rfid_file_sptr
rfid_make_file (int dec2, state * reader_state2 );
class rfid_file : public gr_block
{
private:
friend rfid_file_sptr rfid_make_file(int dec2, state * reader_state2);
rfid_file(int dec2, state * reader_state2);
state * d_reader_state2;
void forecast (int noutput_items, gr_vector_int
&ninput_items_required);
public:
~rfid_file();
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif*
- And this is my file: rfid.i
*%include “exception.i”
%include “gnuradio.i” // the common stuff
%{
#include “gnuradio_swig_bug_workaround.h” // mandatory bug fix
#include “rfid_clock_recovery_zc_ff.h”
#include “rfid_cmd_gate.h”
#include “rfid_gen2_reader.h”
#include “rfid_reader_decoder.h”
#include “rfid_file.h”
%}
//-----------------------------------------------------------------
GR_SWIG_BLOCK_MAGIC(rfid, reader_decoder);
rfid_reader_decoder_sptr
rfid_make_reader_decoder (float us_per_sample, float tari);
class rfid_reader_decoder: public gr_sync_block{
rfid_reader_decoder (float us_per_sample, float tari);
public:
~rfid_reader_decoder();
gr_msg_queue_sptr get_log() const;
};
//-----------------------------------------------------------------
GR_SWIG_BLOCK_MAGIC(rfid, cmd_gate);
rfid_cmd_gate_sptr rfid_make_cmd_gate (int dec, state * reader_state);
class rfid_cmd_gate: public gr_block{
rfid_cmd_gate (int dec, state * reader_state);
public:
~rfid_cmd_gate();
};
//-----------------------------------------------------------------
GR_SWIG_BLOCK_MAGIC(rfid, file);
rfid_file_sptr rfid_make_file (int dec2, state * reader_state2);
class rfid_file: public gr_block{
rfid_file (int dec2, state * reader_state2);
public:
~rfid_file();
};
//-----------------------------------------------------------------
GR_SWIG_BLOCK_MAGIC(rfid, gen2_reader);
rfid_gen2_reader_sptr rfid_make_gen2_reader (int dec, int interp, int
miller, bool elg, int dev_corr);
class rfid_gen2_reader: public gr_block{
rfid_gen2_reader (int dec, int interp, int miller, bool elg, int
dev_corr);
public:
~rfid_gen2_reader();
state * STATE_PTR;
gr_msg_queue_sptr get_log() const;
};
//-----------------------------------------------------------------
GR_SWIG_BLOCK_MAGIC(rfid, clock_recovery_zc_ff);
rfid_clock_recovery_zc_ff_sptr
rfid_make_clock_recovery_zc_ff(int samples_per_pulse, int interp_factor,
float us_per_sample, float blf, bool elg);
class rfid_clock_recovery_zc_ff: public gr_block{
rfid_clock_recovery_zc_ff(int samples_per_pulse, int interp_factor,
float
us_per_sample, float blf, bool elg);
public:
~rfid_clock_recovery_zc_ff();
};
*
Btw, thank you a lot for your help!
Le 16 mars 2012 14:18, Ben H. [email protected] a crit :