Updated gnuradio Install Instructions

As some of you have noted, the installation instructions for gnuradio and HackRF contained in our Field Expedient SDR series no longer work. To remedy this I’ve created a set of installation scripts that automate nearly all of the steps required, updated for newer versions of gnuradio/uhd/osmosdr and supporting the Ubuntu 18.04 LTS.

The scripts install from specific releases and commits of the source code, so they should be much more stable than previous iterations of the instructions.

TLDR

On an Ubuntu 18.04 installation perform the following:

  1. Open a new terminal (Ctl+Alt+t) and type:
    sudo apt -y install git
    mkdir -p install
    cd install
    git clone https://github.com/paulgclark/grc-install
    cd grc-install/install_scripts
    sudo ./grc_from_source.sh

    (This will install both gnuradio and the UHD drivers. It will take between 0.5 to 1.5 hours.)
  2. Open a new terminal and type:
    cd install/grc-install/install_scripts
    ./hackrf_from_source.sh
    (This will install the hackrf tools and the osmocom blocks. It will take only a few minutes.)
  3. Open a third terminal and start gnuradio companion with:
    gnuradio-companion
  4. Depending on the hardware you have available, you can open the following flowgraphs inside gnuradio-companion to test your setup:
    ~/install/grc-install/grc/hackrf-test/fm_receiver_hardware.grc
    ~/install/grc-install/grc/uhd-test/fm_receiver_hardware.grc

Installing gnuradio 3.8

By default the gnuradio install script installs version 3.7.13.5, the latest release before 3.8. If you want to try out the new version, simply type:
sudo ./grc_from_source.sh 3.8

Note that the osmocom team hasn’t yet updated the blocks used for interfacing with the HackRF such that they work with version 3.8 of gnuradio. I’ve instead used Igor Freire‘s fork of their repository (actually, it’s his fork of Mickey Vänskä‘s fork of the osmocom repo). Thanks to both Igor and Mickey!

Installation Scheme

One of the big benefits of the PyBOMBS scheme we originally used in the book was the fact that it installs everything to a target directory under your home directory, rather than doing a global install to root-owned directories. The environment is then loaded with a simple call to a setup_env.sh script generated by the install process (which is automatically added to your ~/.bashrc).

This means if something goes wrong, you can just rm -r the target directory and delete a single line from your .bashrc file. You can then start over without worrying about the previous install polluting your environment.

I’ve preserved this scheme in the new scripts as well. By default the scripts will use the following directory for the target:
~/install/sdr

If you want to use a different target, simply run the script with the new target directory as the second argument. If installing 3.7 this would be:
sudo ./grc_from_source.sh 3.7 ~/install2

For 3.8, it would be
sudo ./grc_from_source.sh 3.8 ~/install2

This installation flow also allows you to easily keep multiple versions of gnuradio on disk. You simply install 3.7 to one target directory and 3.8 to another. You then enable the setup_env.sh file corresponding to the one you want to use at any given moment.

Conclusion

I’ve tested these scripts on numerous laptops and believe I’ve worked out all the issues with both Ettus and HackRF hardware. If you do have an issue, please let me know on GitHub or via email.

