Compiling standalone apps

Hi,

I must be doing something really stupid. I’m trying to figure out how to
compile against the C++ libraries.

I copied test_usrp_standard_tx.cc, timestuff.h, and timestuff.c to a new
folder, then I compiled the application using

g++ test_usrp_standard_tx.cc timestuff.c -lusrp -Wall

and that created an a.out file just fine. However, when I run ./a.out, I
get the following error:

./a.out: error while loading shared libraries: libusrp.so.0: cannot

open shared object file: No such file or directory

The outputs of the relevant locates are:

$ locate usrp_standard.h
/usr/local/include/usrp_standard.h
$ locate usrp_bytesex.h
/usr/local/include/usrp_bytesex.h
$ locate libusrp
/usr/local/lib/libusrp.so
/usr/local/lib/libusrp.so.0
/usr/local/lib/libusrp.la
/usr/local/lib/libusrp.so.0.0.0

/usr/local/lib looks like this:

$ ls -l
total 20292
-rwxr-xr-x 1 root root 851 Oct 10 13:13 libgnuradio-core.la
-rwxr-xr-x 1 root root 919 Oct 10 13:13 libgnuradio-core-qa.la
lrwxrwxrwx 1 root root 28 Oct 10 13:13 libgnuradio-core-qa.so ->
libgnuradio-core-qa.so.0.0.0
lrwxrwxrwx 1 root root 28 Oct 10 13:13 libgnuradio-core-qa.so.0
-> libgnuradio-core-qa.so.0.0.0
-rwxr-xr-x 1 root root 1607312 Oct 10 13:13
libgnuradio-core-qa.so.0.0.0
lrwxrwxrwx 1 root root 25 Oct 10 13:13 libgnuradio-core.so ->
libgnuradio-core.so.0.0.0
lrwxrwxrwx 1 root root 25 Oct 10 13:13 libgnuradio-core.so.0 ->
libgnuradio-core.so.0.0.0
-rwxr-xr-x 1 root root 16297556 Oct 10 13:13 libgnuradio-core.so.0.0.0
-rwxr-xr-x 1 root root 852 Oct 10 13:14 libmblock.la
-rwxr-xr-x 1 root root 922 Oct 10 13:14 libmblock-qa.la
-rwxr-xr-x 1 root root 4170 Oct 10 13:14 libmblock-qa.so
-rwxr-xr-x 1 root root 119553 Oct 10 13:14 libmblock.so
-rwxr-xr-x 1 root root 767 Oct 10 13:14 libpmt.la
-rwxr-xr-x 1 root root 825 Oct 10 13:14 libpmt-qa.la
-rwxr-xr-x 1 root root 1067008 Oct 10 13:14 libpmt-qa.so
-rwxr-xr-x 1 root root 1016420 Oct 10 13:14 libpmt.so
-rwxr-xr-x 1 root root 779 Oct 10 13:14 libradar.la
-rwxr-xr-x 1 root root 123817 Oct 10 13:14 libradar.so
-rwxr-xr-x 1 root root 802 Oct 10 13:14 libusrp.la
lrwxrwxrwx 1 root root 16 Oct 10 13:14 libusrp.so ->
libusrp.so.0.0.0
lrwxrwxrwx 1 root root 16 Oct 10 13:14 libusrp.so.0 ->
libusrp.so.0.0.0
-rwxr-xr-x 1 root root 437064 Oct 10 13:14 libusrp.so.0.0.0
drwxrwxr-x 2 root root 4096 Oct 10 13:14 pkgconfig
drwxrwxr-x 3 root root 4096 Oct 10 13:13 python2.4

During install, I ran make, make check and make install, and all of
these seemed to pass just fine. Why would the app compile and then not
run? Did I install the libraries incorrectly? Is there some weird path
thing I need to do to make the executable find libusrp? Find
/usr/local/lib?

Thanks for your help,

Dan

have u added /usr/local/lib in your LD_LIBRARY_PATH environment
variable?
cheers
kyle
----- Original Message -----
From: “Dan H.” [email protected]
To: [email protected]
Sent: Wednesday, October 18, 2006 1:58 PM
Subject: [Discuss-gnuradio] Compiling standalone apps

and that created an a.out file just fine. However, when I run ./a.out, I
/usr/local/include/usrp_bytesex.h
-rwxr-xr-x 1 root root 851 Oct 10 13:13 libgnuradio-core.la
-rwxr-xr-x 1 root root 16297556 Oct 10 13:13 libgnuradio-core.so.0.0.0
-rwxr-xr-x 1 root root 802 Oct 10 13:14 libusrp.la
lrwxrwxrwx 1 root root 16 Oct 10 13:14 libusrp.so →
libusrp.so.0.0.0
lrwxrwxrwx 1 root root 16 Oct 10 13:14 libusrp.so.0 →
libusrp.so.0.0.0
-rwxr-xr-x 1 root root 437064 Oct 10 13:14 libusrp.so.0.0.0
drwxrwxr-x 2 root root 4096 Oct 10 13:14 pkgconfig
drwxrwxr-x 3 root root 4096 Oct 10 13:13 python2.4

During install, I ran make, make check and make install, and all of
these seemed to pass just fine. Why would the app compile and then not
run? Did I install the libraries incorrectly? Is there some weird path
thing I need to do to make the executable find libusrp? Find
/usr/local/lib?

Kyle Z. wrote:

have u added /usr/local/lib in your LD_LIBRARY_PATH environment variable?
cheers
kyle
----- Original Message -----

Yep, that was it. I created /etc/ld.so.conf.d/usrp.conf containing the
line /usr/local/lib and then re-ran ldconfig as root. Stupid FC4.

Thanks,

Dan