Difference between revisions of "Building and Installing the USRP Open Source Toolchain (UHD and GNU Radio) on Windows"

From Ettus Knowledge Base
Jump to: navigation, search
(Created page with "==Application Note Number== '''AN-####''' ==Revision History== {| class="wikitable" !Date !Author !Details |- |style="text-align:center;"| 2016-01-19 |style="text-align:cente...")
 
Line 1: Line 1:
 
==Application Note Number==
 
==Application Note Number==
'''AN-####'''
+
'''AN-611'''
  
 
==Revision History==
 
==Revision History==
Line 66: Line 66:
 
LibUSB releases are distributed in 7zip archives, the free 7zip program needed to open them is available at http://www.7-zip.org/download.html. After installing 7zip the LibUSB release archive can be extracted by right clicking on the downloaded file and selecting <tt>7zip > Extract files</tt>.
 
LibUSB releases are distributed in 7zip archives, the free 7zip program needed to open them is available at http://www.7-zip.org/download.html. After installing 7zip the LibUSB release archive can be extracted by right clicking on the downloaded file and selecting <tt>7zip > Extract files</tt>.
  
LibUSB 1.20 was used for the guide and extracted to <tt>C:\Users\username\ libusb-1.0.20</tt>.
+
LibUSB 1.20 was used for the guide and extracted to <syntaxhighlight lang="python" enclose="none">C:\Users\username\ libusb-1.0.20</syntaxhighlight>.
  
 
http://sourceforge.net/projects/libusb/files/libusb-1.0/
 
http://sourceforge.net/projects/libusb/files/libusb-1.0/
Line 116: Line 116:
 
7zip can be used to extract the <tt>tar.gz</tt> archive to a location of your choosing.
 
7zip can be used to extract the <tt>tar.gz</tt> archive to a location of your choosing.
  
The guide uses the 3.9.2 release and extracted it to <tt>C:\Users\username\uhd-release_003_009_002</tt>.
+
The guide uses the 3.9.2 release and extracted it to <syntaxhighlight lang="python" enclose="none">C:\Users\username\uhd-release_003_009_002</syntaxhighlight>.
  
 
===From the Git repository===
 
===From the Git repository===
Line 132: Line 132:
 
* Open the Cmake GUI
 
* Open the Cmake GUI
 
* Select source code directory
 
* Select source code directory
*: <tt>C:\Users\username\uhd-release_003_009_002\</tt>
+
*: <syntaxhighlight lang="python" enclose="none">C:\Users\username\uhd-release_003_009_002\</syntaxhighlight>
 
* Select binary build directory
 
* Select binary build directory
*: <tt>C:\Users\username\uhd-release_003_009_002\build</tt>
+
*: <syntaxhighlight lang="python" enclose="none">C:\Users\username\uhd-release_003_009_002\build</syntaxhighlight>
 
* Check the Advanced checkbox
 
* Check the Advanced checkbox
 
* Click Configure
 
* Click Configure
 
** Set Visual Studio 12 2013 Win64 as the compiler
 
** Set Visual Studio 12 2013 Win64 as the compiler
 
* Change or add the following entries
 
* Change or add the following entries
*; '''Boost_INCLUDE_DIR''' : <tt>C:/local/boost_1_58_0</tt>
+
*; '''Boost_INCLUDE_DIR''' : <syntaxhighlight lang="python" enclose="none">C:/local/boost_1_58_0</syntaxhighlight>
 
* Add the following entries with type PATH
 
* Add the following entries with type PATH
*; '''Boost_LIBRARY_PATH''' : <tt>C:/local/boost_1_58_0/lib64-msvc-12.0</tt>
+
*; '''Boost_LIBRARY_PATH''' : <syntaxhighlight lang="python" enclose="none">C:/local/boost_1_58_0/lib64-msvc-12.0</syntaxhighlight>
*; '''LIBUSB_INCLUDE_DIRS''' : <tt>C:/Users/username/libusb-1.0.20/include/libusb-1.0</tt>
+
*; '''LIBUSB_INCLUDE_DIRS''' : <syntaxhighlight lang="python" enclose="none">C:/Users/username/libusb-1.0.20/include/libusb-1.0</syntaxhighlight>
 
* Add the following entry with type FILEPATH
 
* Add the following entry with type FILEPATH
*; '''LIBUSB_LIBRARIES''' : <tt>C:/Users/username/libusb-1.0.20/MS64/dll/libusb-1.0.lib</tt>
+
*; '''LIBUSB_LIBRARIES''' : <syntaxhighlight lang="python" enclose="none">C:/Users/username/libusb-1.0.20/MS64/dll/libusb-1.0.lib</syntaxhighlight>
 
* Click Generate
 
* Click Generate
  
Line 150: Line 150:
  
 
Open Visual Studio 2013 and open the UHD project file generated by CMake.
 
Open Visual Studio 2013 and open the UHD project file generated by CMake.
; <tt>File > Open Project</tt> : <tt>C:\Users\username\uhd-release_003_009_002\build\UHD.sln</tt>
+
; <tt>File > Open Project</tt> : <syntaxhighlight lang="python" enclose="none">C:\Users\username\uhd-release_003_009_002\build\UHD.sln</syntaxhighlight>
  
 
Change the build type from Debug to Release. The **ALL_BUILD** project should be selected already. Run the build, <tt>Build > Build Solution</tt>.
 
Change the build type from Debug to Release. The **ALL_BUILD** project should be selected already. Run the build, <tt>Build > Build Solution</tt>.
  
===Installing UHD===
+
==Installing UHD==
  
 
Select the '''INSTALL''' project and run the build, <tt>Build > Build Solution</tt>.
 
Select the '''INSTALL''' project and run the build, <tt>Build > Build Solution</tt>.
  
Visual Studio must be run as Administrator for this to succeed as it needs write permission for the <tt>C:\Program Files</tt> directory.
+
Visual Studio must be run as Administrator for this to succeed as it needs write permission for the <syntaxhighlight lang="python" enclose="none">C:\Program Files</syntaxhighlight> directory.
  
 
===Compiling a binary installer===
 
===Compiling a binary installer===
Line 164: Line 164:
 
Building the '''PACKAGE''' project will produce a binary installer if NSIS is installed. This installer with be for either 64 bit or 32 bit as chosen during the CMake step.
 
Building the '''PACKAGE''' project will produce a binary installer if NSIS is installed. This installer with be for either 64 bit or 32 bit as chosen during the CMake step.
  
===Running UHD===
+
==Running UHD==
  
 
Running programs using UHD requires the Visual Studio C++ Runtime Redistributable to be installed. The version of the C++ Runtime Redistributable must match the version of Visual Studio used to compile the program.
 
Running programs using UHD requires the Visual Studio C++ Runtime Redistributable to be installed. The version of the C++ Runtime Redistributable must match the version of Visual Studio used to compile the program.
Line 173: Line 173:
 
*: https://support.microsoft.com/en-us/kb/2977003
 
*: https://support.microsoft.com/en-us/kb/2977003
  
===Installing the USB driver===
+
==Installing the USB driver==
  
If a USB connected USRP is used then the USB drivers must be installed.
+
If a USB connected USRP is used then the USB drivers must be installed. The drivers are located at http://files.ettus.com/binaries/misc/erllc_uhd_winusb_driver.zip.
 +
 
 +
There is a known issue with Windows 10 where an error message is shown at the end of driver installation. However resetting or power cycling the USRP enables full functionality.
 +
 
 +
==GNU Radio==
 +
 
 +
Building GNU Radio from source on Windows is still an involved process due to the large number of dependencies. A set of scripts have been developed to automate the process and the various installation options are documented on the GNU Radio website.
 +
 
 +
http://gnuradio.org/redmine/projects/gnuradio/wiki/WindowsInstall

Revision as of 19:04, 16 May 2016

Application Note Number

AN-611

Revision History

Date Author Details
2016-01-19 Derek Kozel Initial creation

Abstract

This Application Note provides a step-by-step guide for building, installing, and updating the open-source toolchain, specifically UHD and GNU Radio, for the USRP from source code on Windows.

UHD on Windows

UHD is fully supported on Windows 7, 8, 8.1, and 10 and can be compiled using Visual Studio 2012, 2013, or 2015. The future target is to support the latest three OS and Visual Studio releases.

Setup the Environment

The following dependencies are required for a regular build.

  • Microsoft Windows (7, 8, 8.1, 10)
  • Microsoft Visual Studio (2012, 2013, 2015)
  • CMake (3.4.0 or later)
  • Boost (1.56 or later)
  • LibUSB (1.0 or later)
  • Python (2.7.x)
  • Mako (0.5.0 or later)
  • Doxygen (1.8 or later, optional)
  • NSIS (2.50 or later, optional)

Installing the dependencies

Microsoft Visual Studio

The free Express version of Visual Studio is sufficient for building UHD. This guide was tested using MSVC Express 2013.

CMake

CMake is a cross-platform build system used to configure and generate the files necessary to compile and test UHD for a particular computer environment.

During installation select the option to add CMake to the PATH for the current user.

CMake 3.4.1 win32 was used for the guide.

https://cmake.org/download/

Boost

Boost is a set of C++ libraries providing useful algorithms and data structures.

The Boost binary installer must be selected to match the version of MSVC being used to compile UHD and architecture of Windows being run. Watch out as Microsoft has done the version numbering of MSVC such that the year and version number do not match.

MSVC 2013 is version 12 so boost_1_58_0-msvc-12.0-64 was selected.

http://sourceforge.net/projects/boost/files/boost-binaries/

LibUSB

LibUSB is a cross-platform library providing access to USB devices.

LibUSB releases are distributed in 7zip archives, the free 7zip program needed to open them is available at http://www.7-zip.org/download.html. After installing 7zip the LibUSB release archive can be extracted by right clicking on the downloaded file and selecting 7zip > Extract files.

LibUSB 1.20 was used for the guide and extracted to C:\Users\username\ libusb-1.0.20.

http://sourceforge.net/projects/libusb/files/libusb-1.0/

Python

Python is a widely used general-purpose, high-level programming language. UHD includes several utilities written in Python and has several scripts which are part of the build process.

The latest Python 2 release, 2.7.11 was used.

https://www.python.org/downloads/

Mako

Mako is a python template library used to generate source files and is distributed using a Python package management system.

Open a command line (Ctrl-X, select run, type cmd.exe and click ok)

   cd C:\Python27\Scripts
   pip.exe install mako

This installed version 1.0.3 at the time of writing this guide.

Doxygen

Doxygen is a documentation generator which creates the HTML manual from text in the source code. It optional for building UHD.

Version 1.8.11 was used for this guide.

http://www.stack.nl/~dimitri/doxygen/download.html

NSIS

NSIS is a toolkit for creating Windows installers. NSIS is used for creating binary packages of UHD enabling easy distribution and installation of UHD, associated utilities, and examples.

Version 2.50 was used for this guide.

http://nsis.sourceforge.net/Download

Obtain the UHD source code

From a release source archive

Archives of the source code for each stable release can be downloaded from the Ettus website.

http://files.ettus.com/binaries/uhd/src/

7zip can be used to extract the tar.gz archive to a location of your choosing.

The guide uses the 3.9.2 release and extracted it to C:\Users\username\uhd-release_003_009_002.

From the Git repository

The latest development code, as well as tagged releases, is available from the git repository hosted on GitHub

https://www.github.com/EttusResearch/uhd

Building

All prerequisites have now been installed and downloaded.

Configuring the Building

  • Open the Cmake GUI
  • Select source code directory
    C:\Users\username\uhd-release_003_009_002\
  • Select binary build directory
    C:\Users\username\uhd-release_003_009_002\build
  • Check the Advanced checkbox
  • Click Configure
    • Set Visual Studio 12 2013 Win64 as the compiler
  • Change or add the following entries
    Boost_INCLUDE_DIR 
    C:/local/boost_1_58_0
  • Add the following entries with type PATH
    Boost_LIBRARY_PATH 
    C:/local/boost_1_58_0/lib64-msvc-12.0
    LIBUSB_INCLUDE_DIRS 
    C:/Users/username/libusb-1.0.20/include/libusb-1.0
  • Add the following entry with type FILEPATH
    LIBUSB_LIBRARIES 
    C:/Users/username/libusb-1.0.20/MS64/dll/libusb-1.0.lib
  • Click Generate

Compiling UHD

Open Visual Studio 2013 and open the UHD project file generated by CMake.

File > Open Project 
C:\Users\username\uhd-release_003_009_002\build\UHD.sln

Change the build type from Debug to Release. The **ALL_BUILD** project should be selected already. Run the build, Build > Build Solution.

Installing UHD

Select the INSTALL project and run the build, Build > Build Solution.

Visual Studio must be run as Administrator for this to succeed as it needs write permission for the C:\Program Files directory.

Compiling a binary installer

Building the PACKAGE project will produce a binary installer if NSIS is installed. This installer with be for either 64 bit or 32 bit as chosen during the CMake step.

Running UHD

Running programs using UHD requires the Visual Studio C++ Runtime Redistributable to be installed. The version of the C++ Runtime Redistributable must match the version of Visual Studio used to compile the program.

Installing the USB driver

If a USB connected USRP is used then the USB drivers must be installed. The drivers are located at http://files.ettus.com/binaries/misc/erllc_uhd_winusb_driver.zip.

There is a known issue with Windows 10 where an error message is shown at the end of driver installation. However resetting or power cycling the USRP enables full functionality.

GNU Radio

Building GNU Radio from source on Windows is still an involved process due to the large number of dependencies. A set of scripts have been developed to automate the process and the various installation options are documented on the GNU Radio website.

http://gnuradio.org/redmine/projects/gnuradio/wiki/WindowsInstall