Compile from source in Linux

f4exb edited this page Feb 19, 2019 · 6 revisions

Introduction

The procedure descibed here applies to the Linux system and assumes /opt/build is the base for the sources used to build and /opt/installation is the base for the installation directories. It is assumed these directories are owned by your user. Hence assuming the user is user in group users you would do the following to create them (once):

sudo mkdir /opt/build
sudo chmod user:users /opt/build
sudo mkdir /opt/install
sudo chmod user:users /opt/install

You may change these locations at your will like using your home directory for the sources but it is strongly advised not to use the system directories for installation (/usr, /usr/local) and thus never have to do sudo make install. This is a bad idea as a principle for application software.

As a general prerequisite you should have the following packages installed:

Debian systems (Debian, Ubuntu, Raspbian, Armbian):

sudo apt-get install git cmake g++ pkg-config autoconf automake libtool libfftw3-dev libusb-1.0-0-dev libusb-dev qt5-default qtbase5-dev qtchooser libqt5multimedia5-plugins qtmultimedia5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtbase5-dev libboost-all-dev libasound2-dev pulseaudio libopencv-dev libsqlite3-dev libxml2-dev bison flex ffmpeg libavcodec-dev libavformat-dev libopus-dev doxygen dkms python-cheetah

In addition for Raspbian: sudo apt-get install freeglut3-dev

OpenSUSE:

sudo zypper install git cmake fftw3-devel gcc-c++ autoconf automake libtool libusb-1_0-devel libqt5-qtbase-devel libQt5OpenGL-devel libqt5-qtmultimedia-devel libqt5-qttools-devel libQt5Network-devel libQt5Widgets-devel boost-devel alsa-devel pulseaudio opencv-devel libopus-devel bison flex doxygen dkms python-cheetah

Arch:

sudo pacman -S git cmake gcc pkgconf autoconf automake libtool fftw libusb qt5-base qt5-multimedia qt5-tools boost boost-libs alsa-lib opus pulseaudio bison flex doxygen dkms python-cheetah

Non-hardware dependencies

CM265cc

cd /opt/build
git clone https://github.com/f4exb/cm256cc.git
cd cm256cc
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/cm256cc ..
make -j4 install

MBElib

cd /opt/build
git clone https://github.com/szechyjs/mbelib.git
cd mbelib
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/mbelib ..
make -j4 install

SerialDV

cd /opt/build
git clone https://github.com/f4exb/serialDV.git
cd serialDV
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/serialdv ..
make -j4 install

DSDcc

cd /opt/build
git clone https://github.com/f4exb/dsdcc.git
cd dsdcc
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/dsdcc -DUSE_MBELIB=ON -DLIBMBE_INCLUDE_DIR=/opt/install/mbelib/include -DLIBMBE_LIBRARY=/opt/install/mbelib/lib/libmbe.so -DLIBSERIALDV_INCLUDE_DIR=/opt/install/serialdv/include/serialdv -DLIBSERIALDV_LIBRARY=/opt/install/serialdv/lib/libserialdv.so ..
make -j4 install

Hardware dependencies

You can choose to compile only the plugins corresponding to your hardware. In the final step to build SDRangel specify only the include and library directories that correspond to your hardware.

Airspy

cd /opt/build
git clone https://github.com/airspy/host.git libairspy
cd libairspy
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libairspy ..
make -j4 install

SDRplay RSP1

cd /opt/build
git clone https://github.com/f4exb/libmirisdr-4.git
cd libmirisdr-4
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libmirisdr ..
make -j4 install

RTL-SDR

cd /opt/build
git clone https://github.com/librtlsdr/librtlsdr.git
cd librtlsdr
mkdir build; cd build
cmake -Wno-dev -DDETACH_KERNEL_DRIVER=ON -DCMAKE_INSTALL_PREFIX=/opt/install/librtlsdr ..
make -j4 install

Pluto SDR

cd /opt/build
git clone https://github.com/analogdevicesinc/libiio.git
cd libiio
git checkout 5bdc242 # this is v0.17
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libiio -DINSTALL_UDEV_RULE=OFF ..
make -j4 install

Please note that you will need version 0.29 of the firmware.

BladeRF all versions

cd /opt/build
git clone https://github.com/Nuand/bladeRF.git
cd bladeRF/host
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libbladeRF -DINSTALL_UDEV_RULES=OFF ..
make -j4 install

