12

I upgraded my Mac OS X from ML to Maverick today, and installed the preview version of RStudio. I think I also updated Xcode to 5.0.1 and installed Command Line Tools on my MacBook Pro. However, when I install my own package from source, I got the following error:

* installing *source* package ‘PKG’ ...
** libs
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c lm.c -o lm.o
make: llvm-gcc-4.2: No such file or directory
make: *** [lm.o] Error 1
ERROR: compilation failed for package ‘PKG’
* removing ‘/Library/Frameworks/R.framework/Versions/3.0/Resources/library/PKG’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.0/Resources/library/PKG’
Warning in install.packages :
  installation of package ‘../PKG_0.2.7.tar.gz’ had non-zero exit status

Can I know if there is any solution to solve this issue? Thanks! Part of my sessionInfo:

R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
alittleboy
  • 10,616
  • 23
  • 67
  • 107
  • Does this help: http://www.r-bloggers.com/rstudio-and-os-x-10-9-mavericks/ – Tyler Rinker Oct 23 '13 at 05:13
  • `make: llvm-gcc-4.2: No such file or directory` – Ricardo Saporta Oct 23 '13 at 05:13
  • @TylerRinker: I saw that post and installed that preview version. I don't think it's a problem of RStudio, but there is something wrong with the gcc and command line tool in my new system... or with R itself. – alittleboy Oct 23 '13 at 05:14
  • @RicardoSaporta yes, that's the culprit. how to solve it? – alittleboy Oct 23 '13 at 05:14
  • 1
    Well, glad I didn't install Mavericks just yet :-( . Meanwhile, you might find some ideas by searching recent `r-sig-mac` mailing list archives at https://stat.ethz.ch/pipermail/r-sig-mac/ I'm off to check that out for myself. – Carl Witthoft Oct 23 '13 at 11:38
  • @CarlWitthoft thanks! I saw a post there and it seems for now there is no solution if I installed Xcode 5.0.1 in Maverick... what a pain! – alittleboy Oct 23 '13 at 15:39

1 Answers1

15

Please refer to this link: https://stackoverflow.com/a/19505252/1510531. After modifying the following lines in the Makeconf file in /Library/Frameworks/R.framework/Resources/etc:

CC=clang
CXX=clang++
CXXFLAGS= -O3 -pedantic

I can now install R source packages :)

Update

According to @asieira, the last CXXFLAGS is not recommended, so just make the following changes:

CC=clang
CXX=clang++
Community
  • 1
  • 1
alittleboy
  • 10,616
  • 23
  • 67
  • 107
  • 2
    Worked for me without changing the CXXFLAGS. I actually advise against using -O3 since the R documentation says it is known to cause errors: http://cran.r-project.org/doc/manuals/r-release/R-admin.html#Compilation-flags – asieira Oct 23 '13 at 19:31