Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot install R package from source In Mac OSX Maverick [duplicate]

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
like image 750
alittleboy Avatar asked Oct 23 '13 05:10

alittleboy


People also ask

How do I install R packages on Mac?

(If R is not installed, then follow these directions to install R for Mac OS.) Select the Packages & Data menu and Packages Installer submenu item. In the dialog box, click Get List to compile a current list of available packages. Select the packages to install (use the <command> key to select multiple packages).

Where do R packages get installed Mac?

The home location for R packages from the Mac finder on my machine is "desktop/Macintosh HD/Library/Frameworks/R. framework/Resources/library/". Within library you will see all the packages that you have downloaded, and installed. Examining some of those, e.g., the sem package, helps one understand what goes where.


1 Answers

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++
like image 130
alittleboy Avatar answered Sep 22 '22 21:09

alittleboy