HackRF

cd /opt/build
git clone https://github.com/mossmann/hackrf.git
cd hackrf/host
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libhackrf -DINSTALL_UDEV_RULES=OFF ..
make -j4 install

LimeSDR

cd /opt/build
git clone https://github.com/myriadrf/LimeSuite.git
cd LimeSuite
git checkout 59d51d5
mkdir builddir; cd builddir
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/LimeSuite ..
make -j4 install

AirspyHF

cd /opt/build
git clone https://github.com/airspy/airspyhf
cd airspyhf
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libairspyhf ..
make -j4 install

Perseus

cd /opt/build
git clone https://github.com/f4exb/libperseus-sdr.git
cd libperseus-sdr
git checkout fixes
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libperseus ..
make
make install

XTRX

cd /opt/build
git clone https://github.com/xtrx-sdr/images.git xtrx-images
cd xtrx-images
git submodule init
git submodule update
cd sources
mkdir build; cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/xtrx-images -DENABLE_SOAPY=NO ..
make
make install

To use XTRX because libxtrx has dependent sub-libraries before starting SDRangel you need to add the library path to LD_LIBRAY_PATH with export LD_LIBRARY_PATH=/opt/install/xtrx-images/lib:$LD_LIBARY_PATH. If you start SDRangel in a shell script you have to add the export before invoking SDRangel.

Soapy SDR

SoapySDR is a bit special since it is an interface with the libraries that interface the hardware so there is a kind of double indirection. We will detail an installation that is done completely outside the standard paths as it has been done done until now. Thus we will refrain from the easy but risky sudo make install.

First let's compile the main SoapySDR stuff:

cd /opt/build
git clone https://github.com/pothosware/SoapySDR.git
cd SoapySDR
mkdir build; cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/install/SoapySDR ..
make -j4 install

So far so good but we will need the support libraries that are the pieces (plugins) that make the link between SoapySDR and the libraries that drive the hardware. They have to be compiled one by one separately as you need them. Let's take a simple example for RTL-SDR assuming that librtlsdr has been compiled and installed as described earlier in /opt/install/librtlsdr:

RTL-SDR

cd /opt/build
git clone https://github.com/pothosware/SoapyRTLSDR.git
cd SoapyRTLSDR
mkdir build; cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/install/SoapySDR  -DRTLSDR_INCLUDE_DIR=/opt/install/librtlsdr/include -DRTLSDR_LIBRARY=/opt/install/librtlsdr/lib/librtlsdr.so -DSOAPY_SDR_INCLUDE_DIR=/opt/install/SoapySDR/include -DSOAPY_SDR_LIBRARY=/opt/install/SoapySDR/lib/libSoapySDR.so ..
make -j4 install

The support libraries are installed in /opt/install/SoapySDR/lib/SoapySDR/modules0.7 (for the 0.7 version).

HackRF

cd /opt/build
git clone https://github.com/pothosware/SoapyHackRF.git
cd SoapyHackRF
mkdir build; cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/install/SoapySDR -DLIBHACKRF_INCLUDE_DIR=/opt/install/libhackrf/include/libhackrf -DLIBHACKRF_LIBRARY=/opt/install/libhackrf/lib/libhackrf.so -DSOAPY_SDR_INCLUDE_DIR=/opt/install/SoapySDR/include -DSOAPY_SDR_LIBRARY=/opt/install/SoapySDR/lib/libSoapySDR.so ..
make -j4 install

LimeSDR

You may have already cloned LimeSuite. In this case skip the git clone step.

cd /opt/build
git clone https://github.com/myriadrf/LimeSuite.git
cd LimeSuite/SoapyLMS7
mkdir buiid; cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/install/SoapySDR ..
make -j4 install

Soapy Remote

sudo apt-get install libavahi-client-dev
cd /opt/build
git clone https://github.com/pothosware/SoapyRemote.git
cd SoapyRemote
mkdir build; cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/install/SoapySDR -DSOAPY_SDR_INCLUDE_DIR=/opt/install/SoapySDR/include -DSOAPY_SDR_LIBRARY=/opt/install/SoapySDR/lib/libSoapySDR.so ..
make -j4 install

SDRplay case

SDRplay interface libraries are not provided in source form. You have to download them from https://www.sdrplay.com/downloads/:

  • Click on the Linux x86 tab
  • Select API/HW DRIVER and follow instructions to download

