Building rHDF5 on OSx Lion (XCode 4.2) - Sage-Bionetworks/rHDF5 GitHub Wiki

R2.14 is configured to use the g++-4.2, but OSX Lion does not come with this compiler. Instead it comes with lvm-g++-4.2. To build packages containing C++ code on Lion you can do one of two things:

OPTION #1

Create a symbolic link to g++-4.2

$ sudo ln -s /usr/bin/llvm-g++-4.2 /usr/bin/g++-4.2

OPTION #2

Modify R's Makeconf files

First find the location of the Makeconf files on your system.

$ R CMD SHLIB --dry-run
make cmd is
  make -f '/Library/Frameworks/R.framework/Resources/etc/x86_64/Makeconf' -f '/Library/Frameworks/R.framework/Resources/share/make/shlib.mk' SHLIB='' OBJECTS=

You will then need to edit the Makeconf file for both the x86_64 and i386 architectures. On the example system, you would need to edit the following:

/Library/Frameworks/R.framework/Resources/etc/x86_64/Makeconf

/Library/Frameworks/R.framework/Resources/etc/i386/Makeconf

In these files you will need to change the value of the CXX variable:

CXX = g++-4.2 -arch i386

becomes

CXX = g++ -arch i386