Trouble installing nlme package - r

I need to install nlme as it is a dependency for the MSstats package I need. I currently run on R version 4.2.0. When I try to install with Bioc manager I get the following:
> BiocManager::install("MSstats")
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details
replacement repositories:
CRAN: https://cran.rstudio.com/
Bioconductor version 3.15 (BiocManager 1.30.18), R 4.2.0 (2022-04-22)
Old packages: 'nlme'
Update all/some/none? [a/s/n]:
a
There is a binary version available but the source version is later:
binary source needs_compilation
nlme 3.1-157 3.1-158 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘nlme’
trying URL 'https://cran.rstudio.com/src/contrib/nlme_3.1-158.tar.gz'
Content type 'application/x-gzip' length 845427 bytes (825 KB)
==================================================
downloaded 825 KB
* installing *source* package ‘nlme’ ...
** package ‘nlme’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c chol.f -o chol.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c corStruct.c -o corStruct.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c gnls.c -o gnls.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c init.c -o init.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c matrix.c -o matrix.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c nlOptimizer.c -o nlOptimizer.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c nlme.c -o nlme.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c nlmefit.c -o nlmefit.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c pdMat.c -o pdMat.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c pythag.c -o pythag.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c rs.f -o rs.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o nlme.so chol.o corStruct.o gnls.o init.o matrix.o nlOptimizer.o nlme.o nlmefit.o pdMat.o pythag.o rs.o -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nlme.so] Error 1
ERROR: compilation failed for package ‘nlme’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/nlme’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/nlme’
The downloaded source packages are in
‘/private/var/folders/qx/5klvf6g112zb1vzzp5bt8n9r0000gn/T/Rtmpz9mEK5/downloaded_packages’
Warning messages:
1: package(s) not installed when version(s) same as current; use `force = TRUE` to re-install: 'MSstats'
2: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘nlme’ had non-zero exit status

Related

Problem with installation of vegan package - cannot find -lgfortran

