Tuesday, October 4, 2011

Installing gcc on MAC OS

Download MacPorts. There are available images for Lion and Snow Leopard.

The you should want to update your MacPorts using the commands:
sudo port selfupdate
sudo port upgrade outdated

NOTE: FOR GRAPHLAB, PLEASE USE gcc45 and not gcc46 as in the below
example.

Then you can install gcc using
sudo port install gcc46      #change this to gcc45 for graphlab
You can view other versions of gcc using the command
port search gcc
After installation you can view installed file by
port contents gcc46        #change this to gcc45 for graphlab

Now if you have several gcc versions installed you may want to choose the right version to use.
This is done using the command:
sudo port select gcc mp-gcc46

Now I got some error:
Selecting 'mp-gcc46' for 'gcc' failed: could not create a new link for "/opt/local/bin/gcj'. It seems it is a known issue discussed here.
I applied a quick and dirty fix (Since I don't need gcc Java:)
sudo touch /opt/local/bin/gcj-mp-4.6
And then I get:
Selecting 'mp-gcc46' for 'gcc' succeeded. 'mp-gcc46' is now active.

2 comments:

  1. Hi Danny,

    Does this mean that now (or in the near future) graphlab won't be compilable using OS X's system/vanilla gcc?

    Just curious, thanks.

    -steve

    ReplyDelete
  2. Hi!
    Graphlab with itpp support compiles fine using gcc 4.2.1
    GraphLab with Eigen support requires gcc 4.5 (port install gcc45).

    Best,
    DB

    ReplyDelete