简体   繁体   English

在R上安装xts软件包时出错

[英]Error while installing xts package on R

I got following errors from the xts package while trying to install the quantmod package: 在尝试安装quantmod包时,我从xts包中得到以下错误:

> install.packages("quantmod", repos="http://R-Forge.R-project.org", type="source")
also installing the dependencies ‘xts’, ‘TTR’

пробую URL 'http://R-Forge.R-project.org/src/contrib/xts_0.9.874.tar.gz'
Content type 'application/x-gzip' length 538182 bytes (525 KB)
==================================================
downloaded 525 KB

пробую URL 'http://R-Forge.R-project.org/src/contrib/TTR_0.22-0.1.tar.gz'
Content type 'application/x-gzip' length 276426 bytes (269 KB)
==================================================
downloaded 269 KB

пробую URL 'http://R-Forge.R-project.org/src/contrib/quantmod_0.4-3.tar.gz'
Content type 'application/x-gzip' length 123464 bytes (120 KB)
==================================================
downloaded 120 KB

* installing *source* package ‘xts’ ...
** libs
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c add_class.c -o add_class.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c any.c -o any.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c attr.c -o attr.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c binsearch.c -o binsearch.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c coredata.c -o coredata.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c diff.c -o diff.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c dimnames.c -o dimnames.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c endpoints.c -o endpoints.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c extract_col.c -o extract_col.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c init.c -o init.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c isOrdered.c -o isOrdered.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c isXts.c -o isXts.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c leadingNA.c -o leadingNA.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c merge.c -o merge.o
/usr/local/bin/gfortran   -fPIC  -g -O2  -c period.max.f -o period.max.o
/usr/local/bin/gfortran   -fPIC  -g -O2  -c period.min.f -o period.min.o
/usr/local/bin/gfortran   -fPIC  -g -O2  -c period.prod.f -o period.prod.o
/usr/local/bin/gfortran   -fPIC  -g -O2  -c period.sum.f -o period.sum.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c rbind.c -o rbind.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c rollfun.c -o rollfun.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c runSum.c -o runSum.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c startofyear.c -o startofyear.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c subset.c -o subset.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c subset.old.c -o subset.old.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c toperiod.c -o toperiod.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c totalcols.c -o totalcols.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c tryXts.c -o tryXts.o
clang -I/usr/local/Cellar/r/3.2.1/R.framework/Resources/include -DNDEBUG  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I"/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/zoo/include"   -fPIC  -g -O2  -c unique.time.c -o unique.time.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.2.1/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -o xts.so add_class.o any.o attr.o binsearch.o coredata.o diff.o dimnames.o endpoints.o extract_col.o init.o isOrdered.o isXts.o leadingNA.o merge.o period.max.o period.min.o period.prod.o period.sum.o rbind.o rollfun.o runSum.o startofyear.o subset.o subset.old.o toperiod.o totalcols.o tryXts.o unique.time.o -L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5/gcc/x86_64-apple-darwin14.3.0/5.1.0 -L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5 -lgfortran -lquadmath -lm -F/usr/local/Cellar/r/3.2.1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5/gcc/x86_64-apple-darwin14.3.0/5.1.0'
ld: warning: directory not found for option '-L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [xts.so] Error 1
ERROR: compilation failed for package ‘xts’
* removing ‘/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/xts’
ERROR: dependency ‘xts’ is not available for package ‘TTR’
* removing ‘/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/TTR’
ERROR: dependencies ‘xts’, ‘TTR’ are not available for package ‘quantmod’
* removing ‘/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/quantmod’

I've got gcc installed: 我已经安装了gcc:

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

And I've got gfortran installed: 我已经安装了gfortran:

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/5.2.0/libexec/gcc/x86_64-apple-darwin14.4.0/5.2.0/lto-wrapper
Target: x86_64-apple-darwin14.4.0
Configured with: ../configure --build=x86_64-apple-darwin14.4.0 --prefix=/usr/local/Cellar/gcc/5.2.0 --libdir=/usr/local/Cellar/gcc/5.2.0/lib/gcc/5 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-5 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --with-build-config=bootstrap-debug --disable-werror --with-pkgversion='Homebrew gcc 5.2.0' --with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin --disable-nls --enable-multilib
Thread model: posix
gcc version 5.2.0 (Homebrew gcc 5.2.0)

It's seems error occurs because of wrong path. 由于路径错误,似乎发生了错误。 There is no /usr/local/Cellar/gcc/5.1.0/ on my computer, only /usr/local/Cellar/gcc/5.2.0/ : 我的电脑上没有/usr/local/Cellar/gcc/5.1.0/ ,只有/usr/local/Cellar/gcc/5.2.0/

ld: warning: directory not found for option '-L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5/gcc/x86_64-apple-darwin14.3.0/5.1.0'
    ld: warning: directory not found for option '-L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5'
    ld: library not found for -lgfortran

sessionInfo(): sessionInfo():

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin14.3.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] ru_RU.UTF-8/ru_RU.UTF-8/ru_RU.UTF-8/C/ru_RU.UTF-8/ru_RU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_3.2.1

How could I fix it? 我该怎么办呢?

__ __

UPDATE: 更新:

I also tried solution from Errors installing RForge version of xts package for R on OSX 我还尝试了在OSX上安装Rorge版本的xts软件包的错误解决方案

  1. install fotran compiler from CRAN https://cran.r-project.org/bin/macosx/tools/ 从CRAN安装fotran编译器https://cran.r-project.org/bin/macosx/tools/
  2. run R CMD INSTALL xts_0.9.874.tar.gz . 运行R CMD INSTALL xts_0.9.874.tar.gz

No I've got: 不,我有:

...
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.2.1/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -o xts.so add_class.o any.o attr.o binsearch.o coredata.o diff.o dimnames.o endpoints.o extract_col.o init.o isOrdered.o isXts.o leadingNA.o merge.o period.max.o period.min.o period.prod.o period.sum.o rbind.o rollfun.o runSum.o startofyear.o subset.o subset.old.o toperiod.o totalcols.o tryXts.o unique.time.o -L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5/gcc/x86_64-apple-darwin14.3.0/5.1.0 -L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5 -lgfortran -lquadmath -lm -F/usr/local/Cellar/r/3.2.1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5/gcc/x86_64-apple-darwin14.3.0/5.1.0'
ld: warning: directory not found for option '-L/usr/local/Cellar/gcc/5.1.0/lib/gcc/5'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [xts.so] Error 1
ERROR: compilation failed for package ‘xts’
* removing ‘/usr/local/Cellar/r/3.2.1/R.framework/Versions/3.2/Resources/library/xts’

Finally found solution here: http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/ 终于找到了解决方案: http//thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/

Here it is: 这里是:

  1. Download gfortran-4.8.2-darwin13.tar.bz2 package from http://r.research.att.com/libs/ http://r.research.att.com/libs/下载gfortran-4.8.2-darwin13.tar.bz2软件包
  2. Extract the package in ~/ by running sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C / 通过运行sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /

After that I run 之后我跑了

R CMD INSTALL xts_0.9.874.tar.gz

and xts installed without errors (BTW, I dowloaded latest xts_0.9.874.tar.gz from https://cran.r-project.org/bin/macosx/tools/ ). 和xts安装没有错误(BTW,我从https://cran.r-project.org/bin/macosx/tools/下载了最新的xts_0.9.874.tar.gz)。
After that quantmod installed without errors. 之后安装了quantmod没有错误。 Using this command: 使用此命令:

install.packages("quantmod", repos="http://R-Forge.R-project.org", type="source")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM