Saturday, September 8, 2012

Compiling GNURadio on the Raspberry Pi (Raspi)


So a few weeks ago I set out to compile Gnuradio on my Raspberry Pi. It took a lot of googling but thanks to many users who encountered similar challenges, I was able to piece together the recipe below, that should result in a compiled gnu radio installation.

In the following section, lines starting with "#" should be executed as the root user. Lines starting with "$" may be executed as your favorite raspberry pi user.

build and activate an 1GB swap

(Credit to for posting these steps on the forum - thank you)

  # swapoff
  # swapoff -a
  # sudo dd if=/dev/zero of=/myswap bs=1024 count=1024k
  # mkswap /myswap
  # free -m
  # swapon /myswap
  # free -m



* Raspberry pi wheezy/sid (make sure to get a suitable image)    *** Image (Wheezy 7.5) is too new, not supported by build script yet.
    *** Image (Wheezy 7.2) should work perfectly with this procedure :)
    *** Raspian images prior to January 2014 should work as long as the version is listed: "*6.0*|*wheezy*|*sid*|*7.1*|*7.0*|*7.2*|*7.3*|*7.4*)"

Option-1: build-gnuradio script (recommended) 

As the pi user (or another user with sudo access) run the following commands

$ cd; mkdir gnuradio; cd gnuradio
$ wget
$ chmod 755 ./build-gnuradio
$ ./build-gnuradio -v

Monitor the screen periodically and make to respond to the periodic yes/no prompts. If you get an error and the script aborts, try running it a second, and third time if necessary. Otherwise if it seems to be running, let it run if usually takes at least 24 hours (one day)!

Big thanks to patchvonbraun for building and maintaining the build-gnuradio script! It builds gnuradio along with the common goodies such as the rtl utilities and hackrf to name a couple.

Option-2: build from source manually

Install prerequisite packages

  # apt-get install python-cheetah libboost-all-dev python-lxml python-wxgtk2.8 python-numpy python-lxml libfftw3-dev libsdl1.2-dev python-scipy python-matplotlib python-tk octave liboctave-dev libgsl0-dev python-sphinx libcppunit-dev libuhd-dev swig python-qt4-dev libqwt-dev git

Check-out the latest copy of the gnuradio source tree

  $ cd ; mkdir gnuradio; cd gnuradio
  $ time git clone

cd into the build directory and run cmake.

  $ cmake -Dhave_mfpu_neon=0 -DCMAKE_CXX_FLAGS:STRING="-march=armv6 -mfpu=vfp -mfloat-abi=hard" -DCMAKE_C_FLAGS:STRING="-march=armv6 -mfpu=vfp -mfloat-abi=hard" ../

Compile (Takes about 24 hours!)

  $ make


  $ sudo make install


  1. are you able to use gnuradio-companion? does the pi have enough horsepower to use gnu radio blocks to do even simple fm demodulation?

  2. Hi!
    I compiled on the basis of the above description and the GnuRadio, rtlsdr. The GRC start simple (signal source - audio sink) works, but if it is complex-float conversion, or the like, you can freeze it all. What went wrong? Please help me!

  3. cmake -Dhave_mfpu_neon=0 -DCMAKE_CXX_FLAGS:STRING="-march=armv6 -mfpu=vfp -mfloat-abi=hard" -DCMAKE_C_FLAGS:STRING="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
    CMake Error at CMakeLists.txt:22 (message):
    Prevented in-tree build. This is bad practice.

    -- Configuring incomplete, errors occurred!

    1. 2013-02-09-wheezy-raspbian ,had the same problem.
      compiling can be started by inserting a # in front of line 21,22,23 in file CMakeLists.txt. Sure that i doesn't solve
      the problem of this "bad practice" but still allows the script to continue with compiling.

      Thank you for providing this info , helped me a lot

  4. works fine with latest and updated raspbian-img.
    Thank you for this guide!

  5. Thanks for the guide, it works flawlessly! I had a little trouble while compiling. That common smsc95xx kernel error. Discovered it while the make run in the kernel log. It slowed down the make process. I had to disable smsc95xx turbo mode at the kernel (cmdline.txt), then continue make from 37%. I think it was because of the mmc0 being written hard. (I'm using an UHS-I card.) Thanks again!

  6. /It could be better to do this on nfs or an USB-HDD. Oh well, nice to know that the SDHC card I use is tough enough./ :)

  7. This comment has been removed by the author.

  8. Twice I did the compiling. Once with distcc and once on the Pi alone. And both times I get the same issues not finding the libraries:

    gnuradio-config-info: error while loading shared libraries: cannot open shared object file: No such file or directory

    Any suggestions?

    1. Found the solution - just run "sudo ldconfig" and everything is fine :) You could add that to this great guide

  9. Hi I have problems with these libraries:
    sudo apt-get -y purge 'gnuradio-*' >>$LOGDEV 2>&1
    sudo apt-get -y purge 'libgruel-*' >>$LOGDEV 2>&1
    sudo apt-get -y purge 'libgruel*' >>$LOGDEV 2>&1
    sudo apt-get -y purge 'libgruel0*' >>$LOGDEV 2>&1
    sudo apt-get -y purge 'libgnuradio*' >>$LOGDEV 2>&1
    sudo apt-get -y purge 'python-gnuradio*' >>$LOGDEV 2>&1
    At the begining of the build-gnuradio script. The output was similar like this: E: couldnt find libgruel,etc. Could anyone help me please.

  10. Thank you for the note - double check the raspian image you are using - it can't be too new or too old - I suggest - and I suggest not loading any updates before building gnuradio. let me know how it works out!