« Previous -
Version 100/128
(diff) -
Next » -
Current version
Alexandru Csete, 01/21/2011 04:29 pm
Simplified instructions for recent Ubuntu. Instructions for pre-8.10 moved to LegacyUbuntuInstall.
Building GNU Radio on Ubuntu Linux¶
This page describes how to build and install GNU Radio from source on Ubuntu Linux 8.10 or newer. It is intended to be a step-by-step guide for the entire process, nevertheless, you should carefully read it through before doing anything.
It is also possible to install GNU Radio on older Ubuntu see building on legacy Ubuntu; however, we may not be able to provide sufficient support for legacy OS.
Note that since GNU Radio 3.2 binary package installation is available for Ubuntu 9.04 (Jaunty) or later, bypassing the need for manually installing build tool prerequisites and performing a source code installation. In addition, installation and configuration of the USRP and USRP2 is automated. This is fastest and easiest way to get a working GNU Radio platform, unless you need a more up to date installation.
Installation Overview¶
Installing GNU Radio on any recent Ubuntu is easy and requires the following steps:
- Install the pre-requisites
- Get the GNU Radio source code
- Configure, compile and install GNU Radio
- Configure USRP (optional)
Instructions for each of these steps are given below.
Install the Pre-Requisites¶
The following packages are required for compiling various parts of GNU Radio on Ubuntu. These packages can be installed via "synaptic" or using the command lines given in the next section.
- Development Tools (need for compilation)
- g++
- subversion
- make
- autoconf, automake, libtool
- sdcc (from "universe"; 2.4 or newer)
- guile (1.6 or newer)
- ccache (not required, but recommended if you compile frequently)
- Libraries (need for runtime and for compilation)
- python-dev
- FFTW 3.X (fftw3, fftw3-dev)
- cppunit (libcppunit and libcppunit-dev)
- Boost 1.35 (or later)
- libusb and libusb-dev
- wxWidgets (wx-common) and wxPython (python-wxgtk2.8)
- python-numpy (via python-numpy-ext) (for SVN on or after 2007-May-28)
- ALSA (alsa-base, libasound2 and libasound2-dev)
- Qt (libqt3-mt-dev for versions earlier than 8.04; version 4 works for 8.04 and later)
- SDL (libsdl-dev)
- GSL GNU Scientific Library (libgsl0-dev >= 1.10 required for SVN trunk, not in binary repositories for 7.10 and earlier)
- SWIG (1.3.31 or newer required)
- Edgy or previous: requires installation from source
- Feisty or newer: use the standard package install (swig)
- QWT and QWT PLot3d libraries (optional for Qt Gui)
- Polyphase Filter Bank examples
- for the examples in gnuradio-examples/python/pfb to work you need to install python-scipy, python-matplotlib, and python-tk
- Other useful packages
- doxygen (for creating documentation from source code)
- octave (from "universe")
Install Scripts¶
The following command line scripts will install all the required dependencies. Before running them you should ensure that the optional repositories are enabled in "Software Sources". These optional repositories can be called something like Universe, Partner, Restricted or Community, depending on which version of Ubuntu you are using.
To execute the script copy & paste the relevant command line into a terminal.
Maverick (10.10)¶
Same as for 10.04 (TBC)
Lucid (10.04)¶
sudo apt-get -y install libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev \ libcppunit-dev libboost-all-dev libusb-dev fort77 sdcc sdcc-libraries \ libsdl1.2-dev python-wxgtk2.8 subversion git-core guile-1.8-dev \ libqt4-dev python-numpy ccache python-opengl libgsl0-dev \ python-cheetah python-lxml doxygen qt4-dev-tools \ libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools
Karmic (9.10)¶
sudo apt-get -y install swig g++ automake autoconf libtool python-dev libfftw3-dev \ libcppunit-dev libboost1.38-dev libusb-dev fort77 sdcc sdcc-libraries \ libsdl1.2-dev python-wxgtk2.8 subversion git-core guile-1.8-dev \ libqt4-dev python-numpy ccache python-opengl libgsl0-dev \ python-cheetah python-lxml doxygen qt4-dev-tools \ libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools
Jaunty (9.04)¶
Package sdcc-nf needs to be installed (instead of sdcc)
sudo apt-get -y install swig g++ automake1.9 autoconf libtool python-dev fftw3-dev \ libcppunit-dev libboost1.35-dev sdcc-nf libusb-dev \ libsdl1.2-dev python-wxgtk2.8 subversion git guile-1.8-dev \ libqt4-dev python-numpy ccache python-opengl libgsl0-dev \ python-cheetah python-lxml doxygen qt4-dev-tools \ libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools
Note: If you are upgrading from an older install, you may have python-wxgtk2.6 installed.
Because python-wxgtk2.6 takes precedence over python-wxgtk2.8, it must be removed first: sudo apt-get remove python-wxgtk2.6
Intrepid (8.10)¶
Package sdcc-nf needs to be installed instead of sdcc
sudo apt-get -y install swig g++ automake1.9 autoconf libtool python-dev fftw3-dev \ libcppunit-dev libboost1.35-dev sdcc-nf libusb-dev \ libsdl1.2-dev python-wxgtk2.8 subversion git guile-1.8-dev \ libqt4-dev python-numpy ccache python-opengl libgsl0-dev \ python-cheetah python-lxml doxygen qt4-dev-tools \ libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools
Installing GNU Radio¶
Download, bootstrap, configure, and compile GNU Radio package:
# Install GNU Radio from git git clone http://gnuradio.org/git/gnuradio.git cd gnuradio ./bootstrap ./configure makeNotes:
- If you want to use GNU Radio with UHD you have to switch to the "next" branch before you bootstrap, see UHD instructions
- If you are building from a release .tar.gz rather than git you should skip the bootstrap step.
- By default GNU Radio will be installed under /usr/local - for installing in a custom directory see #Installing in a custom directory
After successful build you should run the GNU Radio software self-check (does not require USRP):
make check
If any test or tests do not work, GNU Radio might still function properly, but it might be wise to look in the email archives for a fix or to write the email list. If writing to the email list, please include the OS type, OS version, and CPU type (e.g. via "uname -a"), anything special about the computer hardware, software versions (gcc, g++, swig, sdcc, etc) and how installed (standard or non-standard package, source). You can find some useful tips for asking questions under Reporting Errors.
Now install GNU Radio for general use:
sudo make install
You are now ready to use GNU Radio. You can try to execute the dial_tone.py example (/usr/local/share/gnuradio/examples/audio/dial_tone.py) or the gnuradio-companion.
Configuring USRP support¶
This section is only relevant if you have a USRP1 that you want to use with GNU Radio. You may already have done this if you have installed UHD .
Ubuntu uses udev for handling hotplug devices, and does not by default provide non-root access to the USRP. The following script is taken from directions, and sets up groups to handle USRP via USB, either live or hot-plug
sudo addgroup usrp
sudo usermod -G usrp -a <YOUR_USERNAME>
echo 'ACTION=="add", BUS=="usb", SYSFS{idVendor}=="fffe", SYSFS{idProduct}=="0002", GROUP:="usrp", MODE:="0660"' > tmpfile
sudo chown root.root tmpfile
sudo mv tmpfile /etc/udev/rules.d/10-usrp.rules
At this point, Ubuntu is configured to know what to do if/when it detects the USRP on the USB, except that "udev" needs to reload the rules to include the newly created one. The following might work, but if it doesn't then rebooting the computer will.
sudo udevadm control --reload-rules
or
sudo /etc/init.d/udev stop sudo /etc/init.d/udev start
or
sudo killall -HUP udevd
You can check if the USRP is being recognized, by examining /dev/bus/usb after plugging in a USRP. Using the command:
ls -lR /dev/bus/usb | grep usrp
should result in one or more lines (one for each USRP) reading something like:
crw-rw---- 1 root usrp 189, 514 Mar 24 09:46 003
Each device file will be listed with group 'usrp' and mode 'crw-rw----'.
Once you've verified that the USRP is available to Ubuntu, now it is time to verify that GNU Radio works with the USRP. While "usrp_benchmark_usb" might not return a full 32 MB/s of throughput, the script should at least run properly; if not, either GNU Radio didn't make correctly or the USRP isn't accessible. From the "gnuradio" directory, verify that all of the following work:
- Python interface to the USRP; provides a rough estimate of the maximum throughput (quantized to a power of 2) between the host computer and the USRP.
cd gnuradio-examples/python/usrp ./usrp_benchmark_usb.py
- C++ interface to the USRP; provides a good estimate of the maximum throughput (non-quantized) between the host computer and the USRP.
cd usrp/host/apps ./test_usrp_standard_tx ./test_usrp_standard_rx
You are now ready to use GNU Radio and your USRP.
Optional: Installing in a custom directory¶
The generic instructions above install GNU Radio to /usr/lib. It is however possible to install to a location of your choice. In order to do that you have to configure the build to use the custom prefix:
./boostrap ./configure --prefix=/opt/gnuradio ...
This will configure GNU Radio to be installed to /opt/gnuradio rather than the default /usr/local
It is now necessary to add the custom installation directories to our environment settings, otherwise applications will not be able to find the headers, libraries, python scripts, etc. Open your .bashrc file (e.g. type "gedit .bashrc" in the terminal) and add to the end of the file:
# GNU Radio installation export PATH=$PATH:/opt/gnuradio/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/gnuradio/lib export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/gnuradio/lib/pkgconfig export PYTHONPATH=$PYTHONPATH:/opt/gnuradio/lib/python2.6/site-packages
The changes will take effect when you restart your session, e.g. log out and log in again.
Broken libtool on Debian and Ubuntu¶
Note: This section seems obsolete for recent Ubuntu and you should consider it only if you encounter the problems mentioned below.
Because Debian and Ubuntu apply a poorly implemented "enhancement" to the upstream version of libtool, they break the ability to test code and libraries prior to installing them. We think that testing before installation is a good idea. To work around their damage, be sure to include $PREFIX/lib (and $PREFIX/lib64 on 64-bit machines) in /etc/ld.so.conf.
If you don't include $PREFIX/lib in /etc/ld.so.conf, you will see errors during the linking phase
of the build. There are several places it shows up. The first one is often during the build of
mblocks. It's not an mblock problem. It's a Debian/Ubuntu problem.
Do this to work around this "feature":
1) Make a copy from the current ld.so.conf file and save it in a temp folder:
cp /etc/ld.so.conf /tmp/ld.so.conf
2) Add /usr/local/lib path to it:
echo /usr/local/lib >> /tmp/ld.so.conf
3) Delete the original ld.so.conf file and put the modified file instead:
sudo mv /tmp/ld.so.conf /etc/ld.so.conf
4) Do ldconfig:
sudo ldconfig