LinuxInstall: Difference between revisions
(Installing GNU Radio - for 3.8 or Earlier - revise git checkout note) |
(delete section For_Ubuntu_18.04) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
!scope="col"|UHD version | !scope="col"|UHD version | ||
!scope="col"|VOLK version | !scope="col"|VOLK version | ||
|- | |||
! Ubuntu 24.04 | |||
||v3.10.9.2 | |||
||4.6.0.0 | |||
||3.1.2 | |||
|- | |- | ||
! Ubuntu 22.04 | ! Ubuntu 22.04 | ||
||v3.10.1.1 | ||v3.10.1.1 | ||
||4.1.0 | ||4.1.0.0 | ||
||2.5.1 | ||2.5.1 | ||
|- | |- | ||
! Ubuntu 20.04 | ! Ubuntu 20.04 | ||
||v3.8.1.0 | ||v3.8.1.0 | ||
||3.15.0 | ||3.15.0.0 | ||
||2.2.1 | ||2.2.1 | ||
|} | |} | ||
Line 61: | Line 66: | ||
== Ubuntu PPA Installation == | == Ubuntu PPA Installation == | ||
For Ubuntu, the latest builds (both released and pulled from master branch) are maintained as PPAs on [https://launchpad.net/~gnuradio launchpad].<br> | For Ubuntu LTS releases, the latest builds (both released and pulled from master branch) are maintained as PPAs on [https://launchpad.net/~gnuradio launchpad].<br> | ||
<b>Be sure to uninstall any previously installed versions of gnuradio first.</b> See [[UnInstallGR#From_PPA|UnInstallGR]].<br><br> | <b>Be sure to uninstall any previously installed versions of gnuradio first.</b> See [[UnInstallGR#From_PPA|UnInstallGR]].<br><br> | ||
Line 103: | Line 108: | ||
== Fedora COPR Installation == | == Fedora COPR Installation == | ||
<b>NOTE: FEDORA COPR is not currently maintained.</b> | |||
Packages are available for Fedora 29, 30, 31 hosted under COPR: | Packages are available for Fedora 29, 30, 31 hosted under COPR: | ||
Line 136: | Line 141: | ||
==== Installing Dependencies ==== | ==== Installing Dependencies ==== | ||
Refer to [[#Distributions_and_Commands|the table above for your specific Linux distro]] to find how to install dependencies. For example, on Ubuntu | Refer to [[#Distributions_and_Commands|the table above for your specific Linux distro]] to find how to install dependencies. For example, on Ubuntu 22.04 [[UbuntuInstall#Install_Dependencies|use this page]]. | ||
==== Installing UHD ==== | ==== Installing UHD ==== | ||
Line 167: | Line 172: | ||
* <code>git clone https://github.com/gnuradio/gnuradio.git</code> | * <code>git clone https://github.com/gnuradio/gnuradio.git</code> | ||
* <code>cd gnuradio</code> | * <code>cd gnuradio</code> | ||
<b>Note:</b> If you want to build the <code>maint-3.10</code> or <code>maint-3.9</code> branch rather than the default <code>main</code> branch, enter: | <b>Note:</b> If you want to build the <code>maint-3.10</code> or <code>maint-3.9</code> branch rather than the default <code>main</code> branch, enter:<br> | ||
<code>git checkout maint-3.10</code> and then<br> | <code>git checkout maint-3.10</code> or <code>git checkout maint-3.9</code> and then<br> | ||
* <code>mkdir build</code> | * <code>mkdir build</code> | ||
* <code>cd build</code> | * <code>cd build</code> | ||
Line 192: | Line 197: | ||
==== Installing UHD ==== | ==== Installing UHD ==== | ||
<b>If you want to use GNU Radio with a USRP, you FIRST must clone and install UHD</b>.<br> Follow the instructions in [[ | <b>If you want to use GNU Radio with a USRP, you FIRST must clone and install UHD</b>.<br> Follow the instructions in [[Draft-AN-445#Building_and_installing_UHD_from_source_code|Install UHD from source]]. | ||
==== Installing GNU Radio ==== | ==== Installing GNU Radio ==== | ||
Line 221: | Line 226: | ||
Go to [[ModuleNotFoundError#B._Finding_the_Python_library|Finding the Python library]] to set your PYTHONPATH and LD_LIBRARY_PATH.<br><b>After setting these environment variables, you need to do</b> <code>sudo ldconfig</code> <b>again</b> for the Linux dynamic library loader to find the just-installed GNU Radio libraries.<br> | Go to [[ModuleNotFoundError#B._Finding_the_Python_library|Finding the Python library]] to set your PYTHONPATH and LD_LIBRARY_PATH.<br><b>After setting these environment variables, you need to do</b> <code>sudo ldconfig</code> <b>again</b> for the Linux dynamic library loader to find the just-installed GNU Radio libraries.<br> | ||
If you have installed in a custom path with <code>-DCMAKE_INSTALL_PREFIX=XXX</code>, you will need to add that path to $PATH in order to find gnuradio-companion. | If you have installed in a custom path with <code>-DCMAKE_INSTALL_PREFIX=XXX</code>, you will need to add that path to $PATH in order to find gnuradio-companion. | ||
== Common cmake flags == | == Common cmake flags == | ||
* <code>-DCMAKE_INSTALL_PREFIX=XXX</code> Install the generated code in XXX. For example, <code>-DCMAKE_INSTALL_PREFIX=/home/<user>/gr3106</code> would put the code in <code>$HOME/gr3106/bin</code>, <code>$HOME/gr3106/include</code>, etc. | |||
** Unless you need more than one version of UHD or Volk, those builds can be done in the standard location <code>/usr/local</code>. | |||
** For the system to find 'gnuradio-companion' and other related programs, <code>$HOME/gr3106/bin</code> must be added to $PATH. | |||
* <code>-DENABLE_GR_XXX=ON</code> This enables (or disables for =OFF) the GNU Radio component named XXX. You might not need all of them, and this way, you can compile quicker. | * <code>-DENABLE_GR_XXX=ON</code> This enables (or disables for =OFF) the GNU Radio component named XXX. You might not need all of them, and this way, you can compile quicker. | ||
* <code>-DCMAKE_BUILD_TYPE=Debug</code> This causes gcc to add debug symbols to all binaries. Useful for debugging (otherwise, it decreases efficiency!) | * <code>-DCMAKE_BUILD_TYPE=Debug</code> This causes gcc to add debug symbols to all binaries. Useful for debugging (otherwise, it decreases efficiency!) | ||
* <code>-DPYTHON_EXECUTABLE=/usr/bin/python{2,3}</code> This selects the Python version and executable to be used during build time and will determine which Python libraries will be used for building the Python bindings. | * <code>-DPYTHON_EXECUTABLE=/usr/bin/python{2,3}</code> This selects the Python version and executable to be used during build time and will determine which Python libraries will be used for building the Python bindings. | ||
<p>For a list of additional cmake flags, as well as minimum versions of dependencies, see [https://www.gnuradio.org/doc/doxygen/build_guide.html#cmake_options build_guide.html#cmake_options]</p> | <p>For a list of additional cmake flags, as well as minimum versions of dependencies, see [https://www.gnuradio.org/doc/doxygen/build_guide.html#cmake_options build_guide.html#cmake_options]</p> |
Latest revision as of 15:34, 20 May 2024
The recommended way to install GNU Radio on most platforms is using already available binary packages. Find your platform below in the From Binaries section for instructions on how to get GNU Radio through your regular package manager (e.g. Ubuntu PPA Installation), or visit the Conda Installation page for instructions on how to use the Conda package manager to install GNU Radio on any Linux distribution, macOS, or Windows. For some platforms there are no binaries provided by available package managers or the GNU Radio project. In these cases please contact the maintainer of the package manager or the GNU Radio project to find a sensible way to provide binaries for your platform.
From Binaries
Most distributions contain a package named gnuradio
or similar in their standard repositories. For most use cases it is enough to install this package and start developing.
The development of GNU Radio can be fast-paced, and binaries provided by your distribution may be outdated. Do check if the version you're installing is up to date! Sometimes old versions are not updated in the packaging systems. If you find a bug in a older GNU Radio version, please check if the bug still exists in the newer version of GNU Radio before filing a new issue.
Distribution | GR version | UHD version | VOLK version |
---|---|---|---|
Ubuntu 24.04 | v3.10.9.2 | 4.6.0.0 | 3.1.2 |
Ubuntu 22.04 | v3.10.1.1 | 4.1.0.0 | 2.5.1 |
Ubuntu 20.04 | v3.8.1.0 | 3.15.0.0 | 2.2.1 |
If the version shipped in your distribution is outdated please contact the corresponding maintainer to update it in the packaging system.
Distributions and Commands
Here are examples of how to install GNU Radio in various Linux distributions. Click the link under "Distribution" for how to install dependencies.
Distribution | Command |
---|---|
Debian/Ubuntu and derivates | # apt install gnuradio |
Fedora | # dnf install gnuradio |
RHEL/CentOS/Rocky Linux/AlmaLinux | # yum install gnuradio |
Archlinux | # pacman -S gnuradio |
Gentoo Linux | # emerge net-wireless/gnuradio |
Suse Linux | |
Raspberry Pi OS |
On other distributions, simply use the appropriate package management command to install the gnuradio
package and then please add it to this list. If you need newer versions or have a different platform please contact the package maintainer of your distribution or raise your issue on the mailing list.
Ubuntu PPA Installation
For Ubuntu LTS releases, the latest builds (both released and pulled from master branch) are maintained as PPAs on launchpad.
Be sure to uninstall any previously installed versions of gnuradio first. See UnInstallGR.
To access the current released version (3.10), add the gnuradio/gnuradio-releases ppa (removing other gnuradio ppas if already configured)
$ sudo add-apt-repository ppa:gnuradio/gnuradio-releases
To access the 3.9 released version, add the gnuradio/gnuradio-releases-3.9 ppa (removing other gnuradio ppas if already configured)
$ sudo add-apt-repository ppa:gnuradio/gnuradio-releases-3.9
To access the 3.8 released version, add the gnuradio/gnuradio-releases-3.8 ppa (removing other gnuradio ppas if already configured)
$ sudo add-apt-repository ppa:gnuradio/gnuradio-releases-3.8
To access the 3.7 released version (legacy), add the gnuradio/gnuradio-releases-3.7 ppa (removing other gnuradio ppas if already configured)
$ sudo add-apt-repository ppa:gnuradio/gnuradio-releases-3.7
Then, update the apt sources, and install gnuradio
$ sudo apt-get update
$ sudo apt install gnuradio
Attention: Do NOT try to install further packages like `gr-osmosdr` via Ubuntu's package management (i.e. using "apt"). Ubuntu will try to install a potentially incompatible version and your system will be in an undefined state. Instead, please first open GNURadio-Companion, and in the right-hand side block list, open "Soapy" -> "Source" or "Sink", to see whether the hardware you are most likely using is already integrated.
Note on 3.10 packaging dependency
For some distributions you may need to install the python module 'packaging' using pip (which may also need to be installed).
$ sudo apt install python3-pip $ pip install packaging
Modtool on Ubuntu
NOTE: On released builds for Ubuntu 18.04 (bionic), there is an issue using gr_modtool after GNU Radio has been installed from the PPA. This is due to byte-compiled code that remains in the modtool templates after installation. To work around this issue:
$ cd /usr/share/gnuradio/modtool/templates/gr-newmod $ sudo py3clean .
This issue does not appear for Ubuntu 19 and later packages
Fedora COPR Installation
NOTE: FEDORA COPR is not currently maintained.
Packages are available for Fedora 29, 30, 31 hosted under COPR:
https://copr.fedorainfracloud.org/coprs/gnuradio/
1. Add the repository:
-- For the latest released version:
$ sudo dnf copr enable gnuradio/gnuradio-releases
-- For the latest pull from git master:
$ sudo dnf copr enable gnuradio/gnuradio-master
2. Install GNU Radio
$ sudo dnf install gnuradio
From Source
Binary installation should be sufficient for most users, and certainly for anyone who is new to GNU Radio. However, if you have special requirements, want the latest version, or the binary packages are not working for you, you may want to install GNU Radio from source. But note that running and developing out-of-tree modules does NOT require GNU Radio to be installed from source.
Notes
- By default GNU Radio will be installed in the
/usr/local
directory. See notes about -DCMAKE_INSTALL_PREFIX to install it elsewhere. - Running and developing out-of-tree modules does not require GNU Radio to be installed from source.
- To install on a Raspberry Pi, see InstallingGRFromSource on Raspberry Pi.
- To build from source from within a conda environment, see the conda install guide.
For GNU Radio 3.10, 3.9, and Main Branch
This section describes how to install GNU Radio 3.10, 3.9, and the Main branch from source code.
Installing Dependencies
Refer to the table above for your specific Linux distro to find how to install dependencies. For example, on Ubuntu 22.04 use this page.
Installing UHD
If you want to use GNU Radio with a USRP, you FIRST must clone and install UHD.
Follow the instructions in Install UHD from source.
Installing Volk
Since Volk is no longer considered as a submodule of GNU Radio (GNU Radio commit #80c04479da962d048d41165081b026aafdaa0316),
you MUST FIRST install Volk, and then install GNU Radio.
The basic idea is the same, but instead of building Volk along with GNU Radio, you need to clone and build it separately. For this example, we will start in the home directory. You can, of course, use any directory you wish and the results will be the same.
cd
git clone --recursive https://github.com/gnuradio/volk.git
cd volk
mkdir build
cd build
Note: In the following command, you can add -DCMAKE_INSTALL_PREFIX=XXX
to install Volk into the PREFIX XXX
; if not specified, then the PREFIX is /usr/local
. See other CMake options in Common cmake flags.
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make
make test
sudo make install
If you're running Linux, then always remember to do the following command after installing any library:
sudo ldconfig
Installing GNU Radio
cd
git clone https://github.com/gnuradio/gnuradio.git
cd gnuradio
Note: If you want to build the maint-3.10
or maint-3.9
branch rather than the default main
branch, enter:
git checkout maint-3.10
or git checkout maint-3.9
and then
mkdir build
cd build
Note: In the following command, you can add -DCMAKE_INSTALL_PREFIX=XXX
to install GNU Radio into the PREFIX XXX
; if not specified, then the PREFIX is /usr/local
. See other CMake options in Common cmake flags.
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make -j3
(e.g. if you want to use 3 CPU cores during the build. To use 8 do -j8, to use all cores use -j$(nproc), to use 1, leave out the -j flag.)
Note: In the following command, it is very possible that not all tests pass. Generally any error is a sign of a missing dependency such as the Python interface to ZMQ or NumPy or SciPy, none of which are required for building GNU Radio but are required for testing.
make test
sudo make install
If you're running Linux, then always remember to do the following command after installing any library:
sudo ldconfig
As an optional step to increase performance, we recommend running the following, although it can take 10-15 minutes and you can always do it later:
volk_profile
If you encounter "Cannot import gnuradio" error, then go to Finding the Python library to set your PYTHONPATH and LD_LIBRARY_PATH.
After setting these environment variables, you need to do sudo ldconfig
again for the Linux dynamic library loader to find the just-installed GNU Radio libraries.
If you have installed in a custom path with -DCMAKE_INSTALL_PREFIX=XXX
, you will need to add that path to $PATH in order to find gnuradio-companion.
For GNU Radio 3.8 or Earlier
Installing Dependencies
Refer to the table above for your specific Linux distro to find how to install dependencies. For example, on Ubuntu 20.04 use this page.
Installing UHD
If you want to use GNU Radio with a USRP, you FIRST must clone and install UHD.
Follow the instructions in Install UHD from source.
Installing GNU Radio
For this example, we will start in the home directory; you can, of course, use any directory you wish and the results will be the same.
cd
git clone https://github.com/gnuradio/gnuradio.git
cd gnuradio
Note: In the following command, change maint-3.8
to maint-3.7
if you want to build that version.
git checkout maint-3.8
git submodule update --init --recursive
mkdir build
cd build
Note: In the following command, you can add -DCMAKE_INSTALL_PREFIX=XXX
to install GNU Radio into the PREFIX XXX
; if not specified, then the PREFIX is /usr/local
. See other CMake options in Common cmake flags.
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make -j3
(e.g. if you want to use 3 CPU cores during the build. To use 8 do -j8, to use all cores use -j$(nproc), to use 1 leave out the -j flag.)
Note: In the following command, it is very possible that not all tests pass. Generally any error is a sign of a missing dependency such as the Python interface to ZMQ or NumPy or SciPy, none of which are required for building GNU Radio but are required for testing.
make test
sudo make install
If you're running Linux, then always remember to do the following command after installing any library:
sudo ldconfig
Go to Finding the Python library to set your PYTHONPATH and LD_LIBRARY_PATH.
After setting these environment variables, you need to do sudo ldconfig
again for the Linux dynamic library loader to find the just-installed GNU Radio libraries.
If you have installed in a custom path with -DCMAKE_INSTALL_PREFIX=XXX
, you will need to add that path to $PATH in order to find gnuradio-companion.
Common cmake flags
-DCMAKE_INSTALL_PREFIX=XXX
Install the generated code in XXX. For example,-DCMAKE_INSTALL_PREFIX=/home/<user>/gr3106
would put the code in$HOME/gr3106/bin
,$HOME/gr3106/include
, etc.- Unless you need more than one version of UHD or Volk, those builds can be done in the standard location
/usr/local
. - For the system to find 'gnuradio-companion' and other related programs,
$HOME/gr3106/bin
must be added to $PATH.
- Unless you need more than one version of UHD or Volk, those builds can be done in the standard location
-DENABLE_GR_XXX=ON
This enables (or disables for =OFF) the GNU Radio component named XXX. You might not need all of them, and this way, you can compile quicker.-DCMAKE_BUILD_TYPE=Debug
This causes gcc to add debug symbols to all binaries. Useful for debugging (otherwise, it decreases efficiency!)-DPYTHON_EXECUTABLE=/usr/bin/python{2,3}
This selects the Python version and executable to be used during build time and will determine which Python libraries will be used for building the Python bindings.
For a list of additional cmake flags, as well as minimum versions of dependencies, see build_guide.html#cmake_options