Rationale
Generally speaking, building from source offers one key advantage: it is the only way to test the latest features offered by the community. Moreover, if you intend to develop or fix bugs (or even help the community fix bugs), you will need to have a working and up-to-date software environment. All in all, compiling LimeSDR’s software stack is fairly straight forward. It is barely a matter of getting the right cmake options.
While we want to compile as many software components as possible, it is sometimes easier to use dependencies given by your package manager. Mixing packages and source binaries is generally considered a bad idea, but building everything from scratch is tedious. We will try to bring the packaged dependencies to a minimum. In the event of a system upgrade, it is wiser to recompile everything to avoid API incompatibilities brought by library updates.
Prerequisites
- Basic git usage (git clone)
- Linux command line (bash)
- Decent grasp on the compilation process
Getting started
We will install every libraries in a folder designated by the environment variable $LIME_INSTALL . We will also use a separate folder, $LIME_SRC, to collect the git sources. Therefore, the first thing to do is to spawn a shell and export both variables.
export LIME_INSTALL=~/projects/sdr_install/ export LIME_SRC=~/projects/sdr_src/ mkdir -p $LIME_INSTALL mkdir -p $LIME_SRC
The $LIME_INSTALL folder will contain all the binaries, libraries, python scripts and grc blocks needed for our softwares to run. We will instruct cmake to install binaries in this specific folder. That way, everything that we will do will not mess with our existing system. If anything goes wrong, a simple wipe off of the $LIME_INSTALL folder will get you clean again.
My environment will contain the following softwares:
- LimeSuite
- SoapySDR
- Volk
- Pothos
- GNU Radio
- rtl-sdr
- OsmoSDR
- gqrx
So let’s clone each repository. The recursive option on the PothosCore line tells git to also fetch its submodules.
cd $LIME_SRC git clone https://github.com/myriadrf/LimeSuite.git git clone https://github.com/pothosware/SoapySDR.git git clone https://github.com/gnuradio/volk.git git clone --recursive https://github.com/pothosware/PothosCore.git git clone https://github.com/gnuradio/gnuradio.git git clone https://github.com/osmocom/rtl-sdr.git git clone https://git.osmocom.org/gr-osmosdr git clone https://github.com/csete/gqrx.git
Compiling and installing
This is the most challenging bit, but the folks in the SDR community made a good job at keeping the compilation process simple. All in all, it is only a matter of running cmake, make and make install.
Every repository contains instructions in its README file. It contains precious information about how to build, install and run. Most importantly, they describe the dependencies that each piece of software requires. Github projects’ Wiki pages also contain valuable instructions.
These dependencies may in turn be installed by compiling them, or by using the package manager of your system. In the latter, I suggest that you recompile your entire software stack each time you upgrade your system. Otherwise, you may encounter weird bugs and behaviors in the event that a used library gets updated. Also keep in mind that every distribution is different: package names and content differ. You will need to do a bit of searching when you encounter compilation problems.
Finally, pay attention to the CMake output after each invocation. It will allow you to check whether the needed functionalities were correctly enabled at build time.
SoapySDR
SoapySDR is the glue code between LimeSuite and Pothos/GNU Radio. It is necessary to compile Soapy before LimeSuite, as LimeSuite will need to link against it. As stated in Soapy’s Wiki, get the following dependencies.
sudo apt-get install cmake g++ libpython-dev python-numpy swig
Then simply run the following.
cd $LIME_SRC/SoapySDR/ mkdir mybuild cd mybuild cmake -DCMAKE_INSTALL_PREFIX=$LIME_INSTALL .. make -j8 make install
CMAKE_INSTALL_PREFIX instructs make to put all the binaries into $LIME_INSTALL when running make install.
Now that SoapySDR is installed, we can run it from the $LIME_INSTALL folder. The LD_LIBRARY_PATH variable indicates where libraries can be found and takes precedence over our standard system library folder. Let’s have it point to the libraries we have just built. Note that we need permission to access the LimeSDR. Either add the right udev rule or run each program with sudo.
[xrn mybuild]$ sudo LD_LIBRARY_PATH=$LIME_INSTALL/lib $LIME_INSTALL/bin/SoapySDRUtil ###################################################### ## Soapy SDR -- the SDR abstraction library ###################################################### Usage SoapySDRUtil [options] Options summary: --help Print this help message --info Print module information --find[="driver=foo,type=bar"] Discover available devices --make[="driver=foo,type=bar"] Create a device instance --probe[="driver=foo,type=bar"] Print detailed information --check[=driverName] Check if driver is present Rate testing options: --args[="driver=foo"] Arguments for testing --rate[=stream rate Sps] Rate in samples per second --channels[="0, 1, 2"] List of channels, default 0 --direction[=RX or TX] Specify the channel direction
LimeSuite
The LimeSuite documentation tells us the packages we need before compiling. According to chapter 3.1.1 Ubuntu, we will need the following packages installed on our system.
#install core library and build dependencies sudo apt-get install git g++ cmake libsqlite3-dev #install hardware support dependencies sudo apt-get install libi2c-dev libusb-1.0-0-dev #install graphics dependencies sudo apt-get install libwxgtk3.0-dev freeglut3-dev
Do not install libsoapysdr-dev as we want to use the latest version of the library we compiled above.
Once again, building is straightforward.
cd $LIME_SRC/LimeSuite/ mkdir mybuild cd mybuild cmake -DCMAKE_INSTALL_PREFIX=$LIME_INSTALL -DCMAKE_PREFIX_PATH=$LIME_INSTALL .. make -j8 make install
CMAKE_PREFIX_PATH tells CMake where we installed the previous libraries (in this case, SoapySDR).
Pay close attention to cmake‘s output. We should see the following.
-- ###################################################### -- ## LimeSuite enabled features -- ###################################################### -- [...] * SoapySDRLMS7, SoapySDR bindings for LMS7 [...]
If to the contrary, we have the following line somewhere, it means that we have done something wrong.
Could NOT find SoapySDR (missing: SoapySDR_DIR)
Let’s now test LimeSuite.
sudo LD_LIBRARY_PATH=$LIME_INSTALL/lib/ $LIME_INSTALL/bin/LimeUtil sudo LD_LIBRARY_PATH=$LIME_INSTALL/lib/ $LIME_INSTALL/bin/LimeSuiteGUI
Volk
Update: Building an unreleased version of Volk from source may not be the wisest thing to do. Please have a look at this gnuradio issue before proceeding further.
Volk is a utility created within the GNU Radio project. It profiles our system and discovers wich SIMD instructions are supported. These are special CPU instructions that allow the optimization of certain tasks by performing parallel computations. It will potentially optimize the various blocks used in Pothos/GNU Radio and gqrx. As always, let’s do the build thing.
cd $LIME_SRC/volk mkdir mybuild cd mybuild cmake -DCMAKE_INSTALL_PREFIX=$LIME_INSTALL -DCMAKE_PREFIX_PATH=$LIME_INSTALL .. make -j8 make install
We now have to run the profiling, this will take a while. Run the following command.
LD_LIBRARY_PATH=$LIME_INSTALL/lib/ $LIME_INSTALL/bin/volk_profile
More information can be found on this GNU Radio wiki page.
Pothos
As stated in Pothos’ README file, dependencies are already included in the source tree (as git submodules) and will be built automatically if they are missing from your system.
cd $LIME_SRC/PothosCore mkdir mybuild cd mybuild cmake -DCMAKE_INSTALL_PREFIX=$LIME_INSTALL -DCMAKE_PREFIX_PATH=$LIME_INSTALL .. make -j8 make install
Once again, we want to see
* Soapy, SDR source and sink blocks for radio hardware
in CMake‘s list of enabled features.
Now let’s start Pothos with the following line.
sudo LD_LIBRARY_PATH=$LIME_INSTALL/lib/ $LIME_INSTALL/bin/PothosFlow
GNU Radio
First of all, let’s have a look at the GNU Radio build guide. GNU Radio requires the boost library.
sudo apt-get install libboost-all-dev
We can proceed with the compilation. The ENABLE_INTERNAL_VOLK=OFF option tells CMake not to use the Volk submodule present in the gnuradio git tree. This way, make will use the Volk library we compiled above. Note that building gnuradio may take some time.
cd $LIME_SRC/gnuradio mkdir mybuild cd mybuild cmake -DENABLE_INTERNAL_VOLK=OFF -DCMAKE_INSTALL_PREFIX=$LIME_INSTALL -DCMAKE_PREFIX_PATH=$LIME_INSTALL .. make -j8 make install
To run gnuradio, it needs to know where to find its blocks and python files. To do so, we use the PYTHONPATH and GRC_BLOCKS_PATH variables.
sudo LD_LIBRARY_PATH=$LIME_INSTALL/lib/ PYTHONPATH=$LIME_INSTALL/lib/python2.7/dist-packages GRC_BLOCKS_PATH=$LIME_INSTALL/share/gnuradio/grc/blocks $LIME_INSTALL/bin/gnuradio-companion
Note: If you’re not using a Debian-based distribution (Ubuntu users are not concerned), python modules will be installed in site-packages instead of dist-packages. The correct command would become
sudo LD_LIBRARY_PATH=$LIME_INSTALL/lib/ PYTHONPATH=$LIME_INSTALL/lib/python2.7/site-packages GRC_BLOCKS_PATH=$LIME_INSTALL/share/gnuradio/grc/blocks $LIME_INSTALL/bin/gnuradio-companion
Otherwise, you may end up with the following error message.
Cannot import gnuradio. Is the python path environment variable set correctly? All OS: PYTHONPATH Is the library path environment variable set correctly? Linux: LD_LIBRARY_PATH Windows: PATH MacOSX: DYLD_LIBRARY_PATH
rtl-sdr
rtl-sdr is required by gr-osmosdr.
cd $LIME_SRC/rtl-sdr mkdir mybuild cd mybuild cmake -DCMAKE_INSTALL_PREFIX=$LIME_INSTALL -DCMAKE_PREFIX_PATH=$LIME_INSTALL .. make -j8 make install
gr-osmosdr
gr-osmosdr is required by gqrx.
cd $LIME_SRC/gr-osmosdr mkdir mybuild cd mybuild cmake -DCMAKE_INSTALL_PREFIX=$LIME_INSTALL -DCMAKE_PREFIX_PATH=$LIME_INSTALL .. make -j8 make install
We need to make sure that SoapySDR support is enabled. If not, something went wrong.
-- ###################################################### -- # Gnuradio enabled components -- ###################################################### [...] -- * SoapySDR support [...]
gqrx
gqrx builds against gnuradio, it is therefore mandatory to build gnuradio first. Dependencies information can be found in gqrx’ README. You will need Qt5 for gqrx.
sudo apt-get install qtbase5-dev
cd $LIME_SRC/gqrx mkdir mybuild cd mybuild cmake -DCMAKE_INSTALL_PREFIX=$LIME_INSTALL -DCMAKE_PREFIX_PATH=$LIME_INSTALL .. make -j8 make install
Running still follows the same logic.
sudo LD_LIBRARY_PATH=$LIME_INSTALL/lib/ $LIME_INSTALL/bin/gqrx
Acknowledgement
This research work was supported by the Armasuisse Science and Technology Federal Office
as part of project WISE [grant 8003514629].
13 comments
Ran into this at VOLK
flash@Flash64Super:~/projects/sdr_src/volk/build$ cmake ..
— The C compiler identification is GNU 5.4.0
— The CXX compiler identification is GNU 5.4.0
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — works
— Detecting C compiler ABI info
— Detecting C compiler ABI info – done
— Detecting C compile features
— Detecting C compile features – done
— Check for working CXX compiler: /usr/bin/c++
— Check for working CXX compiler: /usr/bin/c++ — works
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info – done
— Detecting CXX compile features
— Detecting CXX compile features – done
— Build type not specified: defaulting to release.
— Build type set to Release.
— Found Git: /usr/bin/git (found version “2.7.4”)
— Extracting version information from git describe…
— Found PythonInterp: /usr/bin/python2 (found suitable version “2.7.12”, minimum required is “2”)
—
— Python checking for python >= 2.7
— Python checking for python >= 2.7 – found
—
— Python checking for mako >= 0.4.2
— Python checking for mako >= 0.4.2 – not found
—
— Python checking for six – python 2 and 3 compatibility library
— Python checking for six – python 2 and 3 compatibility library – found
CMake Error at CMakeLists.txt:88 (message):
Mako templates required to build VOLK
— Configuring incomplete, errors occurred!
Comments?
> Python checking for mako >= 0.4.2 – not found
Please install python-mako.
It appears that installing python3-mako (as opposed to the python2 version) solves this issue :).
I have this problem:
~/projects$ dir
sdr_install sdr_src temp
alan@alan-Z87-HD3:~/projects$ -DCMAKE_INSTALL_PREFIX=$LIME_INSTALL -DCMAKE_PREFIX_PATH=$LIME_INSTALL ..
bash: -DCMAKE_INSTALL_PREFIX=/home/alan/projects/sdr_install/: No such file or directory
I have looked in various linux related sites and I can find no way of ensuring that the folder/directory is recognised as such. The temp directory exists because I copied the contents of sdr_install into it and then deleted sdr_install and recreated it (this was to make sure that there were no unexpected flags associated with sdr_install).
please help.
Your command is incomplete and does not make sense. You forgot “cmake” at the beginning. Bash is trying to execute “-DCMAKE_INSTALL_PREFIX=/home/alan/projects/sdr_install/” which does not exist.
I received following error while building volk, any help please.
[100%] Linking CXX executable volk_profile
/usr/bin/ld: CMakeFiles/volk_profile.dir/volk_profile.cc.o: in function `boost::system::error_category::std_category::equivalent(std::error_code const&, int) const’:
volk_profile.cc:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x30): undefined reference to `boost::system::detail::generic_category_instance’
/usr/bin/ld: volk_profile.cc:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x4e): undefined reference to `boost::system::detail::generic_category_instance’
/usr/bin/ld: volk_profile.cc:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x113): undefined reference to `boost::system::detail::generic_category_instance’
/usr/bin/ld: CMakeFiles/volk_profile.dir/volk_profile.cc.o: in function `boost::system::error_category::std_category::equivalent(int, std::error_condition const&) const’:
volk_profile.cc:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0x2d): undefined reference to `boost::system::detail::generic_category_instance’
/usr/bin/ld: volk_profile.cc:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0x53): undefined reference to `boost::system::detail::generic_category_instance’
collect2: error: ld returned 1 exit status
make[2]: *** [apps/CMakeFiles/volk_profile.dir/build.make:117: apps/volk_profile] Error 1
make[1]: *** [CMakeFiles/Makefile2:295: apps/CMakeFiles/volk_profile.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Hi,
Please see https://github.com/gnuradio/gnuradio/issues/1856 🙂
It does not seem to work anymore:
Git master is now based on 3.8, which ends up using Python3.x. GR is successfully build, but gr-osmosdr seems unable to cope with this, and fails to find GR.
Reverting back to 3.7 (maint-3.7 branch) does not work either: GR is unable to detect the external volk installation, and Git does nothing when submodules are initialized – volk module is not cloned/checked out.
Ok, the git syntax hint was incomplete (–init was missing). After installing many more dependencies (GR 3.8 is quite different from GR 3.7), I managed to build the whole stack.
It does not go very well: osmosdr_fft gives:
[WARNING] Calibrating Rx for 2.5 MHz (requested 0.1 MHz [out of range])
[ERROR] Rx calibration: MCU error 5 (Loopback signal weak: not connected/insufficient gain?)
[ERROR] USB TRANSFER ERROR
while gqrx crashes on start-up:
gr-osmosdr v0.1.4-127-g4d83c606 (0.1.5git) gnuradio 3.7.13.4
built-in source types: file fcd rtl rtl_tcp rfspace soapy redpitaya
Resampling audio 96000 -> 48000
BookmarksFile is /home/eblot/.config/gqrx/bookmarks.csv
gr-osmosdr v0.1.4-127-g4d83c606 (0.1.5git) gnuradio 3.7.13.4
built-in source types: file fcd rtl rtl_tcp rfspace soapy redpitaya
[INFO] Make connection: ‘LimeSDR-USB [USB 3.0] 90726074D2515’
[INFO] Reference clock 30.72 MHz
[INFO] Device name: LimeSDR-USB
[INFO] Reference: 30.72 MHz
[INFO] LMS7002M calibration values caching Disable
terminate called after throwing an instance of ‘std::invalid_argument’
what(): destination port 1 out of range for source_impl(45)
Aborted (core dumped)
at least, now GQRX sees my LimeSDR. It would be nice if it could actually use it.
I’ve just stumbled over your comment. How did you get rid of the ‘USB TRANSFER ERROR’?
I try to play around with grgsm_trx and osmocom-bb, and I’m getting tons of these as soon as I start the layer 2/3 software.
Thank you in advance!
Ok, I finally managed to make it work, on both Linux Mint & macOS Mojave, with some minor tweaks. Thanks **a lot** for this step-by-step guide.
GQRX is highly sensitive with the device string, and crashes on any minor issue.
If it uses … the default device string for LimeSDR, for example. It *has* to be “soapy=0,driver=lime” to start up as expected.
The LimeSDR stack seems also to be quite unstable and buggy, it is common to crash with many different error message when some parameter is updated, such as the bitrate for example.
Finally, the LimeSDR seems to be rapidly unstable after a couple of minutes of use – even their own quicktest start to fail randomly. It seems related to the temperature, so I guess active cooling with a fan is definitely required.
Thanks to this great tutorial!!! (wished limesdr crew had prepared this already)
put it into a docker images based on ubuntu 18.04, cause i had some troubles on arch with dependencies, so if someone would like to test it:
https://github.com/xeniter/limesdr_docker/
Updated 2020 version : https://discourse.myriadrf.org/t/starter-guide-gqrx-gnuradio3-7-soapy-gr-osmo-full-working-ubuntu-18-04/6151