This will download a run file: SDRplay_RSP_API-Linux-2.13.1.run. You have to make it executable and run it as sudo. This will create files in /usr/local/lib: libmirsdrapi-rsp.so libmirsdrapi-rsp.so.2 libmirsdrapi-rsp.so.2.13 and put the include file in /usr/local/include/

But remember that we don't like to have this stuff in the /usr structure so let's move it to /opt/install and create a structure like this:

/opt/install/libsdrplay
├── include
│   └── mirsdrapi-rsp.h
└── lib
    ├── libmirsdrapi-rsp.so -> libmirsdrapi-rsp.so.2
    ├── libmirsdrapi-rsp.so.2 -> libmirsdrapi-rsp.so.2.13
    └── libmirsdrapi-rsp.so.2.13

So do the following assuming your user is user and group users:

mkdir -p /opt/install/libsdrplay/include
mkdir /opt/install/libsdrplay/lib
cd /usr/local/include
sudo mv mirsdrapi-rsp.h /opt/install/libsdrplay/include
cd ../lib
sudo mv libmirsdrapi-rsp.so.2.13 /opt/install/libsdrplay/lib
sudo rm libmirsdrapi-rsp.so*
sudo chown -R user:users /opt/install/libsdrplay/include
sudo chown -R user:users /opt/install/libsdrplay/lib
cd /opt/install/libsdrplay/lib
ln -s libmirsdrapi-rsp.so.2.13 libmirsdrapi-rsp.so.2
ln -s libmirsdrapi-rsp.so.2 libmirsdrapi-rsp.so

Then clone, build and install the support library like this:

git clone https://github.com/pothosware/SoapySDRPlay.git or
git clone /shared/softs/SoapySDRPlay
cd SoapySDRPlay
mkdir build; cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/install/SoapySDR -DLIBSDRPLAY_INCLUDE_DIRS=/opt/install/libsdrplay/include -DLIBSDRPLAY_LIBRARIES=/opt/install/libsdrplay/lib/libmirsdrapi-rsp.so -DSOAPY_SDR_INCLUDE_DIR=/opt/install/SoapySDR/include -DSOAPY_SDR_LIBRARY=/opt/install/SoapySDR/lib/libSoapySDR.so ..
make -j4 install

Before starting any program that uses it (thus SDRangel) you will have to add /opt/install/libsdrplay/lib to the LD_LIBRARY_PATH system variable with export LD_LIBRARY_PATH=/opt/install/libsdrplay/lib:$LD_LIBARY_PATH

Build SDRangel

  • This is for a 24 bit samples build. For 16 bit use -DRX_SAMPLE_24BIT=OFF

Additional options on cmake line for partial compilation:

  • -DBUILD_SERVER=OFF to compile the GUI variant only
  • -DBUILD_GUI=OFF to compile the server variant only

Commands are:

git clone /shared/development/sdrangel
cd sdrangel
mkdir build; cd build
cmake -Wno-dev -DDEBUG_OUTPUT=ON -DBUILD_TYPE=RELEASE -DRX_SAMPLE_24BIT=ON -DMIRISDR_DIR=/opt/install/libmirisdr -DAIRSPY_DIR=/opt/install/libairspy -DAIRSPYHF_DIR=/opt/install/libairspyhf -DBLADERF_DIR=/opt/install/libbladeRF -DHACKRF_DIR=/opt/install/libhackrf -DRTLSDR_DIR=/opt/install/librtlsdr -DLIMESUITE_DIR=/opt/install/LimeSuite -DIIO_DIR=/opt/install/libiio -DCM256CC_DIR=/opt/install/cm256cc -DDSDCC_DIR=/opt/install/dsdcc -DSERIALDV_DIR=/opt/install/serialdv -DMBE_DIR=/opt/install/mbelib -DPERSEUS_DIR=/opt/install/libperseus -DXTRX_DIR=/opt/install/xtrx-images -DSOAPYSDR_DIR=/opt/install/SoapySDR -DCMAKE_INSTALL_PREFIX=/opt/install/sdrangel ..
make -j4 install

Run SDRangel

For the GUI variant in a terminal do /opt/install/sdrangel/bin/sdrangel

For the server variant check the Wiki pages "SDRangel server with supervisor ..." corresponding to your Linux distribution

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.