Creating a USRP2 C++ Object

I’m working on a C++ program which directly creates an instance of a
USRP2
object. When the program is being run, the following error is thrown:
/usr/local/lib/libusrp2.so.0: undefined
symbol: _ZN5gruel7sys_pri13usrp2_backendEv

Gruel was complied on the system and programs have been run using the
usrp2
in gnuradio.

What in the world does this error message mean, what could be throwing
it
and how can I fix it. Thanks!

On Tue, Mar 03, 2009 at 01:19:15PM -0500, Mike Leferman wrote:

I’m working on a C++ program which directly creates an instance of a USRP2
object. When the program is being run, the following error is thrown:
/usr/local/lib/libusrp2.so.0: undefined
symbol: _ZN5gruel7sys_pri13usrp2_backendEv

Gruel was complied on the system and programs have been run using the usrp2
in gnuradio.

What in the world does this error message mean, what could be throwing it
and how can I fix it. Thanks!

Decoding the mangled name:

$ c++filt _ZN5gruel7sys_pri13usrp2_backendEv
gruel::sys_pri::usrp2_backend()

which OS/distribution/version?

Do you have /usr/local/lib in /etc/ld.so.conf?
Have you run $ sudo ldconfig?

Eric

I’m using Ubuntu 8.10, and /usr/local/lib is in my ld.so.conf. Does
ldconfig just update ld.so.conf? My program finds libusrp2 in the
/usr/local/lib folder, so it should be able to find libgruel (which I’m
guessing is the problem?) Do I have to have my program link libgruel as
well? Is this failing because I don’t use usrp2.lo when i link the
library?
Thanks for the help!

  • Mike

On Thu, Mar 05, 2009 at 12:47:24PM -0500, Mike Leferman wrote:

I’m using Ubuntu 8.10, and /usr/local/lib is in my ld.so.conf. Does
ldconfig just update ld.so.conf? My program finds libusrp2 in the
/usr/local/lib folder, so it should be able to find libgruel (which I’m
guessing is the problem?) Do I have to have my program link libgruel as
well? Is this failing because I don’t use usrp2.lo when i link the library?
Thanks for the help!

  • Mike

Try using pkg-config to get the usrp2 dependencies:

$ pkg-config usrp2 --cflags
-DOMNITHREAD_POSIX=1 -pthread -I/usr/local/include
-I/usr/local/include/gnuradio

$ pkg-config usrp2 --libs
-L/usr/local/lib -lusrp2 -lgromnithread -lgruel

Eric

I ran those commands and those are the outputs I got.

On Thu, Mar 05, 2009 at 02:52:36PM -0500, Mike Leferman wrote:

I ran those commands and those are the outputs I got.

It sounds like you’re building your own code outside of our
framework. Are you passing all of those flags to g++ when you’re
compiling and linking?

Did you do a

$ sudo ldconfig

sometime after installing libgruel?

Ah, but then I added the outputs to my makefile and now it works.
Thanks
for the help!

On Thu, Mar 5, 2009 at 2:52 PM, Mike Leferman