Jasa Web Design

GNU Radio & Mac OS X – The Adventure

A few days ago my USRP B100 with WBX daughterboard arrived. It is an awesome piece of kit, judging just from how the PCBs are designed and laid out. The online reviews and demos also agree. My first challenge is going to get the USRP up & running with GNU Radio on my 2013 iMac. I say challenge as many online references are for PPC versions of Mac OS, or simply outdated, as an example, Jon Jacky’s page. And it’s from 2010, just three years ago!

So, like I did with Imagick and MAMP, I’m going to try and write a step-by-step, easy to follow guide as I go along. This is going to be a live post, so keep checking every few days for progress!

Day one: brewing the drivers

The lack of up-to-date, complete information on how to drive the USRP under Mac OS is surprising. Given the market share and BSDness of OS X, one could safely assume it would be a more prone target than, say, Windows. My first attempt to install GNU Radio using macports didn’t go down so well, and having suffered dependencies hell before, I went looking for other ways, without giving it a second look. After some Google time, I found a set of Homebrew recipes in titanous’ GitHub, which claims to have been tested on 10.8. The result is that I could start GNU Radio, but I was missing the WX GUI components, and had only f-ugly QT components. I blame myself for not reading the instructions end-to-end, and the instructions for not pointing out that WX GUI had to be installed beforehand. Other stuff was duplicated. Some stuff was missing. As an example, I could not find the “Variable Slider” component used in Balint Seeber’s tutorial on YouTube. As an example of the ugliness, and keeping up with my obnoxiousness when it comes to user interfaces, here is a graphical review of the window resulting from Balint’s first test:

QT GUI

 

 

 

 

 

I had also installed, but was missing in the sources, the driver for the USRP, following instructions found somewhere else. After a couple of email exchanges with the good people at Ettus, I was pointed to a promising set of guides, back on macports. These will come tomorrow, though.

Day 2: playing with MacPorts

The pointers given by Balint were this tutorial by Andy Bardagjy on getting the right sdcc version to install, followed by installation of the gnuradio port, and finally setting the Python path variables. As some of this info was a bit old, I checked out the sdcc ticket on trac, and it’s shown as fixed, so I’m attempting to go ahead with 3.0.0. For the record, trying to clone 57740 (v2.9.0) failed upon build, so that’s another reason for attempting to go with 3.0.0.

Installing the USRP driver also went fine, just that the port name has been changed to UHD. My first attempt to install GNU Radio after this appeared to work, but for some reason, gnuradio-companion was nowhere to be seen. Trying to install any of the gnuradio-<whatever> ports resulted in an error informing me that they had been replaced by ‘gnuradio’ with options.

After some more Google time, I found this ticket on the MacPorts trac, that explains the issue, and suggests a fix. I managed to get GNU Radio with gnuradio-companion working, at least visually, by running

sudo port install gnuradio +grc +python27 +qtqui +wxgui

which includes the WX GUI components. But it doesn’t include the USRP sources. So, let’s try this instead (after port clean etc.)

sudo port install gnuradio +uhd +grc +swig +wxgui +qtgui +python27

Now, I can see the UHD USRP sources in Companion! More to come later…

Day 3: getting some results!

Finally, the light at the end of the tunnel starts to appear. The WX GUI objects are now present in Companion, but they are also ugly as hell. Maybe it’s a Mac OS rendering issue, I’ll have a go on Ubuntu to see the difference.

The Guide™

Step-by-step, here is how to get your USRP to work under Mac OS X 10.7 and 10.8. By the time you read this, new versions of the different pieces of the puzzle could have appeared, so I’m not making guarantees.

1. Install MacPorts if you haven’t yet done so. Grab it here.

2. Install sdcc – the bugs that were reported appear to have been fixed, so v3.0.0 is fine:

sudo port install sdcc

3. Install the UHD driver for the USRP, including libusb and Python 2.7:

sudo port install uhd +libusb +python27

When you do this, Boost 1.53 will also be installed, which doesn’t seem to give any problems.

4. Install GNU Radio, with UHD support, GRC (the Companion), the WX and QT GUIs (just in case):

sudo port install gnuradio +uhd +grc +swig +wxgui +qtgui +python27

You may see the following, depending on what you had installed before trying this procedure:

Error: org.macports.activate for port qwt returned: Image error: /opt/local/include/qwt/qwt.h is being used by the active qwt52 port.  
Please deactivate this port first, or use 'port -f activate qwt' to force the activation.

I didn’t really feel like bug hunting any longer, so I just forced it with

sudo port -f activate qwt

and was done with. I’ll rest my case with a short quote from Miguel de Icaza’s post on why he ended up with a Mac instead of Linux. He started the GNOME project and Mono.

“While I missed the comprehensive Linux toolchain and userland, I did not miss having to chase the proper package for my current version of Linux, or beg someone to package something. Binaries just worked.”
 

The build may finish with a complaint about qwt52 not installing as qwt is already installed (WTF?), but gnuradio starts OK.

Once this is done, you should be able to start gnuradio-companion. In order to use the B100, you need to add, for example, a UHD: USRP Source. Here is an updated example of a WFM receiver, you can download the .grc file here.

WFM Receiver

 

 

 

 

 

 

