Ubuntu 18.04 source code compilation and installation of UHD and GNU Radio3.9

1 Install UHD

1.1 Update first

sudo apt-get update

1.2 Installation dependencies

My system is 18.04. The following are the installation dependencies corresponding to Ubuntu 18.04. Other system versions can be found in the official website link.

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

1.3 Open the ~ directory and create a new workarea folder to store UHD installation files.

cd $HOME
mkdir workarea
cd workarea

Create a new UHD folder to store and install UHD.

mkdir uhd

1.4 Download source code

I do not use the git clone method to install here (I have found through practice that this method of downloading by yourself is more convenient). Instead, I go to the official website and compress the package myself. This way the download speed is fast, and the corresponding UHD version can be downloaded as needed.

Official website link to download the compressed package:

https://files.ettus.com/binaries/uhd_stable/https://files.ettus.com/binaries/uhd_stable/icon-default.png?t=N7T8 https://files.ettus.com/binaries/uhd_stable/

Copy the downloaded UHD compressed package to the working directory. The operation here is completed by opening a new terminal in the download directory.

cp uhd_4.1.0.4-release.tar.gz ~/workarea/uhd/

Go back to the workarea directory, open the UHD folder, and use ls to check whether the compressed package has been copied. Then decompress the copied compressed package.

tar -zxvf uhd_4.1.0.4-release.tar.gz

?

In the uhd folder, decompress the compressed package and you will get three folders: host images tools, ls is as shown below.

?

1.5 Compilation

Open the host folder, create a new build folder, open the build folder, and prepare to compile.

cd host
mkdir build
cd build

?

Execute CMake

cmake..

?

After cmake is completed, make sure that no errors occur as shown in the picture above, and there are errors that need to be resolved.

After cmake is successful, the compilation starts below, and the waiting time for compilation is relatively long (you need to wait slowly until 100%)

make

?

Next, verify the compilation

make test

?

Make sure that make test passes before installing.

1.6 Install UHD

sudo make install

After the installation is complete, configure the environment variables.

sudo ldconfig

Open the following file with a text editor, here I use gedit

gedit $HOME/.bashrc

Add the following statement at the end of the file

export LD_LIBRARY_PATH=/usr/local/lib

?

1.7 Installation Test

Close the terminal, reopen a new terminal, and enter the following command to test whether UHD is installed successfully.

uhd_find_devices

?

Because I did not connect the USRP device, No UHD Devices Found was displayed, but the UHD version information could be printed, which is consistent with the installed version, which is UHD_4.1.0.4

At this point, the UHD installation is complete.

Reference:

https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linuxhttps://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linuxicon-default.png?t =N7T8https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linux

https://www.cnblogs.com/jsdy/p/11420189.htmlhttps://www.cnblogs.com/jsdy/p/11420189.htmlicon-default.png?t =N7T8https://www.cnblogs.com/jsdy/p/11420189.html

https://blog.csdn.net/weixin_41111187/article/details/124986143https://blog.csdn.net/weixin_41111187/article/details/124986143icon-default.png?t =N7T8https://blog.csdn.net/weixin_41111187/article/details/124986143

2 Install GNU Radio3.9

2.1 Preparation

Refer to official requirements

UbuntuInstall – GNU Radiohttps://wiki.gnuradio.org/index.php?title=UbuntuInstall#Focal_Fossa_.2820.04.29_through_Impish_Indri_.2821.10.29icon-default.png?t=N7T8\ https://wiki.gnuradio.org/index.php?title=UbuntuInstall#Focal_Fossa_.2820.04.29_through_Impish_Indri_.2821.10.29 Our system is Ubuntu 18.04,

If you install GNU Radio 3.8.x, you need to install the following dependencies

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

If you install GNU Radio 3.9, required dependencies

sudo apt install python3-matplotlib libsndfile1-dev

sudo apt install pybind11-dev python3-matplotlib

If you want to install version 3.9 and above in 18.04, you need to pay attention to the tips on the official website:

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

Modify the default python to python3

sudo update-alternatives –install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives –install /usr/bin/python python /usr/bin/python3 150

For preparation work, please refer to the following articles

Super detailed ubuntu18.04 installation of UHD and GNURadio_Installation of uhd_Blog of choice and effort-CSDN blog 1. Version number System environment: ubuntu18.04UHD: v3.14.1.0GNU radio: v3.92. Reference link before referring to this tutorial , it is recommended to browse the following reference links to make a preliminary judgment on the right and wrong of the installation process, and to understand which steps are more critical (1) ettus official tutorial: Building and Installing the USRP Open-Source Toolchain (UHD and GNU Radio) on Linux ( 2) Gnuradio official tutorial: InstallingGR (3) Reference blog: ubuntu18.04an https://blog.csdn.net/weixin_41111187/article/details/124986143icon-default.png? t=N7T8https://blog.csdn.net/weixin_41111187/article/details/124986143Install volk according to the reference article above.

cd workarea/
git clone --recursive https://github.com/gnuradio/volk.git
cdvolk
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make
make test
sudo make install
sudo ldconfig

2.2 Compilation

After the preparation work is completed, you can start the installation. There are also two ways to download the source code, one is to directly git clone, and the other is to download and decompress it by yourself.

The download link is given here. Students who do not want to use git clone can download the required version here, and then unzip and install it.

Index of /releases/gnuradio/icon-default.png?t=N7T8https://www.gnuradio.org/releases/gnuradio/This time GNU Radio is installed and used git clone method.

When using git clone, make sure the network is smooth. Version 3.9 is installed here, so you need to checkout version 3.9 after cloning. Enter the following commands in order.

cd workarea/
git clone –recursive https://github.com/gnuradio/gnuradio
cdgnuradio
git checkout maint-3.9
mkdir build
cd build

?

Enter the following command to execute cmake

cmake ../

After cmake is successful, compile.

make -j16

-j16 means using 16 cores (the specific number depends on your own CPU core number and can be changed as needed) for compilation, which will be much faster.

After compilation is completed, perform compilation testing.

make test

It shows 100% test success, and then you can continue to the next step. Note: There are 248 test items in version 3.9.8 here. If there are only 30 test items, it means that the previous steps are wrong and you need to re-execute the download and compilation steps.

2.3 Installation

Perform installation

sudo make install

Configure environment variables

echo 'export PYTHONPATH=/usr/local/lib/python3/dist-packages:usr/local/lib/python2.7/site-packages:$PYTHONPATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
echo 'export PYTHONPATH=/usr/local/lib/python3/dist-packages:usr/local/lib/python2.7/site-packages:$PYTHONPATH' >> ~/.profile
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.profile
sudo ldconfig

Check version

gnuradio-config-info –version

Open the GNU Radio software

sudo gnuradio-companion

The default software interface can be automatically opened, as shown below:

View version information in the software

The following are detailed official website installation steps, please read and refer to them carefully.

LinuxInstall – GNU Radiohttps://wiki.gnuradio.org/index.php?title=LinuxInstallicon-default.png?t=N7T8https://wiki.gnuradio. org/index.php?title=LinuxInstall