InstallingGRFromSource on Raspberry Pi: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Created page with "These instructions are under construction.")
 
(Initial creation.)
Line 1: Line 1:
These instructions are under construction.
<p>These instructions have been tested with the <q>Raspbian Buster with desktop and recommended software</q> Operating System on a Raspberry Pi 3B+. A 32GB microSD card is recommended.</p>
 
== Load prerequisites ==
<p>You may have some of these prerequisites already, but it doesn't hurt to get them again and check for the latest versions.</p>
<pre>
sudo apt-get update --allow-releaseinfo-change
sudo apt-get upgrade
sudo apt-get install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy
sudo apt-get install python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev
sudo apt-get install libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5
sudo apt-get install liblog4cpp5-dev libzmq3-dev python3-yaml
sudo apt-get install libpthread-stubs0-dev
sudo pip3 install click-plugins
sudo apt-get install python3-scipy
</pre>
 
== Set up a swap file ==
<p>A swap file will improve the compile time greatly.</p>
<pre>
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
</pre>
<p>To make the swap file permanent, add this line to /etc/fstab</p>
<pre>
/swapfile  none  swap  sw  0  0
</pre>
 
== Clone the gnuradio repository ==
<p>The gnuradio directory will be built in the home directory. The current maintenance branch is 'maint-3.8'.</p>
<pre>
cd ~/
git clone --recursive https://github.com/gnuradio/gnuradio.git
git checkout maint-3.8
</pre>
 
== Build ==
<pre>
cd ~/gnuradio
mkdir build
cd build
</pre>
<p>Here are some common cmake flags you may want to use:
* <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_INSTALL_PREFIX=XXX</code> Install your build into XXX.
* <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.<br />
For a list of additional cmake flags, as well as minimum versions of dependencies, see https://www.gnuradio.org/doc/doxygen/build_guide.html</p>
<p>This next 'cmake' command is all on one line, starting with cmake and ending with ../</p>
<pre>
cmake -DCMAKE_INSTALL_PREFIX="/usr/local" -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
</pre>
<p>The next steps will take two or more hours. Be patient. The terminal does show the progress.</p>
<pre>
make -j3
make test
sudo make install
sudo ldconfig
</pre>

Revision as of 01:06, 19 October 2019

These instructions have been tested with the Raspbian Buster with desktop and recommended software Operating System on a Raspberry Pi 3B+. A 32GB microSD card is recommended.

Load prerequisites

You may have some of these prerequisites already, but it doesn't hurt to get them again and check for the latest versions.

sudo apt-get update --allow-releaseinfo-change
sudo apt-get upgrade
sudo apt-get install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy
sudo apt-get install python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev
sudo apt-get install libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5
sudo apt-get install liblog4cpp5-dev libzmq3-dev python3-yaml
sudo apt-get install libpthread-stubs0-dev
sudo pip3 install click-plugins
sudo apt-get install python3-scipy

Set up a swap file

A swap file will improve the compile time greatly.

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

To make the swap file permanent, add this line to /etc/fstab

/swapfile  none  swap  sw  0  0

Clone the gnuradio repository

The gnuradio directory will be built in the home directory. The current maintenance branch is 'maint-3.8'.

cd ~/
git clone --recursive https://github.com/gnuradio/gnuradio.git
git checkout maint-3.8

Build

cd ~/gnuradio
mkdir build
cd build

Here are some common cmake flags you may want to use:

  • -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 build into 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 https://www.gnuradio.org/doc/doxygen/build_guide.html

This next 'cmake' command is all on one line, starting with cmake and ending with ../

cmake -DCMAKE_INSTALL_PREFIX="/usr/local" -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../

The next steps will take two or more hours. Be patient. The terminal does show the progress.

make -j3
make test
sudo make install
sudo ldconfig