我最近需要安装 R 3.2 才能从 Bioconductor 获得一个包,但安装后,我收到以下错误:
[16:16:11 20] $ r
dyld: Library not loaded: /usr/local/lib/gcc/4.9/libgfortran.3.dylib
Referenced from: /usr/local/Cellar/r/3.2.0/R.framework/Versions/3.2/Resources/lib/libR.dylib
Reason: image not found
Trace/BPT trap: 5
果然,brew设置为使用gcc 5,所以我告诉brew使用4.9版本
brew switch gcc 4.9
这让 R 运行,但随后 R 会在包安装过程中失败(特别是当我运行biocLite('DESeq2')
.
从那以后,我尝试了很多事情,包括尝试安装 gcc 4.8(但我似乎无法让 R 使用它,即使是通过~/.R/Makevars
)。即使没有安装 4.9,R 也坚持调用如上所示的路径。
R 的 Windows 版本似乎说 4.9 不适用于 3.2:
R-devel 暂时使用了一个基于 4.9.2 gcc 的新工具链,由 Duncan Murdoch 使用承包商编写的构建脚本组装而成。但是,与现有代码有太多不兼容的地方,这个工具链不会用于 R 3.2.0。有关构建和测试新工具链的详细信息,请参阅注释。
任何帮助将不胜感激!
编辑:我尝试按照@lmw. 的建议从源代码安装,但它失败了:
[11:27:55 2] $ brew install r --build-from-source
==> Installing r from homebrew/homebrew-science
==> Installing r dependency: gcc
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-5.1.0/gcc-5.1.0.tar.bz2
######################################################################## 100.0%
curl: (28) Resolving timed out after 5542 milliseconds
Trying a mirror...
==> Downloading https://ftp.gnu.org/gnu/gcc/gcc-5.1.0/gcc-5.1.0.tar.bz2
######################################################################## 100.0%
==> Patching
patching file gcc/jit/Make-lang.in
==> ../configure --build=x86_64-apple-darwin14.3.0 --prefix=/usr/local/Cellar/gcc/5.1.0 --libdir=/usr/local/Cellar/gc
==> make bootstrap
==> make install
==> Caveats
GCC has been built with multilib support. Notably, OpenMP may not work:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
If you need OpenMP support you may want to
brew reinstall gcc --without-multilib
==> Summary
/usr/local/Cellar/gcc/5.1.0: 1351 files, 248M, built in 32.5 minutes
==> Installing r
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading http://cran.rstudio.com/src/base/R-3/R-3.2.0.tar.gz
######################################################################## 100.0%
==> Patching
patching file src/modules/lapack/vecLibg95c.c
==> ./configure --prefix=/usr/local/Cellar/r/3.2.0_1 --with-libintl-prefix=/usr/local/opt/gettext --enable-memory-pro
==> make
** installing vignettes
** testing if installed package can be loaded
* DONE (survival)
make[1]: *** [recommended-packages] Error 2
make: *** [stamp-recommended] Error 2
READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
https://github.com/homebrew/homebrew-science/issues
编辑 2:只是为了好玩,我尝试在r
没有该--build-from-source
选项的情况下进行安装,并且成功了。请参阅下面的解决方案。(我认为从源代码构建可能已经解决了gcc 5
升级的问题,这让事情变得正常。我不打算尝试它(事情终于又开始工作了......为什么要搞砸它?),但我想知道我是否可以删除我设置的变量~/.R/Makevars
(再次参见下面的解决方案)。