本文介绍了软件包安装错误:编译失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将R更新为3.1.0.我试图将我的软件包移至R.Framework(我正在运行OSX Mavericks)内部的3.1上,并以某种方式使它一团糟,因此在干净安装之前完全卸载了所有内容.

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.

重新安装软件包时,直到遇到forecast软件包,我都没有问题,这会产生以下错误:

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)

在重新安装之前,我实际上已经安装了R 3.1.0,并且天气预报和hts都可以一起工作,所以我怀疑问题出在我做过的事情,而不是兼容性问题.

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.

我运行以下命令来查看是否可以发现有关安装失败的更多详细信息:install.packages("forecast", type = "source", verbose = T, quiet = F)

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.

推荐答案

这就是我所做的()

  1. 从brew安装gfortran(如果没有brew,请使用Google.安装非常简单):

  1. 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/

将此行添加到~/.R/Makevars文件:

FLIBS=-L/usr/local/Cellar/gfortran/4.8.2/gfortran

我做了第二个选择.

现在再次运行install.packages("forecast", type = "source"),它应该可以工作.

Now run install.packages("forecast", type = "source") again and it should work.

这篇关于软件包安装错误:编译失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 15:36