Note: More build information can be found on the UHD wiki page, at http://code.ettus.com/redmine/ettus/projects/uhd/wiki .
Linux Notes: This is dependent on the distribution you are using, but most, if not all, of the dependencies should be available in the package repositories for your package manager.
Mac OS X Notes: Install the Xcode app to get the build tools (GCC and Make). Use MacPorts to get the Boost and Cheetah dependencies. Other dependencies can be downloaded as DMG installers from the web or installed via MacPorts. See the UHD OS X page for more information: http://code.ettus.com/redmine/ettus/projects/uhd/wiki/UHD_OS_X
Windows Notes: The dependencies can be acquired through installable EXE files. Usually, the Windows installer can be found on the project's website. Some projects do not host Windows installers, and if this is the case, follow the auxiliary download URL for the Windows installer (below).
Required to check out the repository. On Windows, install Cygwin with Git support to checkout the repository or install msysGit from http://code.google.com/p/msysgit/downloads/list.
The following compilers are known to work and officially supported:
Other compilers (or lower versions) may work, but are unsupported.
Download URL (Windows installer): http://feisley.com/python/cheetah/
Alternative method:** Install setuptools, and use the easy_install command to install Cheetah. http://pypi.python.org/pypi/setuptools
Download URL: http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc
Alternate method:** Install setuptools, and use the easy_install command to install Docutils. http://pypi.python.org/pypi/setuptools
cd <uhd-repo-path>/host mkdir build cd build cmake ../
Additionally, configuration variables can be passed into CMake via the command line. The following common-use configuration variables are listed below:
-DCMAKE_INSTALL_PREFIX=<install-path>
cmake -DLIB_SUFFIX=64
Example usage:
cmake -DCMAKE_INSTALL_PREFIX=/opt/uhd ../
make make test sudo make install
Make sure that libuhd.so
is in your LD_LIBRARY_PATH
, or add it to /etc/ld.so.conf
and make sure to run:
sudo ldconfig
<uhd-repo-path>/host
.<uhd-repo-path>/host/build
.On Windows, CMake does not have the advantage of pkg-config
, so we must manually tell CMake how to locate the LibUSB header and lib.
LIBUSB_INCLUDE_DIRS
to the directory with libusb.h
.LIBUSB_LIBRARIES
to the full path for libusb-1.0.lib
.libusb-1.0.lib
to simplify runtime dependencies.Note: On Windows, LibUSB v1.0.19 is required to use most USB3 controllers.
Note: You may not have permission to build the install target. You need to be an administrator or to run MSVC as administrator.
Open the Visual Studio Command Prompt Shorcut:
cd <uhd-repo-path>\host\build DevEnv uhd.sln /build Release /project ALL_BUILD DevEnv uhd.sln /build Release /project INSTALL
Add the UHD bin path to PATH%
(usually C:\\Program Files\\UHD\\bin
)
Note: The default interface for editing environment variable paths in Windows is very poor. We recommend using "Rapid Environment Editor" (http://www.rapidee.com) over the default editor.
For USB-based devices, see the USB Transport Application Notes <./transport.html::usb-transport-libusb>
_ for platform-specific post-installation tasks.
Make sure that the value of CMAKE_INSTALL_PREFIX
is at or near the front of the shell PATH
environment variable. Do NOT set DYLD_LIBRARY_PATH
or any related DYLD environment variable permanently; these work differently than under Linux and should be used for testing / temporary purposes only.
If your application uses CMake as a build system, the following command will setup up your build environment to link against UHD:
This will set the CMake variable UHD_INCLUDE_DIRS
and UHD_LIBRARIES
accordingly.
See the example in examples/init_usrp
for more details, as well as the UHDConfig.cmake file that gets installed along with the UHD libraries.
Using CMake, UHD can be built as a static library by switching on ENABLE_STATIC_LIBS
.
cmake -DENABLE_STATIC_LIBS=ON <path to UHD source>
When linking the static library, you must ensure that the library is loaded in its entirety, otherwise global objects aren't initialized at load-time and it will always fail to detect any devices. Also, all UHD dependencies for UHD must be provided unless your linker has other ways of resolving library dependencies.
With the GNU ld linker (e.g. on Linux platforms), this is done using the --whole-archive
switch. Using the GNU C++ compiler, the correct command line is:
g++ your_uhd_app.cpp -Wl,-whole-archive <path to UHD libs>/libuhd.a -Wl,-no-whole-archive -ldl -lpthread -l<all other libraries>
Note that --whole-archive
is disabled after including libuhd.a
. The exact list of libraries depends on your UHD build. When using UHDConfig.cmake
(see Building applications that require UHD using CMake), the path to libuhd.a
is saved into UHD_LIBRARIES
, and UHD_STATIC_LIB_DEPS
lists the required dependencies. See UHDConfig.cmake
for details.