UsingLibusrpWith3 5

From GNU Radio
Jump to navigation Jump to search

A Short Guide to Using Libusrp(2) with GNU Radio 3.5.0 and up

Short answer: Don't do it. If you really, really, really need libusrp, you should first consider updating your applications. If you really need this reference, understand the following:

  • There is no support for this, so don't ask for help (e.g. on the mailing list or in IRC)
  • The instructions may be broken
  • A lot of features that were fixed in the past will not be fixed here

{{collapse(I know what I'm doing and I promise I won't ask on the mailing list about this)

Remove all installed GNU Radio files

This is not exactly necessary, but good practice so we aren't left with confused versions. Skip this if you know what you are doing with your library versions.

A 'sudo make uninstall' will work as long as you are on the same version of the code. If that doesn't work, here are the directories to clean (you may have to adjust for your software versions of Python), assuming you use /usr/local as your install prefix:

    /usr/local/include/gnuradio
    /usr/local/include/gruel
    /usr/local/include/usrp
    /usr/local/include/usrp2
    /usr/local/lib/libgnuradio*
    /usr/local/lib/libgruel*
    /usr/local/lib/python2.7/dist-packages/gnuradio
    /usr/local/lib/python2.7/dist-packages/usrpm
    /usr/local/lib/python2.7/dist-packages/gruel
    /usr/local/lib/python2.7/dist-packages/grc_gnuradio
    /usr/local/share/gnuradio
    /usr/local/share/doc/gnuradio*  
    /usr/local/share/doc/usrp*
    /usr/local/share/usrp
    /usr/local/bin/usrp*

Install GNU Radio version 3.4.2

    $ wget http://gnuradio.org/redmine/attachments/download/279/gnuradio-3.4.2.tar.gz
    $ tar xzf gnuradio-3.4.2.tar.gz; cd gnuradio-3.4.2 
    $ ./configure --disable-all-components --with-fusb-tech=libusb1 --enable-usrp --enable-gruel --enable-gnuradio-core --enable-gr-usrp --enable-config
    $ make -j
    $ make check
    $ sudo make install

This will install only the required libraries for talking to the USRP and USRP2 into your system. After the configure, you should be left with:

    ********************************************************************* 
    The following GNU Radio components have been successfully configured: 

    config 
    gruel 
    gnuradio-core 
    usrp 
    gr-usrp 
    

All other packages will be disabled.

This will install the 3.4.2 libraries to your system, so looking in /usr/local/lib, you should see:

Importantly, there is a library libgnuradio-core.so that is a symlink to libgnuradio-core-3.4.2.so.0.0.0. In fact, the files you'll have that were generated just now are:

lrwxrwxrwx  31      libgnuradio-core-3.4.2.so.0 -> libgnuradio-core-3.4.2.so.0.0.0 
-rwxr-xr-x  26121296    libgnuradio-core-3.4.2.so.0.0.0 
-rwxr-xr-x  1200        libgnuradio-core.la 
lrwxrwxrwx  31      libgnuradio-core.so -> libgnuradio-core-3.4.2.so.0.0.0 
lrwxrwxrwx  32      libgnuradio-usrp2-3.4.2.so.0 -> libgnuradio-usrp2-3.4.2.so.0.0.0 
-rwxr-xr-x  523924  libgnuradio-usrp2-3.4.2.so.0.0.0 
-rwxr-xr-x  1268        libgnuradio-usrp2.la 
lrwxrwxrwx  32      libgnuradio-usrp2.so -> libgnuradio-usrp2-3.4.2.so.0.0.0 
lrwxrwxrwx  31      libgnuradio-usrp-3.4.2.so.0 -> libgnuradio-usrp-3.4.2.so.0.0.0 
-rwxr-xr-x  555315  libgnuradio-usrp-3.4.2.so.0.0.0 
-rwxr-xr-x  1280        libgnuradio-usrp.la 
lrwxrwxrwx  31      libgnuradio-usrp.so -> libgnuradio-usrp-3.4.2.so.0.0.0 
lrwxrwxrwx  23      libgruel-3.4.2.so.0 -> libgruel-3.4.2.so.0.0.0 
-rwxr-xr-x  1644389 libgruel-3.4.2.so.0.0.0 
-rwxr-xr-x  1081        libgruel.la 
lrwxrwxrwx  23      libgruel.so -> libgruel-3.4.2.so.0.0.0 
lrwxrwxrwx  23      libusrp2-3.4.2.so.0 -> libusrp2-3.4.2.so.0.0.0 
-rwxr-xr-x  1298037 libusrp2-3.4.2.so.0.0.0 
-rwxr-xr-x  1108        libusrp2.la 
lrwxrwxrwx  23      libusrp2.so -> libusrp2-3.4.2.so.0.0.0 
lrwxrwxrwx  22      libusrp-3.4.2.so.0 -> libusrp-3.4.2.so.0.0.0 
-rwxr-xr-x  2138589     libusrp-3.4.2.so.0.0.0 
-rwxr-xr-x  1054        libusrp.la 
lrwxrwxrwx  22      libusrp.so -> libusrp-3.4.2.so.0.0.0 

So those files that do not include the version number are why we install 3.4.2 first; we will be overwriting these with the new version (specifically libgruel and libgnuradio). If you use ldd on libgnuradio-usrp2.so, you can see that it points to libgnuradio-core-3.4.2.so.0, which is good that it looks to the exact versioned file, so replacing the libgnuradio-core won't affect this link.

After this install, you will also have Python files in /usr/local/lib/python2.7/dist-packages/gnuradio, including the usrp and usrp2 modules. When we overwrite with the latest version of GNU Radio, these modules won't be touched, but everything else will be replaced by the latest versions.

Install Latest GNU Radio Master

    $ git clone git://gnuradio.org/gnuradio
    $ mkdir gnuradio/build
    $ cd gnuradio/build
    $ cmake ../
    $ make -j
    $ make test
    $ sudo make install

Now, you'll see that same symlink now point to the newest version:

    libgnuradio-core.so -> libgnuradio-core-3.5.0git.so.0.0.0

But the libgnuradio-usrp(2) files won't have changed.

You should be able to use all of your libusrp and libusrp2 code exactly as before now.

}}