# Software Setup

In most instances, there are two pieces of software that you will be needing: libUHD and GNU Radio. Most package managers have a version of libUHD that is compiled by Ettus for their radio products. At Per Vices, we maintain our own fork of libUHD. This allows for easy interfacing with software devices, and provides some compatibility with USRP devices. For more on these differences, check out our application note on use and operations. While you are unlikely to notice these differences when using the software, you will have to take some care to make sure that the correct (Per vices) version of UHD is what gets installed.

In most instances, there are two pieces of software that you will be needing: libUHD and GNU Radio. Most package managers have a version of libUHD that is compiled by Ettus for their radio products. At Per Vices, we maintain our own fork of libUHD that looks and operates similarly with one main exception: it supports the Crimson TNG and Cyan radios that we manufacture. While you likely won’t notice the differences when using the software, you will have to take some care to make sure the correct (Per vices) version is what gets installed.

At run-time, GNU Radio compares the version of the UHD library used during compilation with the presently installed version. If there is a difference, it generates an error message. This is most often caused when using a distribution provided version of gnuradio that has been compiled with the Ettus libUHD version. Ensuring that you have correctly installed the Per Vices libUHD version, and then recompiling gnuradio ensures consistency in the library versions and fixes any errors.

##### Figure 8: Overview of libUHD installation process

If you already have GNU Radio installed on your host computer, you need to first uninstall it (also uninstall the Ettus libUHD library, if applicable). Next, ensure the Per Vices libUHD version is correctly installed and reboot the computer. Finally, compile and install GNU Radio from source.

We use archlinux internally for development and testing. Installing uhd and GNU Radio on other distributions may be slightly more challenging.

Note

## 1. Installing from Binaries

Note

when installing from source, the packaged binaries for each distribution are created using the dockerfiles specified in the pvpkg repository.

### 1.1. Archlinux Binaries

You will want to first install the UHD package, and then the GNU Radio package.

#### Archlinux UHD Package/Binaries

The UHD package is available here, which are used to build the binaries.

To build our UHD package in the command line and create the binaries (.tar file), use the following:

$wget https://raw.githubusercontent.com/pervices/pvpkg/master/Arch/UHD/PKGBUILD$ makepkg
Then use pacman command to install .tar file generated.

The GNU Radio package is available here, which are used to build the binaries.

To build our GNU Radio package in the command line and create the binaries (.tar file), use the following:

$wget https://raw.githubusercontent.com/pervices/pvpkg/master/Arch/GnuRadio/PKGBUILD$ makepkg

Then use pacman command to install .tar file generated.

### 1.2. Ubuntu 20.04 Binaries

#### Ubuntu UHD Package/Binaries

$git clone https://github.com/pervices/pvpkg 2. Run the following command within pvpkg/ubuntu/20.04/pkg/uhd: $ dpkg -i uhd*.deb

3. The above command will most likely fail with missing dependencies, but the install will work by subsequently running the following command:

$apt --fix-broken install #### Ubuntu GNU Radio Package/Binaries 1. Download the Per Vices Ubuntu package: $ git clone https://github.com/pervices/pvpkg

2. The first step to installing GNU Radio is by installing all the necessary library .deb files within pvpkg/ubuntu/20.04/pkg/gnuradio, using the following command:

$dpkg -i libgnuradio*.deb 3. The full Debian package is installed by running the following command from the same directory as the previous command: $ dpkg -i gnuradio*.deb

4. The above command will most likely fail with missing dependencies, but the install will work by subsequently running the following command:
$apt --fix-broken install ### 1.3. Ubuntu 18 Binaries TBD ### 1.4. Centos Binaries TBD ## 2. Compiling from Source (Using a Package Manager) We automatically compile the UHD and GNU Radio binaries used with our product using dockerfiles found in the pvpkg repo, for specific distributions, including ArchLinux, Ubuntu, and Centos. We encourage you to clone this repo, as it includes a number of patches and dependencies required to make the installation easier, and it also allows you to use your package manager for installation. You can clone the repo as follows; $ git clone https://github.com/pervices/pvpkg
To build the package, we use a Jenkinsfile. Instructions on how to install Jenkins is found in the README.md file within the above repo. You may also create the required binaries yourself, using the dockerfiles associated with each distribution.

### 2.1. Archlinux

To compile the current UHD binaries from source, you can use the dockerfile to help determine the required dependencies necessary to compile UHD and Gnuradio from your own distribution. This dockerfile assumes a clean installation of archlinux, and presents you with a guide on how to install it.

We suggest cloning the pvpkg repo, and then entering the arch subdirectory. This includes the required dependencies, along with a dockerfile that may be used to help guide installation.

In particular, you’ll first need to install the required dependencies for archlinux. You can find these dependencies in the archlinux dockerfile, which specifies all the steps we use to automatically build the archlinux binaries we post.

From there, you can use the archlinux UHD PKGBUILD script, also included in the pvpkg repo, to download the latest UHD library from github, and install all the required dependencies.

### 2.2 Ubuntu

We suggest first cloning the pvpkg repo:

$git clone https://github.com/pervices/pvpkg Then, you can use the dockerfile for ubuntu20.04 as a guide, as shown here. ## 3.1. Compiling from Source Manually Provided you’re prepared to resolve your own dependencies, you can easily compile UHD and Gnuradio from source. The specific commands and flags used to compile the sources, are most easily found within the Archlinux PKGBUILD associated with each application. ### 3.2. Manual Compilation Tips If you are committed to using another operating system, then you will want to build GNU Radio and UHD from source. However, your package manager can be useful for obtaining the necessary dependencies. We suggest installing all GNU Radio and UHD dependencies using your distribution package management system, and then actually installing GNU Radio and UHD from source. 1. Install all GNU Radio and UHD dependencies, but do NOT actually install GNU Radio or UHD. • You need to ensure that you have all the required install dependencies. • Though you will try to avoid installing GNU Radio or UHD 2. After installing the required dependencies, confirm that you do NOT have any of the following installed; • gnuradio • libgnuradio • libvolk • libuhd • uhd-host 3. If you have previously attempted to install GNU Radio or UHD from source, confirm that you do not have any residual files. • Ideally, if you still have the original source directory, you can run ?make uninstall? as root, to delete all the installed files. • The default installation settings see gnuradio installed in /usr/local/{bin,lib…}. Check each of the subdirectories in /usr/src to see whether you have old installation files. The presence of these files WILL cause problems down the road; either move them somewhere else, or delete them. 4. Download the Per Vices UHD driver sources code, and compile and install it. • For compatability, you may want to use the -DCMAKE_INSTALL_PREFIX=/usr cmake flag to install binaries to /usr (this is consistent with most linux distributions). • In order to successfully install the remaining components, you will need to have successfully installed the Per Vices UHD driver. • We recommend confirming that you have installed the correct uhd version, by typing; uhd_find_devices -v and confirming that the version number matches what you expect. 5. Download the gnuradio source code, compile and install it. • The gnuradio application needs to use the systems python interpreter and some accompanying python libraries to run. To ensure that our system can locate these tools, we will need to ensure that the PYTHONPATH and LD_LIBRARY_PATH are properly set. • You can verify that the LD_LIBRARY_PATH is set correctly using sudo ldconfig echo 'export PYTHONPATH=/usr/local/lib/python3/dist-packages:usr/local/lib/python2.7/site-packages:$PYTHONPATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/user/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=/user/local/lib:\$LD_LIBRARY_PATH' >> ~/.profile

## 4. After installation

Confirm your installation by testing successful set up and operation.