Recently, I needed to install R 3.2 in order to receive a package from Bioconductor, but after installation I received the following error:
[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
Of course, brew was configured to use gcc 5, so I told brew to use version 4.9
brew switch gcc 4.9
which launched R, but then R will fail in the middle of installing the package (especially when I launched biocLite('DESeq2') .
Since then I have tried several things, including trying to install gcc 4.8 (but I cannot get R to use it, even through ~/.R/Makevars ). Even if 4.9 is not installed, R insists on calling the path shown above.
The Windows R version seems to say that 4.9 does not work with 3.2:
R-devel temporarily used a new 4.9.2 gcc toolchain compiled by Duncan Murdoch using build scripts written by a contractor. However, there was too much incompatibility with the existing code, and this toolchain will not be used for R 3.2.0. See Notes for details on creating and testing a new toolchain.
Any help would be greatly appreciated!
Edit : I tried installing from the source, as suggested by @lmw., But it fails:
[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
Edit 2 : Just for fun, I tried installing r without the --build-from-source option, and it worked. See My solution below. (I think that creating from the source may have fixed the problem with updating gcc 5 , as a result of which everything works. I'm not to try (things finally work again ... why screw with it?), But I wonder can I remove the variables set in ~/.R/Makevars (again, see solution below).