UbuntuInstall: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Regarding GNU Radio 3.8 on Ubuntu 16.04.)
 
(68 intermediate revisions by 11 users not shown)
Line 1: Line 1:
= Building GNU Radio on Ubuntu Linux =
<b>There's generally no need to build GNU Radio from source code unless you want to modify GNU Radio rather than just using it.</b> The recommended way to install GNU Radio on most platforms is using already compiled binary packages. Binary installation should be sufficient for most users, and certainly for anyone who is new to GNU Radio. However, if you have special requirements, or a binary package is not available for your system, you may need to install GNU Radio from source.


'''Note: this page is not update anymore, as [[InstallingGRFromSource#Using-the-build-gnuradio-script|the build-gnuradio script]] does all the work on Ubuntu systems. Check this page only for reference for older systems and as long as the script doesn't work for Ubuntu 18.04!'''
In short: on all modern Ubuntu versions use:


This page describes how to build and install GNU Radio from source on Ubuntu Linux. It is intended to be a step-by-step guide for the entire process. Nevertheless, you should carefully read it through before doing anything.
<pre>
sudo add-apt-repository ppa:gnuradio/gnuradio-releases
sudo apt-get update
sudo apt-get install gnuradio
</pre>


Before you continue, please consider using [[InstallingGRFromSource#Using-the-build-gnuradio-script|the build-gnuradio script]]. It works fine on Ubuntu and Fedora and is sufficient for most users. Continue reading if you really want to go through all the steps of the build process manually.<br />
See our [https://launchpad.net/~gnuradio/+archive/ubuntu/gnuradio-releases PPA] page for more details.
The build-gnuradio script can also take care of individual steps here. You should really, really consider using it.


GNU Radio works great on all Ubuntus from 10.04 upward. It is also possible to install GNU Radio on older releases of Ubuntu (see below); however, we may not be able to provide sufficient support for legacy OS.
The rest of this page describes dependencies for building GNU Radio from source code.


{{toc}}
== Install Dependencies ==


== Installation Overview ==
The following commands will install all the required dependencies. Before running them, you should [https://help.ubuntu.com/community/Repositories/Ubuntu ensure that the "Main" and "Universe" repositories are enabled in &quot;Software Sources&quot;].


Installing GNU Radio on any recent Ubuntu is easy and requires the following steps:
After installing dependencies you can continue with [[LinuxInstall#From_Source|installing GR from source]].


# Install the pre-requisites
=== Focal Fossa (20.04) through Mantic Minotaur (23.10) ===
# Get the GNU Radio source code
# Configure, compile and install GNU Radio
# Configure USRP (optional)


Instructions for each of these steps are given below. The build-gnuradio script can do all of these steps in one go, or every one individually.
GNU Radio version 3.8.x with Python 3 support:


== Install the Pre-Requisites ==
<pre>
sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \
python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \
libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \
liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \
python3-zmq python3-scipy python3-gi python3-gi-cairo gir1.2-gtk-3.0 \
libcodec2-dev libgsm1-dev libusb-1.0-0 libusb-1.0-0-dev libudev-dev
</pre>


The following packages are required for compiling various parts of GNU Radio on Ubuntu. These packages can be installed via the command <code>build-gnuradio prereqs</code>, your favourite package manager (e.g. Synaptic) or using the command lines given in the [[UbuntuInstall#Install-Dependencies|next section]].
GNU Radio version 3.9.x <b>in addition to above</b> requires:


* Development Tools (need for compilation)
<pre>
** g++
sudo apt install pybind11-dev python3-matplotlib libsndfile1-dev \
** git
libsoapysdr-dev soapysdr-tools python3-pygccxml python3-pyqtgraph
** make
</pre>
** cmake
** sdcc (from &quot;universe&quot;)
** guile
** ccache (not required, but recommended if you compile frequently)


* Libraries (need for runtime and for compilation)
GNU Radio version 3.10.x and the 'main' branch <b>in addition to above</b> require:
** python-dev
** SWIG
** FFTW 3.X (libfftw3-dev)
** cppunit (libcppunit-dev)
** Boost 1.35 (or later, but not 1.46, 1.47 or 1.52)
** GSL GNU Scientific Library (libgsl0-dev)
** libusb and libusb-dev
** ALSA (alsa-base, libasound2 and libasound2-dev)


* GNU Radio Companion
<pre>
** for the GNU Radio Companion (GRC) you need to install python-numpy, python-cheetah and python-lxml
sudo apt install libiio-dev libad9361-dev libspdlog-dev python3-packaging python3-jsonschema
</pre>


* WX GUI
<b>Note:</b> Since GNU Radio 3.9.x swig has been replaced with pybind11 and can be removed:
** for the WX GUI components you need to install python-wxgtk2.8 and python-numpy
<pre>
sudo apt remove swig
</pre>


* QT GUI
=== Bionic Beaver (18.04) through Eoan Ermine (19.10) ===
** for the QT GUI components you need to install PyQT4, PyQwt5 for Qt4, QT-OpenGL, Fontconfig, Xrender and Xinput (python-qt4, python-qwt5-qt4, libqt4-opengl-dev, libqwt5-qt4-dev, libfontconfig1-dev, libxrender-dev, libxi-dev).
 
* Video-SDL
** for Video-SDL you need to install the Simple DirectMedia Layer development libraries (libsdl1.2-dev)
 
* 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 &quot;universe&quot;)
 
== Install Dependencies ==
 
The following command line scripts will install all the required dependencies. Before running them you should ensure that the Universe repository are enabled in &quot;Software Sources&quot;.
 
To execute the script copy &amp; paste the relevant command line into a terminal.<br />
If you have an Ubuntu newer than 11.04, use the build-gnuradio script.
 
=== Bionic Beaver (18.04) ===


GNU Radio version 3.8.x with Python 3 support:
GNU Radio version 3.8.x with Python 3 support:


<pre>sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \
<pre>
python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev libcomedi-dev \
sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \
python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \
libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \
libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \
liblog4cpp5-dev libzmq3-dev python3-yaml </pre>
liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \
python3-zmq python3-scipy
</pre>


GNU Radio version 3.7.x:
GNU Radio version 3.7.x:
Line 89: Line 70:
pkg-config python-sip-dev </pre>
pkg-config python-sip-dev </pre>


=== Xenial Xerus (16.04) ===
<b>Note:</b> GNU Radio 3.9 and up will build from source on Ubuntu 18 only if pybind11 is installed from source as well.  Also, pybind11 packages are on the gnuradio-master PPA, so another option is to install pybind from the GR PPA then build gnuradio from source. GNU Radio 3.9 additionally requires:
 
Building GNU Radio 3.8.x is difficult on Ubuntu 16.04 due to various dependency issues (especially due to CMake and Python versions). Please consider using GNU Radio 3.7.x instead.
 
For GNU Radio 3.7.x:
 
<pre>sudo apt-get -y install git-core cmake g++ python-dev swig \
pkg-config libfftw3-dev libboost-all-dev libcppunit-dev libgsl0-dev \
libusb-dev libsdl1.2-dev python-wxgtk3.0 python-numpy \
python-cheetah python-lxml doxygen libxi-dev python-sip \
libqt4-opengl-dev libqwt-dev libfontconfig1-dev libxrender-dev \
python-sip python-sip-dev python-qt4 python-sphinx libusb-1.0-0-dev \
libcomedi-dev libzmq-dev </pre>
 
=== Trusty Tahr (14.04) ===
 
<pre>sudo apt-get -y install git-core cmake g++ python-dev swig \
pkg-config libfftw3-dev libboost1.55-all-dev libcppunit-dev libgsl0-dev \
libusb-dev libsdl1.2-dev python-wxgtk2.8 python-numpy \
python-cheetah python-lxml doxygen libxi-dev python-sip \
libqt4-opengl-dev libqwt-dev libfontconfig1-dev libxrender-dev \
python-sip python-sip-dev</pre>
Then set the following environmental variable to use PyQT:
 
<pre>export PYTHONPATH=/opt/qt/lib/python2.7/dist-package</pre>
=== Saucy Salamander (13.10) ===
 
Saucy Salamander has a particular problem with PyQT and PyQWT. First, apt-get the following packages to get start. We will then manually build and install PyQT and PyQWT to get around the issue.
 
<pre>sudo apt-get -y install git-core cmake g++ python-dev swig \
pkg-config libfftw3-dev libboost1.53-all-dev libcppunit-dev libgsl0-dev \
libusb-dev libsdl1.2-dev python-wxgtk2.8 python-numpy \
python-cheetah python-lxml doxygen libxi-dev python-sip \
libqt4-opengl-dev libqwt-dev libfontconfig1-dev libxrender-dev \
libgruel3.6.1</pre>
If you have PyQWT installed already, remove it:<br />
<code>$ sudo apt-get remove python-qwt5-qt4</code>
 
Make sure SIP is installed:<br />
<code>$ sudo apt-get install python-sip python-sip-dev</code>
 
We'll set up a separate directory to install into to make it keep it nicely separated from anything else (in case Ubuntu fixes this problem).<br />
<code>$ sudo mkdir /opt/qt</code>
 
First, set up your environment
 
Edit ./bashrc by adding or amending the following variables:
 
<pre>export PATH=/opt/qt/bin:$PATH
export LD_LIBRARY_PATH=/opt/qt/lib:/usr/local/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/opt/qt/lib/python2.7/dist-packages:$PYTHONPATH
export PKG_CONFIG_PATH=/opt/qt/lib/pkgconfig:$PKG_CONFIG_PATH</pre>
Either restart the terminal or reset your environment:<br />
<code>$ source ~/.bashrc</code>
 
Download and install PyQt version 4.10.3<br />
http://www.riverbankcomputing.com/software/pyqt/download
 
<pre>  $ tar xzf PyQt-x11-gpl-4.10.3.tar.gz
  $ cd PyQt-x11-gpl-4.10.3
  $ python configure.py -b /opt/qt/bin -d /opt/qt/lib/python2.7/dist-packages -v /opt/qt/share/sip
  $ make
  $ sudo make install</pre>
Download and install PyQWT version 5.2.0<br />
http://pyqwt.sourceforge.net/download.html
 
<pre>  $ tar xzf PyQwt-5.2.0.tar.gz
  $ cd PyQwt-5.2.0/configure
  $ ./configure.py -Q ../qwt-5.2 --module-install-path=/opt/qt/lib/python2.7/dist-packages/PyQt4/Qwt5
  $ make
  $ sudo make install</pre>
If you've already built GNU Radio, first delete CMakeCache.txt in the top build directory. You should then only have to 'make clean' in gr-qtgui.
 
Run cmake and make like you would normally. With the environmental variables pointing to the new PyQT and PyQWT versions we've installed all gr-qtui displays and widgets should work properly now.
 
=== Raring Ringtail (13.04) ===
 
'''Note:''' At release, Ubuntu defaults the 'libboost-all-dev' package to libboost-*.49, which is incompatible with GNURadio. Thus, until the Ubuntu default Boost install catches up, you must manually specify 'libboost1.53-all-dev'.
 
<pre>sudo apt-get -y install git-core autoconf automake  libtool g++ python-dev swig \
pkg-config libfftw3-dev libboost1.53-all-dev libcppunit-dev libgsl0-dev \
libusb-dev sdcc libsdl1.2-dev python-wxgtk2.8 python-numpy \
python-cheetah python-lxml doxygen python-qt4 python-qwt5-qt4 libxi-dev \
libqt4-opengl-dev libqwt5-qt4-dev libfontconfig1-dev libxrender-dev qt4-default</pre>
=== Precise Pangolin (12.04) ===
 
<pre>sudo apt-get -y install git-core autoconf automake  libtool g++ python-dev swig \
pkg-config libboost1.48-all-dev libfftw3-dev libcppunit-dev libgsl0-dev \
libusb-dev sdcc libsdl1.2-dev python-wxgtk2.8 python-numpy \
python-cheetah python-lxml doxygen python-qt4 python-qwt5-qt4 libxi-dev \
libqt4-opengl-dev libqwt5-qt4-dev libfontconfig1-dev libxrender-dev </pre>
=== Natty Narwhal (11.04) ===
 
<pre>sudo apt-get -y install git-core autoconf automake  libtool g++ python-dev swig \
pkg-config libboost-all-dev libfftw3-dev libcppunit-dev libgsl0-dev \
libusb-dev sdcc libsdl1.2-dev python-wxgtk2.8 python-numpy \
python-cheetah python-lxml doxygen python-qt4 python-qwt5-qt4 libxi-dev \
libqt4-opengl-dev libqwt5-qt4-dev libfontconfig1-dev libxrender-dev </pre>
=== Maverick (10.10) ===
 
<pre>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 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 python-qwt5-qt4</pre>
=== Lucid (10.04) ===
 
<pre>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 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 python-qwt5-qt4</pre>
== Installing GNU Radio ==
 
Notes:
 
* If you want to use GNU Radio with a USRP, install UHD package or follow the [https://files.ettus.com/manual/page_build_guide.html UHD Manual Build Guide].
* By default GNU Radio will be installed under /usr/local - for installing in a custom directory see [[UbuntuInstall#Installing-in-a-custom-directory|this section]]
 
 
You can do this automatically via: <code>build-gnuradio gitfetch</code>. Or manually:
 
<pre>git clone --recursive https://github.com/gnuradio/gnuradio.git</pre>
or
 
<pre>git clone --recursive git@github.com:gnuradio/gnuradio.git</pre>
Configure and build GNU Radio:
 
<pre>cd gnuradio
mkdir build
cd build
cmake ../
make</pre>
 
After successful build you should run the GNU Radio software self-check (does not require USRP):
 
<pre>make test</pre>
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 &quot;uname -a&quot;), 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 [[ReportingErrors|Reporting Errors]].
 
Now install GNU Radio for general use:
 
<pre>sudo make install</pre>
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 [[GNURadioCompanion|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 [http://www.ettus.com/uhd_docs/manual/html/usrp1.html#linux-setup-udev 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 [[UdevConfig|directions]], and sets up groups to handle USRP via USB, either live or hot-plug
 
<pre>sudo addgroup usrp
sudo usermod -G usrp -a
echo 'ACTION==&quot;add&quot;, BUS==&quot;usb&quot;, SYSFS{idVendor}==&quot;fffe&quot;, SYSFS{idProduct}==&quot;0002&quot;, GROUP:=&quot;usrp&quot;, MODE:=&quot;0660&quot;' &gt; tmpfile
sudo chown root.root tmpfile
sudo mv tmpfile /etc/udev/rules.d/10-usrp.rules</pre>
At this point, Ubuntu is configured to know what to do if/when it detects the USRP on the USB, except that &quot;udev&quot; 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.
 
<pre>sudo udevadm control --reload-rules</pre>
or
 
<pre>sudo /etc/init.d/udev stop
sudo /etc/init.d/udev start</pre>
or
 
<pre>sudo killall -HUP udevd</pre>
You can check if the USRP is being recognized, by examining /dev/bus/usb after plugging in a USRP. Using the command:
 
<pre>ls -lR /dev/bus/usb | grep usrp</pre>
should result in one or more lines (one for each USRP) reading something like:
 
<pre>crw-rw---- 1 root usrp 189, 514 Mar 24 09:46 003</pre>
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 &quot;usrp_benchmark_usb&quot; 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 &quot;gnuradio&quot; 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.
 
<pre>cd gnuradio-examples/python/usrp
./usrp_benchmark_usb.py</pre>
* C++ interface to the USRP; provides a good estimate of the maximum throughput (non-quantized) between the host computer and the USRP.
 
<pre>cd usrp/host/apps
./test_usrp_standard_tx
./test_usrp_standard_rx</pre>
You are now ready to use GNU Radio and your USRP.
 
== Installing in a custom directory ==
 
The generic [[UbuntuInstall#Installing-GNU-Radio|instructions above]] install GNU Radio to /usr/local. 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:
 
<pre>cmake -DCMAKE_INSTALL_PREFIX=/opt/gnuradio ../
...</pre>
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 &quot;gedit .bashrc&quot; in the terminal) and add to the end of the file:
 
<pre># 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.7/dist-packages</pre>
The changes will take effect when you restart your session, e.g. log out and log in again.
 
= Building GNU Radio on Legacy Ubuntu =
 
*This page describes how to build and install GNU Radio from source on releases of Ubuntu Linux that are no longer supported by Canonical (9.10 or earlier). We strongly recommend using a newer version of Ubuntu.
 
== Installation Options ==
 
This page provides information and scripts to compile and install GNU Radio and its required background applications, libraries, and includes on Ubuntu Linux 6.10 (&quot;Edgy&quot;) or newer; they can probably be applied to some previous versions, though that hasn't been tested.
 
You might not be able to install the newest GNU Radio version unless you backport some of the depencies!
 
== Pre-Requisites for Source Build ==
 
See those for newer Ubuntus.
 
== Install Scripts ==
 
The following are scripts to take most users through a GNU Radio install on a typical Ubuntu install, with the hope that it provides enough guidance such that you can get GNU Radio up and running on your Ubuntu box.
 
* This section is for Edgy or previous only (no changes are needed on Feisty or newer, except possibly to disable the CDROM entry):<br />
Manually uncomment all repositories to include &quot;universe&quot; and &quot;multiverse&quot; either via direct editing
 
<pre>  sudo  /etc/apt/sources.list</pre>
or via the provided GUI: System <s>&gt; Administration</s>&gt; Software Sources. Then enter the admin password for access. On the &quot;Ubuntu&quot; tab, make sure all of &quot;main restricted universe multiverse&quot; are checked and the rest unchecked (or deal with those are you deem correct for your setup). Click &quot;Close&quot;, then &quot;Reload&quot; to update the package list.
 
The uncommented lines of the file &quot;/etc/apt/sources.list&quot; should read something like (DIST is a string with your particular distribution: edgy, feisty, gusty, etc):
 
<pre>deb http://us.archive.ubuntu.com/ubuntu/ DIST main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ DIST-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ DIST-security main restricted universe multiverse</pre>
Update the local dpkg cache:
 
<pre>sudo apt-get update</pre>
Install required packages (some are likely already installed by Ubuntu by default; some are likely redundant with others; but these groups cover all of the required packages, except for in Edgy)
 
* Karmic (9.10)
 
<pre>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 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 python-qwt5-qt4</pre>
* Jaunty (9.04)
 
''Package sdcc-nf needs to be installed (instead of sdcc)''
 
<pre>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 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 python-qwt5-qt4</pre>
'''Note:''' If you are upgrading from an older install, you may have python-wxgtk2.6 installed.<br />
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''
 
<pre>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 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 python-qwt5-qt4</pre>
* Hardy (8.04): '''''Boost should be installed as explained in README.building-boost file'''''
 
<pre>sudo apt-get -y install swig g++ automake1.9 libtool python-dev fftw3-dev \
libcppunit-dev sdcc libusb-dev libasound2-dev libsdl1.2-dev \
python-wxgtk2.8 subversion guile-1.8-dev libqt4-dev python-numpy-ext \
ccache python-opengl libgsl0-dev python-cheetah python-lxml doxygen \
libqwt5-qt4-dev libqwtplot3d-qt4-dev qt4-dev-tools pyqt4-dev-tools</pre>
* Gutsy (7.10): '''''Boost should be installed as explained in README.building-boost file. GSL is required Also'''''
 
<pre>sudo apt-get -y install g++ automake libtool python-dev fftw3-dev \
libcppunit-dev sdcc libusb-dev libasound2-dev \
libsdl1.2-dev python-wxgtk2.8 subversion guile-1.8-dev libgsl0-dev \
libqt3-mt-dev python-numpy-ext swig ccache</pre>
* Feisty (7.04): '''''Boost should be installed as explained in README.building-boost file. GSL is required Also'''''
 
<pre>sudo apt-get -y install g++ automake1.9 libtool python-dev fftw3-dev \
libcppunit-dev sdcc libusb-dev libasound2-dev \
libsdl1.2-dev python-wxgtk2.8 subversion guile-1.6-dev\
libqt3-mt-dev python-numpy-ext swig ccache</pre>
* Edgy (6.10): '''''It is strongly recommended that you use one of the newer releases above'''''
 
<pre>sudo apt-get -y install g++ automake1.9 libtool python-dev fftw3-dev \
libcppunit-dev libboost-dev sdcc libusb-dev libasound2-dev \
libsdl1.2-dev python-wxgtk2.6 subversion guile-1.6-dev \
libqt3-mt-dev python-numpy-ext ccache</pre>
Note that above line for Edgy installs python-wxgtk-2.6. While this is good enough for older gnuradio releases, it is too old for recent gnuradio svn snapshots. If you want to build a recent svn snapshot of gnuradio you need wxgtk version 2.8 or later.<br />
You can install more recent wxgtk versions from the wxwidgets debian and ubuntu repository.<br />
See [http://wiki.wxpython.org/InstallingOnUbuntuOrDebian Installing latest wxgtk-2.8 packages on debian or Ubuntu]
 
Install optional packages, if desired; some might already be installed from the previous command:
 
<pre>sudo apt-get -y install gkrellm wx-common libwxgtk2.8-dev alsa-base autoconf xorg-dev g77 gawk bison openssh-server emacs cvs usbview octave</pre>
For Edgy only: Get, Compile, and Install SWIG
 
<pre>wget http://prdownloads.sourceforge.net/swig/swig-1.3.33.tar.gz
tar zxf swig-1.3.33.tar.gz
cd swig-1.3.33
./configure
make
sudo make install
cd ..</pre>
Optional: Get, Compile, Install QWT 5.0.0 (or newer):
 
* NOTE: You should not need to set the environment variables &quot;QTDIR&quot; or &quot;QWT_CFLAGS&quot;, so leave them be (for now).
 
<pre>wget http://superb-east.dl.sourceforge.net/sourceforge/qwt/qwt-5.0.2.tar.bz2
tar jxf qwt-5.0.2.tar.bz2
cd qwt-5.0.2</pre>
* Now edit ''qwtconfig.pri'':
 
'''''' Change the ''unix'' version of &quot;INSTALLBASE&quot; to &quot;/usr/local&quot; (was &quot;/usr/local/qwt-5.0.2&quot;);
 
'''''' Change &quot;doc.path&quot; to &quot;$$INSTALLBASE/doc/qwt&quot; (was &quot;$$INSTALLBASE/doc&quot;);
 
'''''' Save, exit.<br />
The &quot;doc&quot; portion is in both HTML and man-style, but is all in /usr/local/doc/{html,man}. While this isn't the standard path, there doesn't seem to be an easy way to separate them and thus this is left as is. Then:
 
<pre>qmake
make
sudo make install
cd ..</pre>
=== Install Boost ===
 
For Ubuntu 8.04 and older, download and install Boost 1.35 or later as follows (see README.building-boost file):
 
1) Download the latest version of boost from boost.sourceforge.net (boost_1_37_0.tar.bz2 was the latest when this was written but GNU Radio works with newer versions as well).
 
2) unpack it somewhere and cd into the resulting directory
 
<pre>$ cd boost_1_37_0</pre>
3) Pick a prefix to install it into. For example use /opt/boost_1_37_0
 
<pre>$ BOOST_PREFIX=/opt/boost_1_37_0</pre>
4) Configure
 
<pre>$ ./configure --prefix=$BOOST_PREFIX --with-libraries=thread,date_time,program_options</pre>
5) Compile the package
 
<pre>$ make</pre>
6) Install the package
 
<pre>$ sudo make install
 
$ cd ..</pre>
== Installing GNU Radio ==
 
Download, bootstrap, configure, and compile GNU Radio package:


<pre>
<pre>
# Install GNU Radio from git
sudo apt install python3-matplotlib libsndfile1-dev
 
</pre>
git clone --recursive https://github.com/gnuradio/gnuradio.git
 
cd gnuradio
export LD_LIBRARY_PATH=$BOOST_PREFIX/lib    # As per the instructions for installing Boost
 
./bootstrap
./configure --with-boost=$BOOST_PREFIX  # As per the instructions for installing Boost
make</pre>
Optionally: Run the GNU Radio software self-check; does not require a USRP.
 
<pre>make check</pre>
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 &quot;uname -a&quot;), anything special about the computer hardware, software versions (gcc, g++, swig, sdcc, etc) and how installed (standard or non-standard package, source).
 
Now install GNU Radio for general use (default is in to /usr/local ):
 
<pre>sudo make install</pre>
Make sure you configure USRP support through udev (see top).
 
'''''' NOTE: If installing on Feisty or newer, the computer probably needs to be rebooted in order for the GNU Radio software to interface correctly with the USRP hardware. This does ''not'' seem to be necessary on Edgy.
 
Update the rest of the system, after which you might need or want to reboot:
 
<pre>sudo apt-get -y upgrade</pre>
Update the Linux distro, after which a reboot is required:
 
<pre>sudo apt-get -y dist-upgrade</pre>
== Broken libtool on Debian and Ubuntu ==
 
Because Debian and Ubuntu apply a poorly implemented &quot;enhancement&quot; to the upstream version of libtool,<br />
they break the ability to test code and libraries prior to installing them. We think that testing before<br />
installation is a good idea. To work around their damage, be sure to include<br />
$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<br />
of the build. There are several places it shows up. The first one is often during the build of<br />
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:
 
<pre>cp /etc/ld.so.conf /tmp/ld.so.conf</pre>
2) Add /usr/local/lib path to it :


<pre>echo /usr/local/lib &gt;&gt; /tmp/ld.so.conf</pre>
=== Older Ubuntu Distros ===
3) If you installed Boost (version 1_37_0 for example) manually, then add its library path to the file:


<pre>echo /opt/boost_1_37_0/lib &gt;&gt; /tmp/ld.so.conf</pre>
For older versions of Ubuntu see [[Old Ubuntu Deps]]
4) Delete the original ld.so.conf file and put the modified file instead:


<pre>sudo mv /tmp/ld.so.conf /etc/ld.so.conf</pre>
=== Ubuntu Derivative Distros ===
5) Do ldconfig:


<pre>sudo ldconfig</pre>
* Mint 19.2 is based on Ubuntu 18.04.  Mint 19.2 Cinnamon desktop installs gnome-terminal which may have to be uninstalled for non-gui flowgraphs to run properly.  Mint 19.2 Mate does not install gnome-terminal by default.

Latest revision as of 15:02, 17 October 2023

There's generally no need to build GNU Radio from source code unless you want to modify GNU Radio rather than just using it. The recommended way to install GNU Radio on most platforms is using already compiled binary packages. Binary installation should be sufficient for most users, and certainly for anyone who is new to GNU Radio. However, if you have special requirements, or a binary package is not available for your system, you may need to install GNU Radio from source.

In short: on all modern Ubuntu versions use:

sudo add-apt-repository ppa:gnuradio/gnuradio-releases
sudo apt-get update
sudo apt-get install gnuradio

See our PPA page for more details.

The rest of this page describes dependencies for building GNU Radio from source code.

Install Dependencies

The following commands will install all the required dependencies. Before running them, you should ensure that the "Main" and "Universe" repositories are enabled in "Software Sources".

After installing dependencies you can continue with installing GR from source.

Focal Fossa (20.04) through Mantic Minotaur (23.10)

GNU Radio version 3.8.x with Python 3 support:

sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \
python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \
libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \
liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \
python3-zmq python3-scipy python3-gi python3-gi-cairo gir1.2-gtk-3.0 \
libcodec2-dev libgsm1-dev libusb-1.0-0 libusb-1.0-0-dev libudev-dev

GNU Radio version 3.9.x in addition to above requires:

sudo apt install pybind11-dev python3-matplotlib libsndfile1-dev \
libsoapysdr-dev soapysdr-tools python3-pygccxml python3-pyqtgraph

GNU Radio version 3.10.x and the 'main' branch in addition to above require:

sudo apt install libiio-dev libad9361-dev libspdlog-dev python3-packaging python3-jsonschema

Note: Since GNU Radio 3.9.x swig has been replaced with pybind11 and can be removed:

sudo apt remove swig

Bionic Beaver (18.04) through Eoan Ermine (19.10)

GNU Radio version 3.8.x with Python 3 support:

sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \
python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \
libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \
liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \
python3-zmq python3-scipy

GNU Radio version 3.7.x:

sudo apt install cmake git g++ libboost-all-dev python-dev python-mako \
python-numpy python-wxgtk3.0 python-sphinx python-cheetah swig libzmq3-dev \
libfftw3-dev libgsl-dev libcppunit-dev doxygen libcomedi-dev libqt4-opengl-dev \
python-qt4 libqwt-dev libsdl1.2-dev libusb-1.0-0-dev python-gtk2 python-lxml \
pkg-config python-sip-dev 

Note: GNU Radio 3.9 and up will build from source on Ubuntu 18 only if pybind11 is installed from source as well. Also, pybind11 packages are on the gnuradio-master PPA, so another option is to install pybind from the GR PPA then build gnuradio from source. GNU Radio 3.9 additionally requires:

sudo apt install python3-matplotlib libsndfile1-dev

Older Ubuntu Distros

For older versions of Ubuntu see Old Ubuntu Deps

Ubuntu Derivative Distros

  • Mint 19.2 is based on Ubuntu 18.04. Mint 19.2 Cinnamon desktop installs gnome-terminal which may have to be uninstalled for non-gui flowgraphs to run properly. Mint 19.2 Mate does not install gnome-terminal by default.