Skip to content

Compilation

Tomasz Lemiech edited this page Dec 26, 2021 · 11 revisions
Clone this wiki locally

Get the code

You may either go for a stable release (these are quite well tested) or the latest development code from Git repository (which has all the cutting-edge features and bugs as well). New code always goes to the unstable branch first before it is merged into master branch and a release is made.

To download a release tarball, go to https://github.com/szpajder/RTLSDR-Airband/releases, get the latest one and unpack it. Example (note: replace X.Y.Z with the actual version number):

cd
wget -O RTLSDR-Airband-X.Y.Z.tar.gz https://github.com/szpajder/RTLSDR-Airband/archive/vX.Y.Z.tar.gz
tar xvfz RTLSDR-Airband-X.Y.Z.tar.gz
cd RTLSDR-Airband-X.Y.Z

If you otherwise prefer to run the latest development code, then do this instead:

cd
git clone https://github.com/szpajder/RTLSDR-Airband.git
cd RTLSDR-Airband
git checkout unstable

Build and install the program

First create the build directory and configure the build with CMake. The basic command sequence is:

mkdir build
cd build
cmake ../

CMake attempts to find all required libraries and SDR drivers. If a mandatory dependency is not installed, it will throw out an error. Missing optional dependencies cause relevant features to be disabled. At the end of the process CMake displays a short configuration summary, like this:

-- RTLSDR-Airband configuration summary:

-- - Build type:                Release
-- - Operating system:          Linux
-- - SDR drivers:
--   - librtlsdr:               requested: ON, enabled: TRUE
--   - mirisdr:                 requested: ON, enabled: TRUE
--   - soapysdr:                requested: ON, enabled: TRUE
-- - Other options:
--   - Platform:                native
--   - Broadcom VideoCore GPU:  FALSE
--   - NFM support:             OFF
--   - PulseAudio:              requested: ON, enabled: TRUE
--   - Profiling:               requested: OFF, enabled: FALSE
-- Configuring done
-- Generating done

Here you can verify whether all the optional components that you need were properly detected and enabled. Then compile and install the program:

make
sudo make install

This will install the compiled binary named rtl_airband to the default binary directory (on Linux this is usually /usr/local/bin).

Build options

Build options can be given to CMake with -D command line switch. The most important option is PLATFORM:

cmake -DPLATFORM=<platform_name>

This option is used to optimize the program for the given hardware platform. <platform_name> might be one of:

  • rpiv1 - Raspberry Pi version 1 (ARMv6 CPU, Broadcom VideoCore IV GPU)
  • rpiv2 - Raspberry Pi version 2 or 3 (ARMv7 CPU, Broadcom VideoCore IV GPU)
  • armv7-generic - ARMv7-based platforms, no VideoCore IV GPU (eg. Cubieboard)
  • armv8-generic - 64-bit ARM platforms, no VideoCore IV GPU (eg. Raspberry Pi version 4, Odroid C2)
  • native - causes the compiler to figure out the CPU type automatically and pick the most appropriate set of optimizations for it. This will NOT autodetect the presence of VideoCode GPU!
  • default - generic build with no platform-specific optimizations. Use this in case when you want a portable binary or if your compiler does not support -march=native option. This is the default setting.

Other build options can be used to enable or disable optional features, for example:

cmake -DRTLSDR=OFF ../

causes RTLSDR dongle support in the program to be disabled. It will not be compiled in, even if librtlsdr library is installed.

Here is a full list of options:

  • -DNFM=ON - enables narrow FM demodulation support (default: off).
  • -DRTLSDR=OFF -DMIRISDR=OFF -DSOAPYSDR=OFF - disable respective SDR driver. They are all on by default and will be built if necessary dependencies are detected.
  • -DPULSEAUDIO=OFF - disables PulseAudio support (default: off)
  • -DPROFILING=ON - enable profiling support with Google Perftools (default: off)

Setting build type:

  • -DCMAKE_BUILD_TYPE=Debug - builds the program without optimizations and adds --debug command line option for enabling debug messages (useful for troubleshooting, not recommended for general use)
  • -DCMAKE_BUILD_TYPE=Release - debugging output disabled (the default)

Example:

cmake -DPLATFORM=rpiv2 -DSOAPYSDR=OFF -DNFM=ON ../

Note: Always recompile the program with make command after changing CMake build options.

Note: CMake stores build option values in its cache. Subsequent runs of CMake will cause values set during previous runs to be preserved, unless they are explicitly overriden with -D option. So if you disable a feature with, eg. -DRTLSDR=OFF and you want to re-enable it later, you have to explicitly use -DRTLSDR=ON option. Just omitting -DRTLSDR=OFF will not revert the option value to the default.

The binary will be installed to /usr/local/bin/rtl_airband. To get the program running you now need to prepare a configuration file. As there is no default configuration which works for everyone, you have to customize it first, so head on to Configuration essentials.