14 Responses to “GNU Radio & Mac OS X – The Adventure”

  1. Alexandru Csete March 7, 2013 at 11:28 #

    The overlapping buttons issue is a bug in Qt. It exists on Mac when one tries to pack widgets closely without room between them. The issue is probably fixed in Qt 5, until then Qwt could work around it using:
    someButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
    Other than that, Qwt looks the same as it did 10 years ago…

    • Mike March 7, 2013 at 17:46 #

      Alexandru,

      Thank you for your comments & clarification – the UI does indeed look much better under Linux, as shown in the various tutorial videos. I had my share of fights with Qt a few years ago, when we developed a cross-platform client, the conclusion for future developments being that platform-native always gives better results.

  2. Todd Lefkowitz May 6, 2013 at 19:34 #

    Hi Mike

    Thanks for the blog.

    I am trying to install Gnuradio on my Mac. I got through step 2 w/o problems. When I typed the command in step 3, I get:

    Warning: Xcode does not appear to be installed; most ports will likely fail to build.
    —> Computing dependencies for uhdError: Unable to execute port: can’t read “build.cmd”: Failed to locate ‘make’ in path: ‘/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin’ or at its MacPorts configuration time location, did you move it?

    I downloaded python 27, libusb, and got UHD through Github

    (I am a newbie when it comes to Linux and such, and would greatly appreciate some guidance)

    Thanks
    Todd

    • Mike May 7, 2013 at 19:12 #

      You also need to install XCode, you can do this from the App Store. Once installed, in options, install the Command Line Tools.

      • shutin June 15, 2013 at 04:14 #

        “Warning: Xcode does not appear to be installed”

        >>”You also need to install XCode,”

        I donno man, I mean, are you sure that’s the problem?

  3. David Shields May 19, 2013 at 07:31 #

    Dude!

    Many thanks for this. One of the most frustrating things regarding the Linux community is the plethora of rubbish around regarding installs etc.

    Many thanks again

  4. Alexander Tudor May 22, 2013 at 16:39 #

    Many thanks for putting this together!

    When I opened up the variable_config grc example I got:

    Error: Block key “variable_slider” not found in Platform – grc(GNU Radio Companion)

    followed by a similar error about wxgiu_fftsink2.

    Any thoughts?

    Alex

    • Mike May 27, 2013 at 16:37 #

      This is most likely a result of wxgui not being present in your system. I couldn’t get it to work, so I just stuck with the QT GUI, which is just as ugly.

  5. Dan Marlow June 10, 2013 at 18:02 #

    Thanks to Mike and others for this discussion, which has been quite helpful. I also encountered the qwt issue, which in fact affects a number of other things that I am trying to do. Is there a way to address this in a lasting way? For example, is there a way to learn what the consequences of uninstalling qwt would be (which other programs depend on it)?

    –Dan

  6. shutin June 15, 2013 at 04:23 #

    While I appreciate the guide (sort of, I just read how you failed to follow the 1pg of directions for the brew install and made sure I read all of them before I tried and it seems to have installed), I can’t help but wonder why you are nitpicking a GUI. If this were an apple product sure, get upset that a few things aren’t aligned properly. But this is cutting-edge hacked together software. The beauty is in the CODE that is underlying the whole thing. I don’t know about your background, but I’m a software developer and I can tell you that the guts always come FIRST, then if you have time you can spend hours twiddling with rulers and crap to get your stupid layout to lay out.

    Look at it this way, if it were easy for the authors to correct the issues you pointed out before releasing, THEY WOULD.

    I should note that in this “guide” for running Gnu Radio on Mac OSX, you failed to highlight/bold/pre the actual command used to RUN GNU RADIO ON MAC OSX! I had to read over 3x before I realized it was gnuradio-companion. Sigh.

    Thanks for the tips though.

    • Mike June 15, 2013 at 08:33 #

      Not sure where to begin, but the brew install was flawed. I nitpick at the GUI because it’s one of the things I know a lot about, usability. Usability begins with an appealing UI. If you don’t believe me, read Jeff Atwood’s great post on why developers shouldn’t design GUIs:

      http://www.codinghorror.com/blog/2006/11/this-is-what-happens-when-you-let-developers-create-ui.html

      There is a reason why Apple has almost 100 BILLION bucks in the bank, in cash. I believe UI has something to do with that.

      It’s really NOT that much of an extra effort to at least line things up, and make sure things don’t overlap each other. Really, try it.

    • Evan July 30, 2013 at 00:40 #

      I see both sides of this coin, but UI is definitely key in encouraging people to use and tell others about what you spent time creating. Case and point would be your mention the post didn’t have important info in Bold weight (not a jab at Mike, just a convenient example of usability planning for the user)

  7. Evan July 30, 2013 at 00:59 #

    Hi Mike, thanks for posting this quick guide. I see GNU is coming along nicely, I’ve got the 3.7 build on OSX10.6. I’m running GRC (companion), however I’m missing some blocks inside ‘modulators’ for example, and a few others. I see ‘atsc’ for in my gnuradio folders in opt but not in the GUI block tree. Will GRC usually run all blocks in the GRC tree folders? Or do you have to explicitly point to extra blocks as needed on launch?

    Thanks

  8. Stephan January 19, 2014 at 02:31 #

    THanks for the instructions. Worked perfect for me. Running my project now thanks to you!

Leave a Reply:

Gravatar Image