20 thoughts on “Updated gnuradio Install Instructions”

  1. Robert says:

    Hi there!
    Could I make a shortcut for gnuradio-companion ?
    Thanks!

    1. Paul Clark says:

      Hi Robert – If you mean an Ubuntu desktop shortcut, you may have issues if you don’t find a way to set the environment variable per your ~/.bashrc file. There are also times when it’s nice to be able to see the console output, and I sometimes find it easier to scroll through the terminal window I’ve used to invoke gnuradio-companion than the smaller console area in the tool itself.

  2. Erwin says:

    Dear Paul,
    I have just bought the first 3 books in color edition and received the volumes 2 and 3 today.
    When will you publish the 4th volume?
    Thanks and godspeed
    PE3ES/F4VTQ
    de Erwin

    1. Paul Clark says:

      Thanks so much, Erwin, for reading the books. We’ve made several different decisions about the future of the books after we published the first three. First, after drafting the Reverse Engineering volume, we decided to throw away what we had and first build a training for SDR app development with Python. The reasoning being that many more powerful reverse engineering techniques become available once you can interact with your SDR (and captured IQ files) programmatically rather than being working in GNU Radio Companion. Another factor, is that we’ve decided to move our training online, which has really captured our attention for much of this year. Although this was always our intent, the COVID situation has caused us to accelerate this project.

      All of which, I’m sorry to say, means we don’t have a firm date for Volume 4 (or Volume 5). I’m sorry for the wait.

  3. Erwin says:

    I have used this script to build on a Oracle VirtualBox Ubuntu 20.04 hosted on Windows10, for Adalm Pluto, and this works perfect so far. Now learning from the examples from Volume 2 of the Series.
    The build on a slow Internet connection took over 2 hours, an error cropped up in the documentation build part with Latex. No harm done as far as I can tell.

    1. Paul Clark says:

      Glad to hear it, Erwin! The documentation errors are harmless.

  4. Brett says:

    Hi Paul,
    Initially I had installed as per your first book, and ended up with 3.8. After realising the differences, I followed the instructions above and changed the bashrc file to remove the initial reference.

    I’m still only opening GRC 3.8! I cannot understand why. Would this be because I am on Ubuntu 20.10? Should I downgrade and start again? Or will I be ok to follow the book without WXGUI and use QTGUI instead?

    I’m looking to purchase your online material in the near future, but want to get my feet wet before I do so. Hope to hear from you soon!

    Cheers,
    Brett from Australia!!

  5. Paul Clark says:

    Hi Brett

    Thanks for getting the books! We always appreciate the interest.

    My recommendation is to stick with 3.8 and use the QT GUI widgets rather than the WX widgets.

    Enjoy!
    PC

    1. Zach says:

      I am a new gnu radio user, what is the best method to follow the books with the qt gui?

      1. Paul Clark says:

        Great question, Zach. I really need to put together a blog post on this. The TLDR is that you replace:

        WX Scope Sink -> QT GUI Time Sink
        WX FFT Sink -> QT GUI Frequency Sink
        WX Text Box -> QT GUI Entry
        WX Slider -> QT GUI Range

        1. Zach says:

          This is perfect and I think will clear up people’s confusion (including my own mouth breathing). Thanks a ton books are great.

  6. James Knox says:

    Bought all 3 vols on Amazon for Kindle on iPad. Planning home-brew project for FM broadcast gadget showing RDBS and NSRC data.

    Installed Ubuntu 18.04 on physical hard drive. Followed updated instructions. Ended up with Gnuradio 3.8.2. Book vol 1 uses Wx, which is dropped by 3.8. I must have done something wrong because I installed gqrx for my RTL-SDR.

    Reinstalled Ubuntu and followed updated instructions again after making sure Gnuradio was not present. Gnuradio 3.8.2 was compiled.

    What needs changed so I can use vol 1 as written?

    I see comment above about QtGui which I know nothing about. I prefer facing one learning curve (Gnuradio and grc) at a time.

    Can you help to get correct version Gnuradio downloaded?

    Thank you.

    1. Paul Clark says:

      James

      Sorry for the complications you’re encountering. To access the WX GUI widgets, you’ll need to install gnuradio 3.7. This is possible on an Ubuntu 18.04 system (but not on Ubuntu 20) using our install scripts.

      When running gnuradio_from_source, you can specify version 3.7 by typing the following in a fresh install:
      mkdir ~/install
      cd ~/install
      git clone https://github.com/paulgclark/grc-install
      cd grc-install/install_scripts
      sudo ./grc_from_source.sh 3.7

      You can also run 3.7 and 3.8 side-by-side on the same machine by setting up a second install directory. If you already have 3.8 installed, you can proceed as follows:
      # edit your ~/.bashrc to comment out the line containing setup_env.sh
      mkdir ~/install2
      # cd to wherever you have grc-install/install_scripts
      sudo ./grc_from_source.sh 3.7 /home/paul/install2 # replace ‘paul’ with your user name

      You can then switch back and forth between 3.7 and 3.8 by selecting the appropriate setup_env.sh script to source.

      Hope this helps!
      PC

      1. Paul Clark says:

        One last thing: GNU Radio 3.7 still doesn’t include the WX GUIs by default. You can add support for them by copying over the configuration file found in our grc-install repo with this command:

        cp ~/install/grc-install/misc/config.conf ~/.gnuradio/.

        You then need to restart gnuradio-companion if it’s open.

  7. Peter Mead says:

    Hello, I hope I’m not to late to get an answer… I am following the terminal commands above, copying and pasting and on the final one in the first group, “sudo ./grc_from_source.sh” I get:
    ERROR: Not running Ubuntu. Install scripts will require
    manual edits to run. Proceed at your own risk.

    So it follows that I’m stuck right there.

    Any help would be great thank you.

    1. Paul Clark says:

      Hi Peter – what’s your OS and version?

  8. Roshan says:

    Firstly, thanks a lot for this – looks like the osmocom blocks have installed successfully on gnuradio 3.8 – have been struggling to find a set of instructions that worked!
    Just wondering if you know how or have a set of instructions to install the adalm pluto sdr blocks?

    1. Paul Clark says:

      Roshan

      Glad to be of help. You could try the following for Pluto:
      sudo apt -y install swig
      sudo apt -y install libiio-dev
      sudo apt -y install libiio-utils+
      sudo apt -y install liborc-dev
      sudo apt -y install gr-iio

      I’ve had success with this in the past, but haven’t tested it recently. Let me know if it works for you!

      1. Roshan says:

        Thanks for the reply
        So I didn’t have any errors with your steps, however the iio / pluto blocks aren’t showing up when I open gnuradio. What has changed however is when I open up the pluto fm reciever file, before there was just a blank space where the pluto blocks should have been, now it has a block in that gap which says ‘missing block pluto source’

        1. Roshan says:

          I also managed to test the osmocom block out with the hackrf, and whilst it shows up in gnuradio, when I execute the fm receiver flowgraph for example, it just says executing at the bottom, no graph or sound or anything pops up. The computer seems to identify the hackrf fine through the terminal, eg it finds the hackrf when typing hackrf_info and its able to scan its frequencies too. So guessing either the osmocom block isn’t working or gnuradio can’t connect to the hackrf properly?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.