Where is usrp2_make_source_32fc actually defined?

I’ve been trying to create a usrp2 dual source class for a number of
weeks now, and I’ve come to realize there is something fundamental
about this development environment that I don’t understand.

Basically i’ve been installing gnuradio and grc on a variety of Ubuntu
machines buy building gnuradio-3.2.2 thus:

cd gnuradio-3.2.2
./configure --prefix=/usr
make
sudo make install

I’ve also been making custom blocks using gr-howto-write-a-block-3.2.2.

Lately I’ve tried to create usrp2_dsource_16sc and
usrp2_dual_source_32fc (slightly different naming conventions just to
see if it would make a difference) in gnuradio-3.2.2/gr-usrp2/src by
mimicing exactly how it is done for the existing single-channel
classes.

Everything builds, but at run-time I am getting an “ImportError”
symbol undefined for Z23usrp2_make_dsource_16scRKSsS0

I did an “nm -a _usrp.so | grep make” in
/usr/lib/python2.6/dist-packages/gnuradio and see this:

0000d1b3 T _Z12make_int_ptrv
0000d238 T _Z13make_long_ptrv
0000d12e T _Z15make_uint16_ptrv
U Z20usrp2_make_sink_16scRKSsS0
U Z20usrp2_make_sink_32fcRKSsS0
U Z22usrp2_make_source_16scRKSsS0
U Z22usrp2_make_source_32fcRKSsS0
U Z23usrp2_make_dsource_16scRKSsS0
U Z27usrp2_make_dual_source_32fcRKSsS0
0000d1d7 t _wrap_make_int_ptr
0000d25c t _wrap_make_long_ptr
0000d152 t _wrap_make_uint16_ptr

What I’ve noticed now is that even in the original _usrp2.so built
from the unmodified gnuradio-3.2.2 source, which works, the make
methods for sink and source appear to be undefined, according to “nm
-a”.

So where are they defined? I’m hoping that if I knew how these
methods are resolved at run-time in the “off-the-shelf” version of the
code, I would see why modified code is not working.

-Tom

Maybe you have a typo from copying the usrp2 code, or didnt fill in the
make function in a cc file. The compiler wont catch something like that
unless you try to call the make function in some example c++ app. See
gr-usrp2/src/usrp2_source_32fc.cc

usrp2_source_32fc_sptr
usrp2_make_source_32fc(const std::string &ifc, const std::string
&mac_addr)
throw (std::runtime_error)
{
return gnuradio::get_initial_sptr(new usrp2_source_32fc(ifc,
mac_addr));
}

-Josh

I can believe i have a typo (though I have been looking at this for
months, trust me :slight_smile: ) - but what I don’t understand is, when I do

nm -a _usrp2.so | grep make

on the “regular” build it shows all four of the make methods as
undefined. Isn’t that what “U” means? (I’m asking). So how at
run-time does this get resolved (on the version that works).

I would be curious to know what other people are seeing when they do
nm -a _usrp2.so | grep make

On Mon, Jan 18, 2010 at 03:08:53PM -0500, Tom G. wrote:

nm -a _usrp2.so | grep make

FWIW, when looking at .so’s

$ nm --dynamic

makes more sense.

You may also want to use

$ ldd .so

Eric

Thanks Eric and Josh!

I think what’s happening is that the systems that “work” have the make
methods in /usr/local/lib.

Doesn’t explain to me what I am doing wrong in trying to clone them,
but at least it clarifies what’s going on…