Skip to content

Instantly share code, notes, and snippets.

@stwind
Last active December 10, 2015 02:58
Show Gist options
  • Save stwind/4371610 to your computer and use it in GitHub Desktop.
Save stwind/4371610 to your computer and use it in GitHub Desktop.
Installing plyr 1.8 on OSX from cran

Install plyr on osx throws this error:


> install.packages("plyr", repos = "http://cran.r-project.org")


* installing *source* package ‘plyr’ ...

** package ‘plyr’ successfully unpacked and MD5 sums checked

** libs

cc -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -g -O2 -c loop-apply.c -o loop-apply.o

loop-apply.c: In function ‘loop_apply’:

loop-apply.c:15: error: ‘for’ loop initial declaration used outside C99 mode

make: *** [loop-apply.o] Error 1

ERROR: compilation failed for package ‘plyr’

* removing ‘/usr/local/Cellar/r/2.15.2/R.framework/Versions/2.15/Resources/library/plyr’

Disscussion Here

Solution

Edit /usr/local/Cellar/r/2.15.2/R.framework/Resources/etc/makeconf, add -std=c99 to CFLAGS and CPPFLAGS


CFLAGS = -g -O2 -std=c99 $(LTO)

CPPFLAGS = -I/usr/local/include -std=c99

install plyr again


> install.packages("plyr", repos = "http://cran.r-project.org")

trying URL 'http://cran.r-project.org/src/contrib/plyr_1.8.tar.gz'

Content type 'application/x-gzip' length 384462 bytes (375 Kb)

opened URL

==================================================

downloaded 375 Kb

 

* installing *source* package ‘plyr’ ...

** package ‘plyr’ successfully unpacked and MD5 sums checked

** libs

cc -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG -I/usr/local/include -std=c99 -fPIC -g -O2 -std=c99 -c loop-apply.c -o loop-apply.o

cc -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG -I/usr/local/include -std=c99 -fPIC -g -O2 -std=c99 -c split-numeric.c -o split-numeric.o

cc -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o plyr.so loop-apply.o split-numeric.o -F/usr/local/Cellar/r/2.15.2/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation

installing to /usr/local/Cellar/r/2.15.2/R.framework/Versions/2.15/Resources/library/plyr/libs

** R

** data

** moving datasets to lazyload DB

** inst

** preparing package for lazy loading

** help

*** installing help indices

** building package indices

** testing if installed package can be loaded

 

* DONE (plyr)

 

The downloaded source packages are in

‘/private/var/folders/6w/922n8ygj37n_mlxd__m9vmlr0000gn/T/RtmpEoj6Hj/downloaded_packages’

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment