1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
/*! \page page_build_guide Building and Installing UHD
\tableofcontents
\b Note: More build information can be found on the UHD wiki page, at
http://code.ettus.com/redmine/ettus/projects/uhd/wiki .
\section build_dependencies Build Dependencies
<b>Linux Notes:</b>
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.
<b>Mac OS X Notes:</b>
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
<b>Windows Notes:</b>
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).
\section git Git
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.
\section cpp_compiler C++ Compiler
The following compilers are known to work and officially supported:
- GCC >= 4.4
- Clang >= 3.1
- MSVC >= 2010
Other compilers (or lower versions) may work, but are unsupported.
### CMake
- **Purpose:** generates project build files
- **Minimum Version:** 2.6
- **Usage:** build time (required)
- **Download URL:** http://www.cmake.org/cmake/resources/software.html
### Boost
- **Purpose:** C++ library
- **Minimum Version:** 1.46
- **Usage:** build time + runtime (required)
- **Download URL:** http://www.boost.org/users/download/
- **Download URL (Windows installer):** http://www.boostpro.com/download
### LibUSB
- **Purpose:** USB-based hardware support
- **Minimum Version:** 1.0
- **Usage:** build time + runtime (optional)
- **Download URL:** http://sourceforge.net/projects/libusb/files/libusb-1.0/
- **Download URL (Windows):** https://github.com/libusbx/libusbx
### Python
- **Purpose:** used by Cheetah and utility scripts
- **Minimum Version:** 2.6
- **Usage:** build time + runtime utility scripts (required)
- **Download URL:** http://www.python.org/download/
### Cheetah
- **Purpose:** source code generation
- **Minimum Version:** 2.0
- **Usage:** build time (required)
- **Download URL:** http://www.cheetahtemplate.org/download.html
- **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
### Doxygen
- **Purpose:** generates HTML API documentation
- **Minimum Recommended Version:** 1.8
- **Usage:** build time (optional)
- **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
\section build_instructions_unix Build Instructions (Unix)
\subsection generate_unix Generate Makefiles with CMake
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:
- For a custom install prefix: `-DCMAKE_INSTALL_PREFIX=<install-path>`
- To install libs into lib64: `cmake -DLIB_SUFFIX=64`
Example usage:
cmake -DCMAKE_INSTALL_PREFIX=/opt/uhd ../
\subsection build_install_unix Build and install
make
make test
sudo make install
\subsection libpath_linux Setup the library path (Linux)
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
\section build_instructions_windows Build Instructions (Windows)
\subsection cmake_win Generate the project with CMake
- Open the CMake GUI.
- Set the path to the source code: `<uhd-repo-path>/host`.
- Set the path to the build directory: `<uhd-repo-path>/host/build`.
- Make sure that the paths do not contain spaces.
- Click "Configure" and select "Microsoft Visual Studio 10".
- Set the build variables and click "Configure" again.
- Click "Generate", and a project file will be created in the build directory.
\subsection libusb_notes LibUSB notes
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.
- From the CMake GUI, select "Advanced View".
- Set `LIBUSB_INCLUDE_DIRS` to the directory with `libusb.h`.
- Set `LIBUSB_LIBRARIES` to the full path for `libusb-1.0.lib`.
- Recommend the static `libusb-1.0.lib` to simplify runtime dependencies.
- Check the box to enable USB support, click "Configure" and "Generate".
<b>Note:</b> On Windows, LibUSBx is required to use most USB3 controllers.
\subsection build_in_msvc Build the project in MSVC
- Open the generated project file in MSVC.
- Change the build type from "Debug" to "Release".
- Select the "Build All" target, right-click, and choose "Build".
- Select the install target, right-click, and choose "Build".
<b>Note:</b>
You may not have permission to build the install target.
You need to be an administrator or to run MSVC as administrator.
\section build_msvc_cmd_line Build the project in MSVC (command line)
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
\subsection path_env Setup the PATH environment variable
* Add the UHD bin path to `%PATH%` (usually `C:\\Program Files\\UHD\\bin`)
<b>Note:</b>
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.
\section post_install_tasks Post-Install Tasks
For USB-based devices,
see the `USB Transport Application Notes <./transport.html#usb-transport-libusb>`_
for platform-specific post-installation tasks.
\section post_install_tasks_macosx Post-Install Tasks (Mac OS X)
Make sure that the value of `CMAKE_INSTALL_PREFIX` is at or near the
front of the shell `PATH` environment variable. Do \b 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.
\section build_apps Building applications that require UHD using CMake
If your application uses CMake as a build system, the following command
will setup up your build environment to link against UHD:
\code{.cmake}
find_package(UHD "3.8.0")
\endcode
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.
\section build_static Static Builds
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, \b 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 \ref build_apps), the path to `libuhd.a` is saved into `UHD_LIBRARIES`,
and `UHD_STATIC_LIB_DEPS` lists the required dependencies. See `UHDConfig.cmake`
for details.
*/
// vim:ft=doxygen:
|