InstallingGR: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(revise instructions for setting PYTHONPATH and LD_LIBRARY_PATH)
(Emphasize doing ldconfig again at end)
(9 intermediate revisions by 2 users not shown)
Line 103: Line 103:
== To install system wide ==
== To install system wide ==


<p><b>It is highly recommended that you start in your home directory.</b></p>
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.
* <code>cd ~/</code>
 
* <code>cd</code>
* <code>git clone --recursive https://github.com/gnuradio/gnuradio.git</code>
* <code>git clone --recursive https://github.com/gnuradio/gnuradio.git</code>
* <code>cd gnuradio</code>
* <code>cd gnuradio</code>
* <code>git checkout maint-3.8</code> # change `maint-3.8` if you want to use a different version; see [https://github.com/gnuradio/gnuradio/releases releases]
 
<b>Note:</b> In the following command, change <code>maint-3.8</code> to some other branch or tag if you want to build a different version of GNU Radio; see [https://github.com/gnuradio/gnuradio/tags tags] for tagged releases including pre-releases ("rc"). For  [https://github.com/gnuradio/gnuradio/branches branches], it's generally wise to stick with "master" (the default after cloning), and, currently: <code>maint-3.7</code> or <code>maint-3.8</code>. Here we checkout the <code>maint-3.8</code> branch, which contains the latest 3.8 release plus any fixes or augmentations to it that will be in the next 3.8 release.
 
* <code>git checkout maint-3.8</code>
 
<b>Note:</b> In the following command, change <code>v2.2.0</code> to some other branch or tag if you want to build a different version of Volk; see [https://github.com/gnuradio/volk/tags tags] for tagged releases. You may skip the following <code>git checkout</code> command if you are not experiencing related bugs or build issues, but you may need to use an older release of Volk in order to build an older release of GNU Radio (including 3.7 releases).
 
* <code>cd volk</code>
* <code>git checkout v2.2.0</code>
* <code>cd ..</code>
 
* <code>mkdir build</code>
* <code>mkdir build</code>
* <code>cd build</code>
* <code>cd build</code>
* <code>cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../</code> # see other options below
 
* Note: if your computer has multiple cores, you can use the -j option for 'make' to speed compilation, e.g. <code>make -j3</code> but specify one less than the total so the system does not appear to 'freeze'.
<b>Note:</b> In the following command, you can use <code>-DCMAKE_INSTALL_PREFIX=XXX</code> to install GNU Radio into the PREFIX <code>XXX</code>; if not specified, then the PREFIX is <code>/usr/local</code>. See other CMake options in [[#Common_cmake_flags|Common cmake flags]].<br>
 
* <code>cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../</code>
 
<b>Note:</b> In the following command, if your computer's CPU has multiple cores, you can use the argument <code>-j#</code> to speed compilation; <br> e.g., <code>make -j3</code> will use 3 threads in the build. Specify at least one less than the number of CPU cores so the system does not appear to 'freeze' during the build. If not specified, then a single thread is used for the build; this is not necessarily a bad thing, but it will take roughly 2 times as long to build as using 2 threads, and roughly 3 times as long to build as using 3 threads.<br>
 
* <code>make</code>
* <code>make</code>
<b>Note:</b> 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.
* <code>make test</code>
* <code>make test</code>
* <code>sudo make install</code>
* <code>sudo make install</code>
If you're running Linux, then always remember to do the following command after installing any library:
* <code>sudo ldconfig</code>
* <code>sudo ldconfig</code>
If you used <code>-DCMAKE_INSTALL_PREFIX=XXX</code> in your 'cmake' command, then your prefix is XXX; otherwise it is <code>/usr/local</code>.<br>
* using that prefix in place of <code>{prefix}</code> in the following commands, put them in your <code>~/.bashrc</code> or <code>~/.bash_aliases</code> file and restart your terminal.<br>


-  For <b>ALL</b> 32-bit systems and <b>ALL</b> Debian / Ubuntu (and derivative) systems, use:
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.
<pre>
export PYTHONPATH={prefix}/lib/python3/dist-packages:{prefix}/lib/python3/site-packages:$PYTHONPATH
export LD_LIBRARY_PATH={prefix}/lib:$LD_LIBRARY_PATH
</pre>
 
-  For other 64-bit systems, use:
<pre>
export PYTHONPATH={prefix}/lib64/python3/site-packages:$PYTHONPATH
export LD_LIBRARY_PATH={prefix}/lib64:$LD_LIBRARY_PATH
</pre>


== Common cmake flags ==
== Common cmake flags ==
Line 148: Line 157:


If the installation worked without any trouble, you're ready to use GNU Radio! If you have no idea how to do that, the best place to start is with the [[Tutorials]].
If the installation worked without any trouble, you're ready to use GNU Radio! If you have no idea how to do that, the best place to start is with the [[Tutorials]].
Optionally, you may run 'volk_profile' on your terminal to help libvolk to determine the optimal kernels (may speed up GNU Radio).


[[Category:Installation]]
[[Category:Installation]]
[[Category:Guide]]
[[Category:Guide]]

Revision as of 12:29, 19 February 2020

From Binaries

The recommended way to install GNU Radio on most platforms is using already available binary packages. For some platforms there are no binaries provided by available package managers or the GNU Radio project. In these cases please contact maintainer of the package manager or the GNU Radio project to find a sensible way to provide binaries for your platform.

In addition to using binaries, GNU Radio can be installed:

  1. From source (for those who want full control)
  2. Using PyBOMBS (for those who want it built from source and/or installed to a specific directory using a script)

Linux

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 is 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 it.

If the version shipped in your distribution is outdated please contact the corresponding maintainer to update it in the packaging system.

Examples of how to install GNU Radio in various Linux distributions (click each one for more installation details):

Distribution Command
Debian/Ubuntu and derivates
$ apt install gnuradio
Fedora
$ dnf install gnuradio
RHEL/CentOS
$ yum install gnuradio
Archlinux
$ pacman -S gnuradio
Gentoo Linux
$ emerge net-wireless/gnuradio
Suse Linux

On other distributions, simply use the appropriate package management command to install the gnuradio package and 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, the latest builds (both released and pulled from master branch) are maintained as PPAs on launchpad. Be sure to uninstall gnuradio first.

To access the latest released version, add the gnuradio/gnuradio-releases ppa (removing other gnuradio ppas if already configured)

$ sudo add-apt-repository ppa:gnuradio/gnuradio-releases

To access the latest from the master branch, add the gnuradio/gnuradio-master ppa (removing other gnuradio ppas if already configured)

$ sudo add-apt-repository ppa:gnuradio/gnuradio-master

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

Fedora COPR Installation

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 

Windows

Binary installers are now available for 3.8.0.0, download them here.
If you need to install GNU Radio from source refer to the Windows install guide.

Note: We do not officially support Windows. We do our best to provide installation instructions and work out build bugs on Windows when they are reported and patches received. As new versions of GNU Radio, its dependencies, and Windows itself come out, however, keeping all of them working together is beyond the scope of what the project currently supports. User updates to the above wiki installation instructions are very welcome.

Mac OS X

Refer to the Mac OS X install guide page.

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.

Notes

To install system wide

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.

Note: In the following command, change maint-3.8 to some other branch or tag if you want to build a different version of GNU Radio; see tags for tagged releases including pre-releases ("rc"). For branches, it's generally wise to stick with "master" (the default after cloning), and, currently: maint-3.7 or maint-3.8. Here we checkout the maint-3.8 branch, which contains the latest 3.8 release plus any fixes or augmentations to it that will be in the next 3.8 release.

  • git checkout maint-3.8

Note: In the following command, change v2.2.0 to some other branch or tag if you want to build a different version of Volk; see tags for tagged releases. You may skip the following git checkout command if you are not experiencing related bugs or build issues, but you may need to use an older release of Volk in order to build an older release of GNU Radio (including 3.7 releases).

  • cd volk
  • git checkout v2.2.0
  • cd ..
  • mkdir build
  • cd build

Note: In the following command, you can use -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 ../

Note: In the following command, if your computer's CPU has multiple cores, you can use the argument -j# to speed compilation;
e.g., make -j3 will use 3 threads in the build. Specify at least one less than the number of CPU cores so the system does not appear to 'freeze' during the build. If not specified, then a single thread is used for the build; this is not necessarily a bad thing, but it will take roughly 2 times as long to build as using 2 threads, and roughly 3 times as long to build as using 3 threads.

  • make

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.

Common cmake flags

  • -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_INSTALL_PREFIX=XXX Install your stuff to XXX.
  • -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 [1]

Using PyBOMBS

PyBOMBS is good at building GNU Radio, UHD, and various Out of Tree (OOT) modules from source and then installing into a specified user directory rather than in the system files. PyBOMBS detects the user's Operating System and loads all of the prerequisites in the first stage of the build.

The PyBOMBS documentation is in the PyBOMBS README.

OK, it's installed, what now?

If the installation worked without any trouble, you're ready to use GNU Radio! If you have no idea how to do that, the best place to start is with the Tutorials.

Optionally, you may run 'volk_profile' on your terminal to help libvolk to determine the optimal kernels (may speed up GNU Radio).