|
|
(19 intermediate revisions by the same user not shown) |
Line 3: |
Line 3: |
|
| |
|
| ==Abstract== | | ==Abstract== |
| This Application Note provides a comprehensive guide for building, installing, and maintaining the open-source toolchain for the USRP (UHD and GNU Radio) from source code on the Linux platform. The Ubuntu and Fedora distributions are specifically discussed. Several other alternate installation methods are also discussed.
| |
|
| |
|
| http://files.ettus.com/manual/page_build_guide.html#build_instructions_unix
| | This Application Note provides a comprehensive guide for building and installing the open-source toolchain for the USRP (UHD and GNU Radio) from source code on a Linux platform. UHD is fully supported on Linux using the GCC compiler, and should work on most major Linux distributions. In this document, the Ubuntu 20.04 through 24.04 distributions specifically are discussed. |
| | |
| ==UHD on Linux==
| |
| | |
| UHD is fully supported on Linux, using the GCC compiler, and should work on most major Linux distributions. | |
|
| |
|
| ==Devices== | | ==Devices== |
| This document applies only to the USRP X300, X310, B200, B210, B200mini, N200, N210 devices. The E310 and E312 devices are embedded devices, and are fundamentally different from the other non-embedded USRP devices, and are not addressed by this document.
| |
|
| |
| ==Install Linux==
| |
|
| |
| If you already have a recent version of Linux installed, then you may be able to skip this section. If you are starting from scratch, or simply want to start with a fresh new installation of Linux, then please follow the instructions and recommendations in this section.
| |
|
| |
| We suggest that you use either Ubuntu 16.04.5, Ubuntu 18.04, Ubuntu 18.10, Fedora 27, 28, 29, and that you use a 64-bit architecture, not a 32-bit architecture. There are several re-spins of Ubuntu, such as Xubuntu, Lubuntu, Kubuntu, Linux Mint, all of which should also work. For the purposes of this document, these re-spins can be considered equivalent. Both Ubuntu and Fedora are known to work well with UHD and GNU Radio.
| |
|
| |
| Download and install Ubuntu, Xubuntu, Linux Mint, or Fedora from the links below. Download the appropriate ISO image, and write it to a USB flash drive. Be sure to verify that the ISO file was not corrupted during the download process by checking the MD5 and/or SHA1 hash.
| |
|
| |
| * [http://www.ubuntu.com/download/desktop Ubuntu download page]
| |
| * [http://www.xubuntu.org/getxubuntu/ Xubuntu download page]
| |
| * [https://www.linuxmint.com/download.php Linux Mint download page]
| |
| * [https://getfedora.org/en/workstation/download/ Fedora download page]
| |
|
| |
| You can learn more about Ubuntu, Xubuntu, Linux Mint, and Fedora at the links below.
| |
|
| |
| * [https://en.wikipedia.org/wiki/Ubuntu_%28operating_system%29 Wikipedia article on Ubuntu]
| |
| * [https://en.wikipedia.org/wiki/Xubuntu Wikipedia article on Xubuntu]
| |
| * [https://en.wikipedia.org/wiki/Linux_Mint Wikipedia article on Linux Mint]
| |
| * [https://en.wikipedia.org/wiki/Fedora_%28operating_system%29 Wikipedia article on Fedora]
| |
|
| |
| There are many tools for writing an ISO image to a USB flash drive. In Linux, you can use the "dd" utility, or the UNetbootin utility. On Ubuntu systems, there is also the Startup Disk Creator utility as well.
| |
|
| |
| * [http://unetbootin.sourceforge.net/ UNetbootin homepage]
| |
| * [http://en.wikipedia.org/wiki/UNetbootin Wikipedia article on UNetbootin]
| |
|
| |
| * [https://launchpad.net/usb-creator Startup Disk Creator homepage]
| |
| * [https://en.wikipedia.org/wiki/Startup_Disk_Creator Wikipedia article on Startup Disk Creator]
| |
| * [http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-ubuntu Article about Startup Disk Creator]
| |
|
| |
|
| Be sure to use a USB flash drive with at least 8 GB capacity, and use a USB 3.0 flash drive, not a USB 2.0 flash drive. If you use a slower USB 2.0 flash drive, then the install process will take significantly longer.
| | This document applies only to the USRP X300, X310, B200, B210, B200mini, N200, and N210 devices. The E310 and E312 devices are embedded devices which are fundamentally different from the other non-embedded devices. They are not addressed in this document. |
|
| |
|
| ==Update and Install dependencies== | | ==Update and Install dependencies== |
|
| |
|
| Before building UHD and GNU Radio, you need to make sure that all the dependencies are first installed. | | Before building UHD and GNU Radio, you need to make sure that all the dependencies are installed. |
|
| |
|
| However, before installing any dependencies, you should first make sure that all the packages that are already installed on your system are up-to-date. You can do this from a GUI, or from the command-line, as shown below.
| | 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 "Software Sources"]. |
|
| |
|
| On Ubuntu systems, run:
| | Next, on a terminal screen, run: |
|
| |
|
| sudo apt-get update | | sudo apt-get update |
|
| |
|
| On Fedora 21 systems, run:
| | Once the system has been updated, then install the required dependencies below. |
|
| |
|
| sudo yum update
| | <b>Focal Fossa (20.04) through Noble Numbat (24.04)</b> |
|
| |
|
| On Fedora 22, 23, 24 and 25 systems, run:
| | GNU Radio version 3.8.x with Python 3 support: |
|
| |
|
| sudo dnf update
| | <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 python3-setuptools |
| | </pre> |
|
| |
|
| Once the system has been updated, then install the required dependencies for UHD and GNU Radio.
| | GNU Radio version 3.9.x <b>in addition to above</b> requires: |
|
| |
|
| On Ubuntu 20.04 systems, run:
| | <pre> |
| | sudo apt install pybind11-dev python3-matplotlib libsndfile1-dev \ |
| | libsoapysdr-dev soapysdr-tools python3-pygccxml python3-pyqtgraph |
| | </pre> |
|
| |
|
| sudo apt-get -y install autoconf automake build-essential ccache cmake cpufrequtils doxygen ethtool fort77 g++ gir1.2-gtk-3.0 git gobject-introspection gpsd gpsd-clients inetutils-tools libasound2-dev libboost-all-dev libcomedi-dev libcppunit-dev libfftw3-bin libfftw3-dev libfftw3-doc libfontconfig1-dev libgmp-dev libgps-dev libgsl-dev liblog4cpp5-dev libncurses5 libncurses5-dev libpulse-dev libqt5opengl5-dev libqwt-qt5-dev libsdl1.2-dev libtool libudev-dev libusb-1.0-0 libusb-1.0-0-dev libusb-dev libxi-dev libxrender-dev libzmq3-dev libzmq5 ncurses-bin python3-cheetah python3-click python3-click-plugins python3-click-threading python3-dev python3-docutils python3-gi python3-gi-cairo python3-gps python3-lxml python3-mako python3-numpy python3-numpy-dbg python3-opengl python3-pyqt5 python3-requests python3-scipy python3-setuptools python3-six python3-sphinx python3-yaml python3-zmq python3-ruamel.yaml swig wget
| | GNU Radio version 3.10.x and the 'main' branch <b>in addition to above</b> require: |
|
| |
|
| On Ubuntu 18.10 systems, run:
| | <pre> |
| | | sudo apt install libiio-dev libad9361-dev libspdlog-dev python3-packaging python3-jsonschema python3-qtpy |
| sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.14-0 libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses6-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git libqt4-dev python-numpy ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwtplot3d-qt5-dev pyqt4-dev-tools python-qwt5-qt4 cmake git wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq3-dev libzmq5 python-requests python-sphinx libcomedi-dev python-zmq libqwt-dev libqwt6abi1 python-six libgps-dev libgps23 gpsd gpsd-clients python-gps python-setuptools
| | </pre> |
| | |
| On Ubuntu 18.04 systems, run:
| |
| | |
| sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.14-0 libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git libqt4-dev python-numpy ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwtplot3d-qt5-dev pyqt4-dev-tools python-qwt5-qt4 cmake git wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq3-dev libzmq5 python-requests python-sphinx libcomedi-dev python-zmq libqwt-dev libqwt6abi1 python-six libgps-dev libgps23 gpsd gpsd-clients python-gps python-setuptools
| |
| | |
| | |
| On Ubuntu 17.04 systems, run:
| |
| | |
| sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.13-0v5 libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git-core libqt4-dev python-numpy ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools python-qwt5-qt4 cmake git-core wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq3-dev libzmq5 python-requests python-sphinx libcomedi-dev python-zmq python-setuptools
| |
| | |
| | |
| On Ubuntu 16.04 systems, run:
| |
| | |
| sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.13-0v5 libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git-core libqt4-dev python-numpy ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools python-qwt5-qt4 cmake git-core wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq-dev libzmq1 python-requests python-sphinx libcomedi-dev python-zmq python-setuptools
| |
| | |
| On Ubuntu 15.04 and 15.10 systems, run:
| |
| | |
| sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libqwt6 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-1.13-0v5 libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk2.8 git-core libqt4-dev python-numpy ccache python-opengl libgsl0-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools python-qwt5-qt4 cmake git-core wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq-dev libzmq1 python-requests python-sphinx libcomedi-dev python-zmq python-setuptools
| |
| | |
| On Ubuntu 14.04 and 14.10 systems, run:
| |
| | |
| sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.13-0 libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk2.8 git-core libqt4-dev python-numpy ccache python-opengl libgsl0-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwt5-qt4-dev libqwtplot3d-qt4-dev pyqt4-dev-tools python-qwt5-qt4 cmake git-core wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq1 libzmq-dev python-requests python-sphinx libcomedi-dev python-setuptools
| |
| | |
| On Fedora 21 systems, run:
| |
| | |
| sudo yum -y groupinstall "Engineering and Scientific" "Development Tools" "Software Development Tools" "C Development Tools and Libraries"
| |
|
| |
| sudo yum -y install fftw-devel cppunit-devel wxPython-devel boost-devel alsa-lib-devel numpy gsl-devel python-devel pygsl python-cheetah python-mako python-lxml PyOpenGL qt-devel qt qt4 qt4-devel PyQt4-devel qwt-devel qwtplot3d-qt4-devel libusbx-devel cmake git wget python-docutils cppzmq-devel PyQwt PyQwt-devel qwt-devel gtk2-engines xmlrpc-c-"*" tkinter orc orc-devel python-sphinx SDL-devel swig zeromq2-devel python-zmq comedilib comedilib-devel thrift-devel python-thrift scipy zeromq zeromq-devel
| |
|
| |
| On Fedora 22, 23, 24 and 25 systems, run:
| |
| | |
| sudo dnf -y groupinstall "Engineering and Scientific" "Development Tools" "C Development Tools and Libraries"
| |
|
| |
| sudo dnf -y install fftw-devel cppunit-devel wxPython-devel boost-devel alsa-lib-devel numpy gsl-devel python-devel pygsl python-cheetah python-mako python-lxml PyOpenGL qt-devel PyQt4-devel qwt-devel qwtplot3d-qt4-devel libusbx-devel cmake python-docutils PyQwt PyQwt-devel gtk2-engines xmlrpc-c-"*" tkinter orc-devel python-sphinx SDL-devel swig perl-ZMQ-LibZMQ2 perl-ZMQ-LibZMQ2 zeromq zeromq-devel python-requests gcc-c++ doxygen zeromq-ada-devel cppzmq-devel perl-ZeroMQ amavisd-new-zeromq amavisd-new-snmp-zeromq php-zmq python-zmq czmq uwsgi-logger-zeromq comedilib comedilib-devel pygtk2 ncurses-"*" thrift-devel python-thrift scipy
| |
| | |
| After installing the dependencies, you should reboot the system.
| |
|
| |
|
| If the installation of the dependencies completes without any errors, then you can proceed to build and install UHD and GNU Radio. | | If the installation of the dependencies completes without any errors, then you can proceed to build and install UHD and GNU Radio. |
Line 113: |
Line 52: |
| ==Building and installing UHD from source code== | | ==Building and installing UHD from source code== |
|
| |
|
| UHD is open-source, and is hosted on GitHub. You can browse the code online at the link below, which points to version 3.14.0.0, which is the the latest release at the time of this writing. | | UHD is open-source, and is hosted on GitHub. You can browse the code online at the link below. |
|
| |
|
| * [https://github.com/EttusResearch/uhd/tree/v3.14.0.0 UHD repository on GitHub] | | * [https://github.com/EttusResearch/uhd UHD repository on GitHub] |
|
| |
|
| There are several good reasons to build GNU Radio from source code, especially for doing development and prototyping. It it enables an easy way to customize the location of the installation, and to install multiple UHD versions in parallel, and switch between them. It also provides much more flexibility in upgrading and downgrading versions, and allows the user to modify the code and create customized versions, which could possibly include a patch or other bug-fix.
| | If you want to use GNU Radio with a USRP, install the UHD package from source using the following instructions. UHD sits at the same level as GNU Radio as an independent driver, which gr-uhd references. So if you want gr-uhd enabled, you <b>FIRST</b> must clone and install UHD. |
|
| |
|
| To build UHD from source code, clone the GitHub repository, check out a branch or tagged release of the repository, and build and install. Please follow the steps below. Make sure that no USRP device is connected to the system at this point.
| | For this example, we will start in the home directory to parallel the steps for installing GNU Radio from source. |
|
| |
|
| First, make a folder to hold the repository.
| | <pre>cd $HOME/</pre> |
|
| |
|
| cd $HOME
| | Clone the code into your home directory: |
| mkdir workarea
| |
| cd workarea
| |
|
| |
|
| Next, clone the repository and change into the cloned directory.
| | <pre> |
| | git clone https://github.com/EttusResearch/uhd.git |
| | cd $HOME/uhd |
| | </pre> |
|
| |
|
| git clone <nowiki>https://github.com/EttusResearch/uhd</nowiki>
| | <b>Note:</b> In the following command, change <code>v4.6.0.0</code> to some other branch or tag if you want to build a different version. |
| cd uhd
| | <pre> |
| | | git checkout v4.6.0.0 |
| Next, checkout the desired UHD version. You can get a full listing of tagged releases by running the command:
| | </pre> |
| | |
| git tag -l
| |
| | |
| ''Example truncated output of <code>git tag -l</code>:''
| |
|
| |
|
| | <b>Note:</b> Unlike most GNU Radio build processes, UHD builds under the <code>host</code> directory. |
| <pre> | | <pre> |
| $ git tag -l
| | cd host |
| ...
| | mkdir build |
| release_003_009_004
| | cd build |
| release_003_009_005
| |
| release_003_010_000_000
| |
| ...
| |
| </pre> | | </pre> |
|
| |
|
| '''Note''': As of UHD Version 3.10.0.0, the versioning scheme has changed to be a quadruplet format. Each element and version will follow the format of: '''Major.API.ABI.Patch'''. Additional details on this versioning change can be found [https://files.ettus.com/manual/page_semver.html here].
| | <b>Note:</b> In the following command, we will use <code>-DCMAKE_INSTALL_PREFIX=/usr/local</code> to install UHD into the same prefix as GNU Radio. |
|
| |
|
| After identifying the version and corresponding release tag you need, check it out:
| | cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../ |
|
| |
|
| # Example: For UHD 3.9.5:
| | <b>Note:</b> In the following command, if your computer's CPU has multiple cores, you can use the argument <code>-j#</code> to speed compilation; <br> e.g., <code>make -j3</code> will use 3 threads in the build. Specify at most one less than the number of CPU cores so the system does not appear to 'freeze' during the build. If not specified, then a single thread is used for the build.<br> |
| git checkout release_003_009_005
| |
|
| |
|
| # Example: For UHD 3.14.0.0
| | <pre> |
| git checkout v3.14.0.0
| | make -j3 |
| | | make test |
| Next, create a build folder within the repository.
| | sudo make install |
| | | sudo ldconfig |
| cd host
| | </pre> |
| mkdir build
| |
| cd build
| |
| | |
| Next, invoke CMake.
| |
| | |
| cmake ..
| |
| | |
| '''Note''': if the shell <code>PATH</code> is set such that <code>/bin</code> comes before <code>/usr/bin</code>, then this step is likely to fail because cmake will set the <code>FIND_ROOT_PATH</code> to <code>/</code> and this setting will fail as a prefix for Boost headers or libraries. The cmake output will include messages such as
| |
| | |
| -- Boost include directories: /include
| |
| -- Boost library directories: /lib/x86_64-linux-gnu
| |
| | |
| and
| |
| | |
| CMake Error in lib/CMakeLists.txt:
| |
| Imported target "Boost::chrono" includes non-existent path
| |
| "/include"
| |
| in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
| |
| * The path was deleted, renamed, or moved to another location.
| |
| * An install or uninstall procedure did not complete successfully.
| |
| * The installation package was faulty and references files it does not provide.
| |
| | |
| One of the following 3 options should fix this situation:
| |
| | |
| 1. <code>/usr/bin/cmake ..</code>
| |
| 2. <code>PATH=/usr/bin:$PATH cmake ..</code>
| |
| 3. <code>cmake -DCMAKE_FIND_ROOT_PATH=/usr ..</code>
| |
| | |
| Once the cmake command succeeds without errors, build UHD.
| |
| | |
| make
| |
| | |
| Next, you can optionally run some basic tests to verify that the build process completed properly.
| |
| | |
| make test
| |
| | |
| Next, install UHD, using the default install prefix, which will install UHD under the /usr/local/lib folder. You need to run this as root due to the permissions on that folder.
| |
| | |
| sudo make install
| |
| | |
| Next, update the system's shared library cache.
| |
| | |
| sudo ldconfig
| |
|
| |
|
| Finally, make sure that the <code>LD_LIBRARY_PATH</code> environment variable is defined and includes the folder under which UHD was installed. Most commonly, you can add the line below to the end of your <code>$HOME/.bashrc</code> file: | | Finally, make sure that the <code>LD_LIBRARY_PATH</code> environment variable is defined and includes the folder under which UHD was installed. Most commonly, you can add the line below to the end of your <code>$HOME/.bashrc</code> file: |
|
| |
|
| export LD_LIBRARY_PATH=/usr/local/lib | | export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH |
| | |
| On Fedora 22/23/24/25 you will need to set the <code>LD_LIBRARY_PATH</code> to <code>/usr/local/lib64</code>.
| |
| | |
| export LD_LIBRARY_PATH=/usr/local/lib64
| |
| | |
| If the <code>LD_LIBRARY_PATH</code> environment variable is already defined with other folders in your <code>$HOME/.bashrc</code> file, then add the line below to the end of your <code>$HOME/.bashrc</code> file to preserve the current settings.
| |
|
| |
| export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
| |
| | |
| For Fedora 21/22/23/24/25
| |
| | |
| export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64
| |
|
| |
|
| For this change to take effect, you will need to close the current terminal window, and open a new terminal. | | For this change to take effect, you will need to close the current terminal window, and open a new terminal. |
Line 225: |
Line 103: |
|
| |
|
| <pre> | | <pre> |
| linux; GNU C++ version 4.8.4; Boost_105400; UHD_003.010.000.HEAD-0-g6e1ac3fc | | [INFO] [UHD] linux; GNU C++ version 11.4.0; Boost_107400; UHD_4.6.0.HEAD-0-g50fa3baa |
| | |
| No UHD Devices Found | | No UHD Devices Found |
| </pre> | | </pre> |
|
| |
|
| ===Downloading the UHD FPGA Images===
| | You can now download the UHD FPGA Images for this installation. |
| You can now download the UHD FPGA Images for this installation. This can be done by running the command <code>uhd_images_downloader</code>. | |
| | |
| $ sudo uhd_images_downloader
| |
| | |
| Note: Since this installation is being installed to a system level directory (e.g. <code>/usr/local</code>), the <code>uhd_images_downloader</code> command requires <code>sudo</code> privileges.
| |
| | |
| Example ouput for UHD 3.13.3.0:
| |
| | |
| <pre> | | <pre> |
| $ sudo uhd_images_downloader
| | sudo uhd_images_downloader |
| Images destination: /usr/local/share/uhd/images
| |
| Downloading images from: http://files.ettus.com/binaries/images/uhd-images_003.010.003.000-release.zip
| |
| Downloading images to: /tmp/tmpm46JDg/uhd-images_003.010.003.000-release.zip
| |
| 57009 kB / 57009 kB (100%)
| |
| | |
| Images successfully installed to: /usr/local/share/uhd/images
| |
| </pre> | | </pre> |
|
| |
|
| Example output for UHD 3.13:
| | ==Configuring USB== |
|
| |
|
| | On Linux, udev handles USB plug and unplug events. The following commands install a udev rule so that non-root users may access the device. |
| <pre> | | <pre> |
| $ sudo uhd_images_downloader | | cd $HOME/uhd/host/utils |
| [INFO] Images destination: /usr/local/share/uhd/images
| | sudo cp uhd-usrp.rules /etc/udev/rules.d/ |
| [INFO] No inventory file found at /usr/local/share/uhd/images/inventory.json. Creating an empty one.
| | sudo udevadm control --reload-rules |
| 00006 kB / 00006 kB (100%) usrp1_b100_fw_default-g6bea23d.zip
| | sudo udevadm trigger |
| 19484 kB / 19484 kB (100%) x3xx_x310_fpga_default-g494ae8bb.zip
| |
| 02757 kB / 02757 kB (100%) usrp2_n210_fpga_default-g6bea23d.zip
| |
| 02109 kB / 02109 kB (100%) n230_n230_fpga_default-g494ae8bb.zip
| |
| 00522 kB / 00522 kB (100%) usrp1_b100_fpga_default-g6bea23d.zip
| |
| 00474 kB / 00474 kB (100%) b2xx_b200_fpga_default-g494ae8bb.zip
| |
| 02415 kB / 02415 kB (100%) usrp2_n200_fpga_default-g6bea23d.zip
| |
| 05920 kB / 05920 kB (100%) e3xx_e320_fpga_default-g494ae8bb.zip
| |
| 15883 kB / 15883 kB (100%) n3xx_n310_fpga_default-g494ae8bb.zip
| |
| 00506 kB / 00506 kB (100%) b2xx_b205mini_fpga_default-g494ae8bb.zip
| |
| 18676 kB / 18676 kB (100%) x3xx_x300_fpga_default-g494ae8bb.zip
| |
| 00017 kB / 00017 kB (100%) octoclock_octoclock_fw_default-g14000041.zip
| |
| 04839 kB / 04839 kB (100%) usb_common_windrv_default-g14000041.zip
| |
| 00007 kB / 00007 kB (100%) usrp2_usrp2_fw_default-g6bea23d.zip
| |
| 00009 kB / 00009 kB (100%) usrp2_n200_fw_default-g6bea23d.zip
| |
| 00450 kB / 00450 kB (100%) usrp2_usrp2_fpga_default-g6bea23d.zip
| |
| 00142 kB / 00142 kB (100%) b2xx_common_fw_default-g3ff4186b.zip
| |
| 00460 kB / 00460 kB (100%) b2xx_b200mini_fpga_default-g494ae8bb.zip
| |
| 00319 kB / 00319 kB (100%) usrp1_usrp1_fpga_default-g6bea23d.zip
| |
| 00009 kB / 00009 kB (100%) usrp2_n210_fw_default-g6bea23d.zip
| |
| 11537 kB / 11537 kB (100%) n3xx_n300_fpga_default-g494ae8bb.zip
| |
| 05349 kB / 05349 kB (100%) e3xx_e310_fpga_default-g494ae8bb.zip
| |
| 00866 kB / 00866 kB (100%) b2xx_b210_fpga_default-g494ae8bb.zip
| |
| [INFO] Images download complete.
| |
| | |
| </pre> | | </pre> |
|
| |
| ==Building and installing GNU Radio from source code==
| |
|
| |
| As with UHD, GNU Radio is open-source and is hosted on GitHub. You can browse the code online at the link below, which points to version <code>v3.7.13.4</code>, which is the the latest release at the time of this writing.
| |
|
| |
| * [https://github.com/gnuradio/gnuradio/tree/v3.7.13.4 GNU Radio repository on GitHub]
| |
|
| |
| Note: GNU Radio is currently transitioning from major branches of 3.7.x.x to 3.8.x.x. It is generally recommend at this time to use either the <code>v3.7.13.4</code> or <code>maint-3.7</code> branch of GNU Radio. The <code>master</code> branch includes many major changes such as converting to use Python 3 and may be unstable.
| |
|
| |
|
| |
| As with UHD, there are several good reasons to build GNU Radio from source code, especially for doing development and prototyping. It it enables an easy way to customize the location of the installation, and to install multiple GNU Radio versions in parallel, and switch between them. It also provides much more flexibility in upgrading and downgrading versions, and allows the user to modify the code and create customized versions, which could possibly include a patch or other bug-fix.
| |
|
| |
| Similar to the process for UHD, to build GNU Radio from source code, clone the GitHub repository, check out a branch or tagged release of the repository, and build and install. Please follow the steps below. Make sure that no USRP device is connected to the system at this point.
| |
|
| |
| First, make a folder to hold the repository.
| |
|
| |
| cd $HOME
| |
| cd workarea
| |
|
| |
| Next, clone the repository.
| |
|
| |
| git clone --recursive <nowiki>https://github.com/gnuradio/gnuradio</nowiki>
| |
|
| |
| Next, go into the repository and check out the desired GNU Radio version.
| |
|
| |
| cd gnuradio
| |
|
| |
| To checkout the <code>v3.7.13.4</code> branch:
| |
|
| |
| git checkout v3.7.13.4
| |
|
| |
| Or to checkout the <code>maint-3.7</code> branch:
| |
|
| |
| git checkout maint-3.7
| |
|
| |
| Next, update the submodules:
| |
|
| |
| git submodule update --init --recursive
| |
|
| |
| Next, create a build folder within the repository, invoke CMake, and build GNU Radio:
| |
|
| |
| mkdir build
| |
| cd build
| |
| cmake ../
| |
| make
| |
|
| |
| Next, you can optionally run some basic tests to verify that the build process completed properly.
| |
|
| |
| make test
| |
|
| |
| Next, install GNU Radio, using the default install prefix, which will install GNU Radio under the /usr/local/lib folder. You need to run this as root due to the permissions on that folder.
| |
|
| |
| sudo make install
| |
|
| |
| Finally, update the system's shared library cache.
| |
|
| |
| sudo ldconfig
| |
|
| |
| At this point, GNU Radio should be installed and ready to use. You can quickly test this, with no USRP device attached, by running the following quick tests.
| |
|
| |
| gnuradio-config-info --version
| |
| gnuradio-config-info --prefix
| |
| gnuradio-config-info --enabled-components
| |
|
| |
| There is a simple flowgraph that you can run that does not require any USRP hardware. It's called the dialtone test, and it produces a PSTN dial tone on the computer's speakers. Running it verifies that all the libraries can be found, and that the GNU Radio run-time is working.
| |
|
| |
| python $HOME/workarea/gnuradio/gr-audio/examples/python/dial_tone.py
| |
|
| |
| You can try launching the GNU Radio Companion (GRC) tool, a visual tool for building and running GNU Radio flowgraphs.
| |
|
| |
| gnuradio-companion
| |
|
| |
| If "gnuradio-companion" does not start and complains about the <code>PYTHONPATH</code> environment variable, then you may have to set this in your <code>$HOME/.bashrc</code> file, as shown below.
| |
|
| |
| export PYTHONPATH=/usr/local/lib/python2.7/dist-packages
| |
|
| |
| On Fedora 21/22/23/24, the <code>PYTHONPATH</code> environment variable will need to be set to:
| |
|
| |
| export PYTHONPATH=/usr/lib/python2.7/site-packages:/usr/local/lib64/python2.7/site-packages/
| |
|
| |
| ==Configuring USB==
| |
|
| |
| On Linux, udev handles USB plug and unplug events. The following commands install a udev rule so that non-root users may access the device. This step is only necessary for devices that use USB to connect to the host computer, such as the B200, B210, and B200mini. This setting should take effect immediately and does not require a reboot or logout/login. Be sure that no USRP device is connected via USB when running these commands.
| |
|
| |
| cd $HOME/workarea/uhd/host/utils
| |
| sudo cp uhd-usrp.rules /etc/udev/rules.d/
| |
| sudo udevadm control --reload-rules
| |
| sudo udevadm trigger
| |
|
| |
|
| ==Configuring Ethernet== | | ==Configuring Ethernet== |
Line 376: |
Line 128: |
| ==Connect the USRP== | | ==Connect the USRP== |
|
| |
|
| The installation of UHD and GNU Radio should now be complete. At this point, connect the USRP to the host computer. | | The installation of UHD should now be complete. At this point, connect the USRP to the host computer. |
|
| |
|
| If the interface is Ethernet, then open a terminal window, and try to ping the USRP with "ping 192.168.10.2". The USRP should respond to the ping requests. | | If the interface is Ethernet, then open a terminal window, and try to ping the USRP with "ping 192.168.10.2". The USRP should respond to the ping requests. |
|
| |
|
| If the interface is USB, then open a terminal window, and run "<code>lsusb</code>". You should see the USRP listed on the USB bus with a VID of <code>2500</code> and PID of <code>0020</code>, <code>0021</code>, <code>0022</code>, for B200, B210, B200mini, respectively. | | If the interface is USB, then open a terminal window, and run "<code>lsusb</code>".<br> |
| | You should see the USRP listed on the USB bus with a VID of 2500. The PID should be: |
| | * 0020 for B200 |
| | * 0021 for B200mini |
| | * 0022 for B205mini |
|
| |
|
| Also try running "<code>uhd_find_devices</code>" and "<code>uhd_usrp_probe</code>". | | Also try running "<code>uhd_find_devices</code>" and "<code>uhd_usrp_probe</code>". |
Line 409: |
Line 165: |
|
| |
|
| * [http://files.ettus.com/manual/page_general.html#general_threading_prio Threading Notes section of the User Manual] | | * [http://files.ettus.com/manual/page_general.html#general_threading_prio Threading Notes section of the User Manual] |
| | |
| | ==Building and installing GNU Radio from source code== |
| | |
| | GNU Radio is open-source, and is hosted on GitHub. You can browse the code online at the link below. |
| | |
| | * [https://github.com/gnuradio/gnuradio GNU Radio repository on GitHub] |
| | |
| | The development of GNU Radio is very fast-paced, but the GNU Radio Wiki is kept up to date with all changes. |
| | * For GNU Radio 3.9, 3.10, and the Main branch, click [https://wiki.gnuradio.org/index.php?title=LinuxInstall#Installing_Volk here]. |
| | * For GNU Radio 3.8, click [https://wiki.gnuradio.org/index.php?title=LinuxInstall#Installing_GNU_Radio_2 here]. |
Application Note Number
AN-445
Abstract
This Application Note provides a comprehensive guide for building and installing the open-source toolchain for the USRP (UHD and GNU Radio) from source code on a Linux platform. UHD is fully supported on Linux using the GCC compiler, and should work on most major Linux distributions. In this document, the Ubuntu 20.04 through 24.04 distributions specifically are discussed.
Devices
This document applies only to the USRP X300, X310, B200, B210, B200mini, N200, and N210 devices. The E310 and E312 devices are embedded devices which are fundamentally different from the other non-embedded devices. They are not addressed in this document.
Update and Install dependencies
Before building UHD and GNU Radio, you need to make sure that all the dependencies are installed.
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".
Next, on a terminal screen, run:
sudo apt-get update
Once the system has been updated, then install the required dependencies below.
Focal Fossa (20.04) through Noble Numbat (24.04)
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 python3-setuptools
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 python3-qtpy
If the installation of the dependencies completes without any errors, then you can proceed to build and install UHD and GNU Radio.
Building and installing UHD from source code
UHD is open-source, and is hosted on GitHub. You can browse the code online at the link below.
If you want to use GNU Radio with a USRP, install the UHD package from source using the following instructions. UHD sits at the same level as GNU Radio as an independent driver, which gr-uhd references. So if you want gr-uhd enabled, you FIRST must clone and install UHD.
For this example, we will start in the home directory to parallel the steps for installing GNU Radio from source.
cd $HOME/
Clone the code into your home directory:
git clone https://github.com/EttusResearch/uhd.git
cd $HOME/uhd
Note: In the following command, change v4.6.0.0
to some other branch or tag if you want to build a different version.
git checkout v4.6.0.0
Note: Unlike most GNU Radio build processes, UHD builds under the host
directory.
cd host
mkdir build
cd build
Note: In the following command, we will use -DCMAKE_INSTALL_PREFIX=/usr/local
to install UHD into the same prefix as GNU Radio.
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../
Note: In the following command, if your computer's CPU has multiple cores, you can use the argument -j#
to speed compilation;
e.g., make -j3
will use 3 threads in the build. Specify at most one less than the number of CPU cores so the system does not appear to 'freeze' during the build. If not specified, then a single thread is used for the build.
make -j3
make test
sudo make install
sudo ldconfig
Finally, make sure that the LD_LIBRARY_PATH
environment variable is defined and includes the folder under which UHD was installed. Most commonly, you can add the line below to the end of your $HOME/.bashrc
file:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
For this change to take effect, you will need to close the current terminal window, and open a new terminal.
At this point, UHD should be installed and ready to use. You can quickly test this, with no USRP device attached, by running uhd_find_devices
. You should see something similar to the following.
[INFO] [UHD] linux; GNU C++ version 11.4.0; Boost_107400; UHD_4.6.0.HEAD-0-g50fa3baa
No UHD Devices Found
You can now download the UHD FPGA Images for this installation.
sudo uhd_images_downloader
Configuring USB
On Linux, udev handles USB plug and unplug events. The following commands install a udev rule so that non-root users may access the device.
cd $HOME/uhd/host/utils
sudo cp uhd-usrp.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
Configuring Ethernet
For USRP devices that use Ethernet to connect to the host computer, such as the N200, N210, X300, X310, set a static IP address for your system of 192.168.10.1, with a netmask of 255.255.255.0. The default IP address of the USRP is 192.168.10.2, with a netmask of 255.255.255.0. You should probably set the IP address using the graphical Network Manager. If you set the IP address from the command line with ifconfig
, Network Manager will probably overwrite these settings.
Connect the USRP
The installation of UHD should now be complete. At this point, connect the USRP to the host computer.
If the interface is Ethernet, then open a terminal window, and try to ping the USRP with "ping 192.168.10.2". The USRP should respond to the ping requests.
If the interface is USB, then open a terminal window, and run "lsusb
".
You should see the USRP listed on the USB bus with a VID of 2500. The PID should be:
- 0020 for B200
- 0021 for B200mini
- 0022 for B205mini
Also try running "uhd_find_devices
" and "uhd_usrp_probe
".
Thread priority scheduling
When UHD spawns a new thread, it may try to boost the thread's scheduling priority. If setting the new priority fails, the UHD software prints a warning to the console, as shown below. This warning is harmless; it simply means that the thread will retain a normal or default scheduling priority.
UHD Warning:
Unable to set the thread priority. Performance may be negatively affected.
Please see the general application notes in the manual for instructions.
EnvironmentError: OSError: error in pthread_setschedparam
To address this issue, non-privileged (non-root) users need to be given special permission to change the scheduling priority. This can be enabled by creating a group usrp
, adding your user to it, and then appending the line @usrp - rtprio 99
to the file /etc/security/limits.conf
.
sudo groupadd usrp
sudo usermod -aG usrp $USER
Then add the line below to end of the file /etc/security/limits.conf
:
@usrp - rtprio 99
You must log out and log back into the account for the settings to take effect. In most Linux distributions, a list of groups and group members can be found in the /etc/group
file.
There is further documentation about this in the User Manual at the link below.
Building and installing GNU Radio from source code
GNU Radio is open-source, and is hosted on GitHub. You can browse the code online at the link below.
The development of GNU Radio is very fast-paced, but the GNU Radio Wiki is kept up to date with all changes.
- For GNU Radio 3.9, 3.10, and the Main branch, click here.
- For GNU Radio 3.8, click here.