I was installing another package called vcfR where it says vegan is source package and needs to be installed, then it showed errors when installing. So I decided to install vegan package first.
This is an online R studio, the package I need to analyse is too big to be done on my laptop. The online R studio is by my school server, which was in-built in a ssh server account.
below is the error message:
Installing package into ‘/home/joyzheng/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/vegan_2.5-7.tar.gz'
Content type 'application/x-gzip' length 2074611 bytes (2.0 MB)
==================================================
downloaded 2.0 MB
* installing *source* package ‘vegan’ ...
** package ‘vegan’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c data2hill.c -o data2hill.o
gfortran -fpic -g -O2 -c decorana.f -o decorana.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c getF.c -o getF.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c goffactor.c -o goffactor.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c init.c -o init.o
gfortran -fpic -g -O2 -c monoMDS.f -o monoMDS.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c nestedness.c -o nestedness.o
gfortran -fpic -g -O2 -c ordering.f -o ordering.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c pnpoly.c -o pnpoly.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c stepacross.c -o stepacross.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c vegdist.c -o vegdist.o
gcc -std=gnu99 -shared -L/opt/R/4.0.3/lib/R/lib -L/usr/local/lib -o vegan.so data2hill.o decorana.o getF.o goffactor.o init.o monoMDS.o nestedness.o ordering.o pnpoly.o stepacross.o vegdist.o -L/opt/R/4.0.3/lib/R/lib -lRlapack -L/opt/R/4.0.3/lib/R/lib -lRblas -lgfortran -lm -lquadmath -lgfortran -lm -lquadmath -L/opt/R/4.0.3/lib/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [vegan.so] Error 1
ERROR: compilation failed for package ‘vegan’
* removing ‘/home/joyzheng/R/x86_64-pc-linux-gnu-library/4.0/vegan’
Warning in install.packages :
installation of package ‘vegan’ had non-zero exit status```

Unable to install a package on R

I'm getting an issue when I try to install Bioconductor for R. I've searched everywhere for solutions however nothing is really working for me. Please, any advice?
The downloaded binary packages are in
/var/folders/74/y92tqhzj0l98l6syjjl7vtcr0000gn/T//RtmpNYOkbZ/downloaded_packages
Old packages: 'nlme'
Update all/some/none? [a/s/n]:
a
Warning: unable to access index for repository https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6:
cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/PACKAGES'
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘nlme’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘nlme’
trying URL 'https://cran.rstudio.com/src/contrib/nlme_3.1-144.tar.gz'
Content type 'application/x-gzip' length 778660 bytes (760 KB)
==================================================
downloaded 760 KB
* installing *source* package ‘nlme’ ...
** package ‘nlme’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -fPIC -Wall -g -O2 -c chol.f -o chol.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c corStruct.c -o corStruct.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c gnls.c -o gnls.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c init.c -o init.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c matrix.c -o matrix.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c nlOptimizer.c -o nlOptimizer.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c nlme.c -o nlme.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c nlmefit.c -o nlmefit.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c pdMat.c -o pdMat.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c pythag.c -o pythag.o
gfortran -fPIC -Wall -g -O2 -c rs.f -o rs.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o nlme.so chol.o corStruct.o gnls.o init.o matrix.o nlOptimizer.o nlme.o nlmefit.o pdMat.o pythag.o rs.o -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nlme.so] Error 1
ERROR: compilation failed for package ‘nlme’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/nlme’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/nlme’
The downloaded source packages are in
‘/private/var/folders/74/y92tqhzj0l98l6syjjl7vtcr0000gn/T/RtmpNYOkbZ/downloaded_packages’
Warning message:
In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘nlme’ had non-zero exit status
I've tried to reinstall R and it didn't work.
The code I am using to install bioconductor is:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.10")
I had the same problem. This happens since I updated to R4.0. I've seen that in Mac (and maybe Windows) can be related to missing Rtools. In Linux, I tried to install the package from other mirrors (this solved my problem in the past), but no success. Finally, I realized that the initial error is "make: gfortran: No such file or directory"
Therefore, I installed gcc & gcc-fortran and that solved it!
In Manjaro, Arch linux:
pacman -S gcc
pacman -S gcc-fortran
In Debian or Ubuntu should be:
sudo apt update
sudo apt install build-essential
sudo apt-get install manpages-dev
gcc --version
Check here for more information:
https://linuxize.com/post/how-to-install-gcc-compiler-on-debian-10/
https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/
https://linuxhostsupport.com/blog/how-to-install-gcc-on-ubuntu-18-04/
Because now the new version of Bioconductor is BiocManager, try to use this one: install.packages("BiocManager")
Apparently, it is trying to install package nlme as a dependency and fails doing that. Did you try installing that one manually before installing Bioconductor ? That could give us more info on the issue.
Just as a heads up for someone who encounters similar issue. I was presented with a choice of installing a binary or compiling from scratch. As I chose compilation option, it was failing to install nlme. However, installation of binary was successful and there was a minor version difference between the source and the binary.

Error when installing xml2 package on Mavericks

I'm trying to install devtools package in R, and as its dependency xml2 needs to be installed, but I'm getting the following error message.
> install.packages("xml2")
Installing package into ‘/Users/xlong3/Library/R/3.2/library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/xml2_0.1.2.tar.gz'
Content type 'application/x-gzip' length 74808 bytes (73 KB)
==================================================
downloaded 73 KB
* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/Users/xlong3/anaconda/include/libxml2
Using PKG_LIBS=-L/Users/xlong3/anaconda/lib -lxml2 -lz -liconv -lm
** libs
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c connection.cpp -o connection.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_doc.cpp -o xml2_doc.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_init.cpp -o xml2_init.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_namespace.cpp -o xml2_namespace.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_node.cpp -o xml2_node.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_url.cpp -o xml2_url.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_xpath.cpp -o xml2_xpath.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml_push.cpp -o xml_push.o
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -o xml2.so RcppExports.o connection.o xml2_doc.o xml2_init.o xml2_namespace.o xml2_node.o xml2_url.o xml2_xpath.o xml_push.o -L/Users/xlong3/anaconda/lib -lxml2 -lz -liconv -lm -F/usr/local/Cellar/r/3.2.2_1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
installing to /Users/xlong3/Library/R/3.2/library/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Users/xlong3/Library/R/3.2/library/xml2/libs/xml2.so':
dlopen(/Users/xlong3/Library/R/3.2/library/xml2/libs/xml2.so, 6): Library not loaded: libxml2.2.dylib
Referenced from: /Users/xlong3/Library/R/3.2/library/xml2/libs/xml2.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/xlong3/Library/R/3.2/library/xml2’
The downloaded source packages are in
‘/private/tmp/RtmpJc4WKq/downloaded_packages’
Warning message:
In install.packages("xml2") :
installation of package ‘xml2’ had non-zero exit status
>
> version
_
platform x86_64-apple-darwin13.4.0
arch x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
version.string R version 3.2.2 (2015-08-14)
nickname Fire Safety
The problem is that 'pkg-config' is looking specifically for 'libxml2.pc' and the file that you have installed is named, "libxml-2.0.pc". If you manually create a symbolic link between the existing file and the one pkg-config expects, it should resolve that error.
Something like this (done in the same directory as the file) should work
$ ln -s libxml-2.0.pc libxml2.pc
I'm not sure how should I proceed from the following situation:
pkg-config --libs --cflags libxml2
Package libxml2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml2' found
brew ls libxml2
/usr/local/Cellar/libxml2/2.9.2/bin/xml2-config
/usr/local/Cellar/libxml2/2.9.2/bin/xmlcatalog
/usr/local/Cellar/libxml2/2.9.2/bin/xmllint
/usr/local/Cellar/libxml2/2.9.2/include/libxml2/ (47 files)
/usr/local/Cellar/libxml2/2.9.2/lib/libxml2.2.dylib
/usr/local/Cellar/libxml2/2.9.2/lib/cmake/libxml2/libxml2-config.cmake
/usr/local/Cellar/libxml2/2.9.2/lib/pkgconfig/libxml-2.0.pc
/usr/local/Cellar/libxml2/2.9.2/lib/ (3 other files)
/usr/local/Cellar/libxml2/2.9.2/share/aclocal/libxml.m4
/usr/local/Cellar/libxml2/2.9.2/share/doc/ (153 files)
/usr/local/Cellar/libxml2/2.9.2/share/gtk-doc/ (55 files)
/usr/local/Cellar/libxml2/2.9.2/share/man/ (4 files)
Try to change your CRAN mirror

R-Studio & R Continuously Fail To Install Packages

I'm trying to learn how to use R in Finance, and I'm trying to install a package but keep getting the following errors. I've tried now with R 3.0.3 through every version to the current and still the same error. Somebody has confirmed for me that the install worked for them on 3.1.0 so I was hoping somebody here may have some input as to what to try next, as I'm really out of ideas and search queries at this point.
> install.packages("quantstrat", repos="http://R-Forge.R-project.org")
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://R-Forge.R-project.org/bin/macosx/contrib/3.1
package ‘quantstrat’ is available as a source package but not as a binary
Warning in install.packages :
package ‘quantstrat’ is not available (for R version 3.1.0)
Edit: Following the suggestion in the below comments I have tried entering:
install.packages("quantstrat", repos="http://R-Forge.R-project.org", type="source")
Which yields only this cryptic message after downloading a handful of files:
* installing *source* package ‘zoo’ ...
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c coredata.c -o coredata.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c init.c -o init.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c lag.c -o lag.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o zoo.so coredata.o init.o lag.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (zoo)
* installing *source* package ‘xts’ ...
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c add_class.c -o add_class.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c any.c -o any.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c attr.c -o attr.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c binsearch.c -o binsearch.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c coredata.c -o coredata.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c diff.c -o diff.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c dimnames.c -o dimnames.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c endpoints.c -o endpoints.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c extract_col.c -o extract_col.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c init.c -o init.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c isOrdered.c -o isOrdered.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c isXts.c -o isXts.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c leadingNA.c -o leadingNA.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c merge.c -o merge.o
gfortran-4.2 -arch x86_64 -fPIC -g -O2 -c period.max.f -o period.max.o
make: gfortran-4.2: No such file or directory
make: *** [period.max.o] Error 1
ERROR: compilation failed for package ‘xts’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/xts’
Warning in install.packages :
installation of package ‘xts’ had non-zero exit status
ERROR: dependency ‘xts’ is not available for package ‘PerformanceAnalytics’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/PerformanceAnalytics’
Warning in install.packages :
installation of package ‘PerformanceAnalytics’ had non-zero exit status
ERROR: dependency ‘xts’ is not available for package ‘TTR’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/TTR’
Warning in install.packages :
installation of package ‘TTR’ had non-zero exit status
ERROR: dependencies ‘Defaults’, ‘xts’, ‘TTR’ are not available for package ‘quantmod’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/quantmod’
Warning in install.packages :
installation of package ‘quantmod’ had non-zero exit status
ERROR: dependencies ‘quantmod’, ‘xts’ are not available for package ‘FinancialInstrument’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/FinancialInstrument’
Warning in install.packages :
installation of package ‘FinancialInstrument’ had non-zero exit status
ERROR: dependencies ‘xts’, ‘FinancialInstrument’, ‘PerformanceAnalytics’, ‘quantmod’ are not available for package ‘blotter’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/blotter’
Warning in install.packages :
installation of package ‘blotter’ had non-zero exit status
ERROR: dependencies ‘xts’, ‘TTR’, ‘blotter’, ‘FinancialInstrument’ are not available for package ‘quantstrat’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/quantstrat’
Warning in install.packages :
installation of package ‘quantstrat’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/q3/0qq1vm5538l657ffhr1hxj6m0000gn/T/RtmpQ5VCcC/downloaded_packages’
Thanks In Advance,
Jason E.
A combination of the above comments was the solution...
I installed xcode in it's entirety, followed my gfortran, and then proceded to type the repos in as was mentioned before:
install.packages("quantstrat", repos="http://R-Forge.R-project.org", type="source")

Package install error: compilation failed

I recently updated R to 3.1.0. I tried to move my packages over to 3.1 inside the R.Framework (I'm running OSX Mavericks) and somehow made a mess of it, so did a complete uninstall of everything before a clean install.
When reinstalling packages I had no issues until I hit the forecast package which yields the following error:
package ‘forecast’ is available as a source package but not as a binary
Warning in install.packages :
package ‘forecast’ is not available (for R version 3.1.0)
I actually had R 3.1.0 and both forecast and hts working together prior to the reinstall so I suspect the problem stems from something I've done, rather than a compatibility problem.
I ran the following to see if I could unearth some more details about the install fail: install.packages("forecast", type = "source", verbose = T, quiet = F)
The output of which is a little beyond me, but may be of help in diagnosis:
system (cmd0): /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL
trying URL 'http://cran.rstudio.com/src/contrib/forecast_5.3.tar.gz'
Content type 'application/x-gzip' length 150395 bytes (146 Kb)
opened URL
==================================================
downloaded 146 Kb
foundpkgs: forecast, /var/folders/0y/_13fkvws0tn5xh4m8wsymkdh0000gp/T//RtmpzTzSpG/downloaded_packages/forecast_5.3.tar.gz
files: /var/folders/0y/_13fkvws0tn5xh4m8wsymkdh0000gp/T//RtmpzTzSpG/downloaded_packages/forecast_5.3.tar.gz
* installing *source* package ‘forecast’ ...
** package ‘forecast’ successfully unpacked and MD5 sums checked
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c calcBATS.cpp -o calcBATS.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c calcTBATS.cpp -o calcTBATS.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c etsTargetFunction.cpp -o etsTargetFunction.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c etsTargetFunctionWrapper.cpp -o etsTargetFunctionWrapper.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c etscalc.c -o etscalc.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c etspolyroot.c -o etspolyroot.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c makeBATSMatrices.cpp -o makeBATSMatrices.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c makeTBATSMatrices.cpp -o makeTBATSMatrices.o
makeTBATSMatrices.cpp:11:6: warning: unused variable 'lengthSeasonal' [-Wunused-variable]
int lengthSeasonal = 0;
^
1 warning generated.
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c updateMatrices.cpp -o updateMatrices.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c updateTBATSMatrices.cpp -o updateTBATSMatrices.o
updateTBATSMatrices.cpp:38:10: warning: unused variable 'gammaVector' [-Wunused-variable]
double *gammaVector;
^
1 warning generated.
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o forecast.so calcBATS.o calcTBATS.o etsTargetFunction.o etsTargetFunctionWrapper.o etscalc.o etspolyroot.o makeBATSMatrices.o makeTBATSMatrices.o updateMatrices.o updateTBATSMatrices.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [forecast.so] Error 1
ERROR: compilation failed for package ‘forecast’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/forecast’
Warning in install.packages :
installation of package ‘forecast’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/0y/_13fkvws0tn5xh4m8wsymkdh0000gp/T/RtmpzTzSpG/downloaded_packages’
I'd really appreciate some help here. Much of the code I've been working on lately relies on functions in forecast.
Here is what I did (RcppArmadillo Compile Errors on OS X Mavericks)
Install gfortran from brew (if you don't have brew, Google it. Installation is straightforward):
brew install gfortran
If it's installed, upgrade to latest with:
brew upgrade gfortran
Then do one of the following:
ln -s /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.* /usr/local/lib/
or add this line to the ~/.R/Makevars file:
FLIBS=-L/usr/local/Cellar/gfortran/4.8.2/gfortran
I did the second option.
Now run install.packages("forecast", type = "source") again and it should work.
In my case, I was trying to install the latest version of {forecast} package with devtools::install_github("robjhyndman/forecast") and had the similar error.
Then, although I am not sure if what I did is right, following mchangun's answer I did as follows and the error was resolved:
brew upgrade gcc
Error: gcc 5.2.0 already installed
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
ls /usr/local/Cellar/gcc
4.9.2 4.9.2_1 5.2.0
Add the line FLIBS=-L/usr/local/Cellar/gcc/5.2.0 to the ~/.R/Makevars file
Run devtools::install_github("robjhyndman/forecast") and it worked.
Terminal
brew install gcc
gcc --version
ls /usr/local/Cellar/gcc
6.3.0_1
sudo vi /Library/Frameworks/R.framework/Resources/etc/Makeconf
Add the line FLIBS=-L/usr/local/Cellar/gcc/6.3.0_1
Rstudio:
install.packages("forecast"
Download gfortran from https://gcc.gnu.org/wiki/GFortranBinariesMacOS
sudo rm -r /usr/local/gfortran /usr/local/bin/gfortran
Then install gfortran
sudo vi /Library/Frameworks/R.framework/Resources/etc/Makeconf
change all gfortran-4.8 to gfortran
FC = gfortran
FCFLAGS = -Wall -g -O2 $(LTO)
FCLIBS =
F77 = gfortran
F77_VISIBILITY =
FFLAGS = -g -O2 $(LTO)
FLIBS = -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm
change above FLIBS to the below
FLIBS = -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
To install gfortran, use
brew cask install gfortran

Resources