Compiling GnuRadio 3.3.0 on Mountain Lion


Fixing all the little issues with this process took me days, so I apologize if it’s a complicated and multi-step process.  These steps worked for me, hopefully they work for you too, but YMMV.

First of all, it is vital that you don’t have the macports boost 1.50 installed.  There is a problem with that version where the x86_64 version of the library isn’t compiled.  This is mentioned in an earlier post, and the mac ports trac entry is here.

The easiest way to begin is to install boost 1.49 then run “sudo port install gnuradio-core” and let macports install all of the pre-requisite packages (you may need to perform the fix I mentioned in that earlier post to fix netpbm) .  When it finally gets to gnuradio-core, it will fail.  Now, what you need to do is:

$sudo port edit gnuradio-core

Follow the instructions, again in that earlier post (update 2).

$sudo port clean gnuradio-core
$sudo port -n install gnuradio-core
---> Computing dependencies for gnuradio-core
---> Fetching archive for gnuradio-core
---> Attempting to fetch gnuradio-core-3.3.0_0+python26.darwin_12.x86_64.tbz2 from http://packages.macports.org/gnuradio-core
---> Fetching distfiles for gnuradio-core
---> Verifying checksum(s) for gnuradio-core
---> Extracting gnuradio-core
---> Applying patches to gnuradio-core
---> Configuring gnuradio-core

THIS IS IMPORTANT!: Cancel (control-c) when it says “Configuring gnuradio-core.”  At this point, we need to hand-edit the configure script in the gnuradio source directory.  The reason for this is because some of the assembler code in gnuradio uses 32-bit only opcodes.  When compiling for 64-bit machines they generate errors.  It’s necessary for them to be compiled differently.  Luckily, when Lion was released, a fix was devised and added to macports.  The same exact fix (in principle) should work for Mountain Lion.  But, in the configure script, the change looks for Lion and doesn’t detect Mountain Lion.  We just need to change the test to detect Mountain Lion.  The difference is only the version of darwin used.  This information is in this trac.

$cd /opt/local/var/macports/build/
$ls
<cd to the long directory that ends with science_gnuradio-core>
$cd gnuradio-core/work/gnuradio-3.3.0
$sudo vi configure

Once editing the configure script, search for “darwin*10*” or “darwin*11*”.  This is easy if you hit the forward slash and type “darwin\*1”:

/darwin\*1

The region of interest should look like this (the numbers are the line numbers):

20154     *darwin*11*) 
20155 # The cast to long int works around a bug in the HP C Compiler 
20156 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 
20157 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 
20158 # This bug is HP SR number 8606223364.

Change the *darwin*11* (or *darwin*10*) to: *darwin*12*

Close the vi session by hitting <esc> then : then type wq and enter.

Now, run “sudo port -n install gnuradio-core”.  Make sure that you DO NOT clean the package.  This will destroy our edited configure script.

When that finishes (hopefully it does!) you should be all set!  You’ll probably want to install gnuradio-companion as well as gnuradio-audio-osx.

If you have any problems or questions, let me know in the comments.

, , , ,

  1. #1 by fabrizio on August 9, 2012 - 3:35 pm

    Hello,

    Thank you for this guide. I followed the istructions. I change the darwin*10* in darwin*12* but I got always a compilation error:

    —> Computing dependencies for gnuradio-core
    —> Building gnuradio-core
    Error: org.macports.build for port gnuradio-core returned: command execution failed
    Please see the log file for port gnuradio-core for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_gnuradio-core/gnuradio-core/main.log
    To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
    Error: Processing of port gnuradio-core failed

    Following the steps:

    – clean gnuradio
    – downgrade boost 1.50 to 1.49
    – installing gnuradio
    – modify configure
    – installing without clean.

    Can u suggest me something more?

  2. #2 by hpux735 on August 9, 2012 - 3:41 pm

    Can you post the part of the log file adjacent to the first ‘Error’ is?

    I can’t tell what happened from what you pasted in.

  3. #3 by fabrizio on August 9, 2012 - 4:55 pm

    Hi, sorry, you’re right, here the first error: from log.

    :info:build float_dotprod_sse64.S:57:2: error: unknown directive
    :info:build .version “01.01”
    :info:build ^
    :info:build make[6]: *** [float_dotprod_sse64.lo] Error 1

    It seems the x86_64 problem but I just change configure in gnuradio-3.3.0 port directory as described.

  4. #4 by hpux735 on August 9, 2012 - 9:59 pm

    Not quite. That problem is the compiler.

    I didn’t mention that in the article, sorry about that. It’s vital that macports uses the llvm-gcc compiler rather than the clang one. the clang front end doesn’t know about the .version directive.

    To switch the compiler edit the gnuradio-core port file by typing:

    sudo port edit gnuradio-core

    Then, add a line to the port file indicating a compiler preference:

    configure.compiler llvm-gcc-4.2

    I put it just above this section:
    configure.args --disable-all-components \
    --with-gruel \
    --enable-gnuradio-core

    Unfortunately, I think you have to clean gnuradio-core before it takes effect:

    sudo port clean gnuradio-core

    Which means that you’ll have to re-do the configure edit.

    Good luck! Thanks for catching the error!

  5. #5 by Rob Halverson on August 27, 2012 - 10:48 pm

    I just wanted to thank you for the clear set of instructions you’ve published. I’m a complete rookie when dealing with the more “behind the scenes” computer stuff. I was able to successfully build and install GNU Radio on my MacBook running Mountain Lion with minimal problems. The only hitch was that installing gnuradio-audio-osx also installed boost 1.50.0. When I reverted 1.49.0, everything seemed to fall into place and I could run gnuradio-companion without error.

    I was wondering about getting a more recent version of GNU Radio running. I was hoping to use the Funcube Dongle class that is now included in the distribution. Has anyone tried to get 3.6.1+ up an running on osx? If so, any rookie level hints would be greatly appreciated.

  6. #6 by hpux735 on August 28, 2012 - 5:43 am

    Thanks! I’m glad I could help. 🙂

    I really wish I could help on the new GNU Radio versions, but I haven’t been able to compile them either. I’ve been in communication with others that have tried, and they’ve failed as well. Occasionally, I get motivated and try again. If I come upon some trick, I’ll make sure to write it up!

(will not be published)

Please complete this capcha. I get almost 1000 spam comments a day! * Time limit is exhausted. Please reload CAPTCHA.