Problem with installation of vegan package - cannot find -lgfortran - r

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```

Related

Trouble installing nlme package

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

Cannot install data.table package on R 3.3.0

I tried to install the 'data.table' package with R 3.3.0, but it returns the given error as below. I installed all required packages, but it did not help me at all.
I googled for the same issue, but there's nothing.
Please share your experience to fix it, if you had the same problem. It is very strange to me now.
Thanks a lot,
Sean
> install.packages('data.table')
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3233k 100 3233k 0 0 2098k 0 0:00:01 0:00:01 --:--:-- 2205k
* installing *source* package ‘data.table’ ...
** package ‘data.table’ successfully unpacked and MD5 sums checked
** libs
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c assign.c -o assign.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c between.c -o between.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c bmerge.c -o bmerge.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c chmatch.c -o chmatch.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c dogroups.c -o dogroups.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c fastmean.c -o fastmean.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c fcast.c -o fcast.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c fmelt.c -o fmelt.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c forder.c -o forder.o
forder.c: In function ‘range_str’:
forder.c:296: error: expected end of line before ‘update’
make: *** [forder.o] Error 1
ERROR: compilation failed for package ‘data.table’
* removing ‘/usr/lib64/R/library/data.table’
The downloaded source packages are in
‘/tmp/RtmpCfSYUU/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("data.table") :
installation of package ‘data.table’ had non-zero exit status

digest package not installing in R - lgfortran not found

I am trying to install the digest package in R. However the installation is failing, apparently because the compiler does not recognize the -lgfortran flag. I have been unable to find any information on this. Any help is appreciated.
> install.packages('digest', repos='http://cran.us.r-project.org')
trying URL 'http://cran.us.r-project.org/src/contrib/digest_0.6.12.tar.gz'
Content type 'application/x-gzip' length 120337 bytes (117 KB)
==================================================
downloaded 117 KB
* installing *source* package ‘digest’ ...
** package ‘digest’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c aes.c -o aes.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c crc32.c -o crc32.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c digest.c -o digest.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c init.c -o init.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c md5.c -o md5.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c pmurhash.c -o pmurhash.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c raes.c -o raes.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c sha1.c -o sha1.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c sha2.c -o sha2.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c sha256.c -o sha256.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c xxhash.c -o xxhash.o
gcc -std=gnu99 -shared -L/home/alexander/anaconda3/lib/R/lib -L/home/alexander/anaconda3/lib -lgfortran -o digest.so aes.o crc32.o digest.o init.o md5.o pmurhash.o raes.o sha1.o sha2.o sha256.o xxhash.o -L/home/alexander/anaconda3/lib/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
/home/alexander/anaconda3/lib/R/share/make/shlib.mk:6: recipe for target 'digest.so' failed
make: *** [digest.so] Error 1
ERROR: compilation failed for package ‘digest’
* removing ‘/home/alexander/anaconda3/lib/R/library/digest’
* restoring previous ‘/home/alexander/anaconda3/lib/R/library/digest’
use homebrew to install gcc, gfortrain
Create folder /Users/YOURNAME/.R
Create text file /Users/YOURNAME/.R/Makevars
Put this into that file:
FC = usr/local/opt/gcc/bin/gfortran
F77 = /usr/local/opt/gcc/bin/gfortran
FLIBS = -L/usr/local/opt/gcc/lib

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