Error Installing minqa in R/3.0.2 - r

I am installing lme4 using the README.md file on their github account and I fail during installing the dependencies. I tried to install them separately and still crash at installing the minqa package. I'm using R/3.0.2 on RHEL6. During the build the compiler argues about RScript not existing which as I check it is in the R/bin folder.
Here is the log to the R INSTALL:
$ R CMD INSTALL minqa_1.2.2.tar.gz
* installing to library ‘/gpfs/apps/x86_64-rhel6/R/3.0.2/R/library’
* installing *source* package ‘minqa’ ...
** package ‘minqa’ successfully unpacked and MD5 sums checked
** libs
gfortran -fpic -g -O2 -c altmov.f -o altmov.o
gfortran -fpic -g -O2 -c bigden.f -o bigden.o
gfortran -fpic -g -O2 -c biglag.f -o biglag.o
gfortran -fpic -g -O2 -c bobyqa.f -o bobyqa.o
gfortran -fpic -g -O2 -c bobyqb.f -o bobyqb.o
gfortran -fpic -g -O2 -c lagmax.f -o lagmax.o
g++ -I/gpfs/apps/x86_64-rhel6/R/3.0.2/R/include -DNDEBUG -I/usr/local/include -I"/gpfs/apps/x86_64-rhel6/R/3.0.2/R/library/Rcpp/include" -fpic -g -O2 -c minqa.cpp -o minqa.o
gfortran -fpic -g -O2 -c newuoa.f -o newuoa.o
gfortran -fpic -g -O2 -c newuob.f -o newuob.o
gfortran -fpic -g -O2 -c prelim.f -o prelim.o
gfortran -fpic -g -O2 -c rescue.f -o rescue.o
gfortran -fpic -g -O2 -c trsapp.f -o trsapp.o
gfortran -fpic -g -O2 -c trsbox.f -o trsbox.o
gfortran -fpic -g -O2 -c trstep.f -o trstep.o
gfortran -fpic -g -O2 -c uobyqa.f -o uobyqa.o
gfortran -fpic -g -O2 -c uobyqb.f -o uobyqb.o
gfortran -fpic -g -O2 -c update.f -o update.o
gfortran -fpic -g -O2 -c updatebobyqa.f -o updatebobyqa.o
Rscript execution error: No such file or directory
g++ -shared -L/usr/local/lib64 -o minqa.so altmov.o bigden.o biglag.o bobyqa.o bobyqb.o lagmax.o minqa.o newuoa.o newuob.o prelim.o rescue.o trsapp.o trsbox.o trstep.o uobyqa.o uobyqb.o update.o updatebobyqa.o -lgfortran -lm -L/gpfs/apps/x86_64-rhel6/R/3.0.2/R/lib -lR
Rscript execution error: No such file or directory
installing to /gpfs/apps/x86_64-rhel6/R/3.0.2/R/library/minqa/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/gpfs/apps/x86_64-rhel6/R/3.0.2/R/library/minqa/libs/minqa.so':
/gpfs/apps/x86_64-rhel6/R/3.0.2/R/library/minqa/libs/minqa.so: undefined symbol: _ZTIN4Rcpp7RObjectE
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/gpfs/apps/x86_64-rhel6/R/3.0.2/R/library/minqa’

A similar error also occurs when trying to upgrade lme4 from 1.0-5 to 1.0-6. The error message is something like:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/site-library/minqa/libs/minqa.so':
libRcpp.so: cannot open shared object file: No such file or directory
ERROR: lazy loading failed for package ‘lme4’
To resolve this install the packages in the order below:
install.packages('Rcpp')
install.packages('RcppEigen')
install.packages('minqa')
install.packages('lme4')
I guess it's related to RCpp; just upgrade the version from 0.10.6 to 0.11.0 and some ABI break change happens?
Credit from dmbates

/usr/share/R/share/make/shlib.mk:6: recipe for target 'minqa.so' failed make: *** [minqa.so] Error 1
I got the same error when installing minqa (needed for lme4). It was due to modify .First() in /etc/R/Rprofile.site
Desactive .First or use R --vanilla.

Related

Problem with installation of vegan package - cannot find -lgfortran

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

Unable to install a package on R

I'm getting an issue when I try to install Bioconductor for R. I've searched everywhere for solutions however nothing is really working for me. Please, any advice?
The downloaded binary packages are in
/var/folders/74/y92tqhzj0l98l6syjjl7vtcr0000gn/T//RtmpNYOkbZ/downloaded_packages
Old packages: 'nlme'
Update all/some/none? [a/s/n]:
a
Warning: unable to access index for repository https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6:
cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/PACKAGES'
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘nlme’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘nlme’
trying URL 'https://cran.rstudio.com/src/contrib/nlme_3.1-144.tar.gz'
Content type 'application/x-gzip' length 778660 bytes (760 KB)
==================================================
downloaded 760 KB
* installing *source* package ‘nlme’ ...
** package ‘nlme’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -fPIC -Wall -g -O2 -c chol.f -o chol.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c corStruct.c -o corStruct.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c gnls.c -o gnls.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c init.c -o init.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c matrix.c -o matrix.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c nlOptimizer.c -o nlOptimizer.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c nlme.c -o nlme.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c nlmefit.c -o nlmefit.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c pdMat.c -o pdMat.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c pythag.c -o pythag.o
gfortran -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-darwin15/6.1.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-darwin15/6.1.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/3.6/Resources/library/nlme’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/nlme’
The downloaded source packages are in
‘/private/var/folders/74/y92tqhzj0l98l6syjjl7vtcr0000gn/T/RtmpNYOkbZ/downloaded_packages’
Warning message:
In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘nlme’ had non-zero exit status
I've tried to reinstall R and it didn't work.
The code I am using to install bioconductor is:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.10")
I had the same problem. This happens since I updated to R4.0. I've seen that in Mac (and maybe Windows) can be related to missing Rtools. In Linux, I tried to install the package from other mirrors (this solved my problem in the past), but no success. Finally, I realized that the initial error is "make: gfortran: No such file or directory"
Therefore, I installed gcc & gcc-fortran and that solved it!
In Manjaro, Arch linux:
pacman -S gcc
pacman -S gcc-fortran
In Debian or Ubuntu should be:
sudo apt update
sudo apt install build-essential
sudo apt-get install manpages-dev
gcc --version
Check here for more information:
https://linuxize.com/post/how-to-install-gcc-compiler-on-debian-10/
https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/
https://linuxhostsupport.com/blog/how-to-install-gcc-on-ubuntu-18-04/
Because now the new version of Bioconductor is BiocManager, try to use this one: install.packages("BiocManager")
Apparently, it is trying to install package nlme as a dependency and fails doing that. Did you try installing that one manually before installing Bioconductor ? That could give us more info on the issue.
Just as a heads up for someone who encounters similar issue. I was presented with a choice of installing a binary or compiling from scratch. As I chose compilation option, it was failing to install nlme. However, installation of binary was successful and there was a minor version difference between the source and the binary.

Can't find gfortran 4.8 to build package

I'm trying to install the deldir package in R via install.packages("deldir",type = 'source') but am getting the following error message (this is OSX Mavericks):
* installing *source* package ‘deldir’ ...
** package ‘deldir’ successfully unpacked and MD5 sums checked
** libs
gfortran-4.8 -fPIC -g -O2 -c acchk.f -o acchk.o
make: gfortran-4.8: No such file or directory
make: *** [acchk.o] Error 1
ERROR: compilation failed for package ‘deldir’
gfortran 4.8 does seem to be available on my system, however:
> gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin13/4.8.2/lto-wrapper
Target: x86_64-apple-darwin13
Configured with: ../gcc-4.8.2/configure --prefix=/usr/local/gfortran --with-gmp=/Users/fx/devel/gcc/deps-static/x86_64 --enable-languages=c,c++,fortran,objc,obj-c++ --build=x86_64-apple-darwin13
Thread model: posix
gcc version 4.8.2 (GCC)
After symlinking gfortran-4.8 to gfortran I get a bit further but fail nonetheless:
* installing *source* package ‘deldir’ ...
** package ‘deldir’ successfully unpacked and MD5 sums checked
** libs
gfortran-4.8 -fPIC -g -O2 -c acchk.f -o acchk.o
gfortran-4.8 -fPIC -g -O2 -c addpt.f -o addpt.o
gfortran-4.8 -fPIC -g -O2 -c adjchk.f -o adjchk.o
gfortran-4.8 -fPIC -g -O2 -c binsrt.f -o binsrt.o
gfortran-4.8 -fPIC -g -O2 -c circen.f -o circen.o
gfortran-4.8 -fPIC -g -O2 -c cross.f -o cross.o
gfortran-4.8 -fPIC -g -O2 -c delet.f -o delet.o
gfortran-4.8 -fPIC -g -O2 -c delet1.f -o delet1.o
gfortran-4.8 -fPIC -g -O2 -c delout.f -o delout.o
gfortran-4.8 -fPIC -g -O2 -c delseg.f -o delseg.o
gfortran-4.8 -fPIC -g -O2 -c dirout.f -o dirout.o
gfortran-4.8 -fPIC -g -O2 -c dirseg.f -o dirseg.o
gfortran-4.8 -fPIC -g -O2 -c dldins.f -o dldins.o
gfortran-4.8 -fPIC -g -O2 -c initad.f -o initad.o
gfortran-4.8 -fPIC -g -O2 -c insrt.f -o insrt.o
gfortran-4.8 -fPIC -g -O2 -c insrt1.f -o insrt1.o
gfortran-4.8 -fPIC -g -O2 -c intri.f -o intri.o
gfortran-4.8 -fPIC -g -O2 -c locn.f -o locn.o
gfortran-4.8 -fPIC -g -O2 -c master.f -o master.o
gfortran-4.8 -fPIC -g -O2 -c mnnd.f -o mnnd.o
gfortran-4.8 -fPIC -g -O2 -c pred.f -o pred.o
gfortran-4.8 -fPIC -g -O2 -c qtest.f -o qtest.o
gfortran-4.8 -fPIC -g -O2 -c qtest1.f -o qtest1.o
gfortran-4.8 -fPIC -g -O2 -c stoke.f -o stoke.o
gfortran-4.8 -fPIC -g -O2 -c succ.f -o succ.o
gfortran-4.8 -fPIC -g -O2 -c swap.f -o swap.o
gfortran-4.8 -fPIC -g -O2 -c testeq.f -o testeq.o
gfortran-4.8 -fPIC -g -O2 -c triar.f -o triar.o
gfortran-4.8 -fPIC -g -O2 -c trifnd.f -o trifnd.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o deldir.so acchk.o addpt.o adjchk.o binsrt.o circen.o cross.o delet.o delet1.o delout .o delseg.o dirout.o dirseg.o dldins.o initad.o insrt.o insrt1.o intri.o locn.o master.o mnnd.o pred.o qtest.o qtest1.o stoke.o succ.o swap.o testeq.o triar.o trifnd.o -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: *** [deldir.so] Error 1
ERROR: compilation failed for package ‘deldir’
Note that /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.3 exists, /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 does not
sessionInfo():
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Sys.getenv():
> Sys.getenv()
__CF_USER_TEXT_ENCODING
"0x1F5:0:0"
__CHECKFIX1436934
"1"
Apple_PubSub_Socket_Render
"/tmp/launch-jCxLku/Render"
DISPLAY
":0"
DYLD_FALLBACK_LIBRARY_PATH
"/Users/<myusername>/lib:/usr/local/lib:/usr/lib::/Library/Frameworks/R.framework/Resources/lib"
EDITOR
"vi"
GIT_ASKPASS
"rpostback-askpass"
HOME
"/Users/<myusername>"
LANG
"en_US.UTF-8"
LC_CTYPE
"en_US.UTF-8"
LN_S
"ln -s"
LOGNAME
"<myusername>"
MAKE
"make"
PAGER
"/usr/bin/less"
PATH
"/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin"
R_BROWSER
"/usr/bin/open"
R_BZIPCMD
"/usr/bin/bzip2"
R_DOC_DIR
"/Library/Frameworks/R.framework/Resources/doc"
R_GZIPCMD
"/usr/bin/gzip"
R_HOME
"/Library/Frameworks/R.framework/Resources"
R_INCLUDE_DIR
"/Library/Frameworks/R.framework/Resources/include"
R_LIBS_SITE
""
R_LIBS_USER
"~/Library/R/3.1/library"
R_PAPERSIZE
"a4"
R_PDFVIEWER
"/usr/bin/open"
R_PLATFORM
"x86_64-apple-darwin13.1.0"
R_PRINTCMD
"lpr"
R_QPDF
"/Library/Frameworks/R.framework/Resources/bin/qpdf"
R_RD4PDF
"times,inconsolata,hyper"
R_SESSION_TMPDIR
"/var/folders/jf/ds4sdyys44xckz_7f9zhrvsh0000gn/T//RtmpXaPpYF"
R_SHARE_DIR
"/Library/Frameworks/R.framework/Resources/share"
R_SYSTEM_ABI
"osx,gcc,gxx,gfortran,?"
R_TEXI2DVICMD
"/usr/bin/texi2dvi"
R_UNZIPCMD
"/usr/bin/unzip"
R_ZIPCMD
"/usr/bin/zip"
RS_RPOSTBACK_PATH
"/Applications/RStudio.app/Contents/MacOS/rpostback"
RS_SHARED_SECRET
<removed>
RSTUDIO
"1"
RSTUDIO_PANDOC
"/Applications/RStudio.app/Contents/MacOS/pandoc"
RSTUDIO_SESSION_PORT
"10153"
RSTUDIO_USER_IDENTITY
"<myusername>"
SED
"/usr/bin/sed"
SHELL
"/bin/bash"
SSH_AUTH_SOCK
"/tmp/launch-Shnu2H/Listeners"
TAR
"/usr/bin/tar"
TMPDIR
"/var/folders/jf/ds4sdyys44xckz_7f9zhrvsh0000gn/T/"
USER
"<myusername>"
I was getting the same error when installing the igraph package in R on Manjaro Linux.
It was due to the absence of a Fortran compiler (gfortran I think). I found out that gfortran package is named as gcc-fortran in Manjaro repo and many other (GNU) Linux repos. So, I just installed gcc-fortran package and then restarted RStudio and igraph package installed without any issues.
I found a solution here: https://support.rstudio.com/hc/communities/public/questions/201688563-Problem-with-Mac-Yosemite-Beta-and-RStudio-not-finding-TeX-distribution
It turns out that Adam Maxwell noted that Yosemite beta has a significant bug in passing environment variables to subprocesses.
After installing gfortran as in OS X package installation depends on gfortran-4.8 .
This works: create an alias in your .bash_profile
alias fixrs="launchctl setenv PATH /usr/texbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"
Then close and open the terminal.
And execute the fixrs command in the terminal before launching RStudio.
Then I could build igraph successfully.
I was using a linux machine and RStudio server. I had a similar problem. I knew already that gfortran was on the machine thanks to the system administrator.
To solve, in the shell, I typed which gfortran, which gave me a path.
Then, following this SO posting, I entered the following in the shell to create a new Makevars file
# create a file called ~/.R/Makevars:
mkdir -p ~/.R
touch ~/.R/Makevars
Then, in that new file, I wrote the following
F77 = /usr/local/bin/gfortran #this was the path that I got from typing which gfortran in the shell
FC = $F77
FLIBS = -L/usr/local/bin/gfortran
From there, I was able to install the package that wasn't compiling properly (in my case vegan instead of igraph using install.packages("vegan")
I had your same problem (in OS X Yosemite), and (unfortunately) painstakingly recreated your symlink "partial solution". Finally, I was able to solve the issue by forgetting about linking or aliasing and just downgrading to gfortran-4.8.
I had installed the newer version with brew, so for me this entailed uninstalling
brew uninstall gcc
and then following the instructions here to install 4.8.2, i.e.
curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /
It still threw up some warnings but at least I got a successful installation of deldir, which I needed to run pgirmess.

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

R shiny Ubuntu 12.04 installation instructions fail when installing Rcpp needed by R shiny library in R 3.0.2

I am trying to install an R shiny server on my local Ubuntu 12.04 machine, and I followed the instructions here https://github.com/rstudio/shiny-server/wiki/Ubuntu-step-by-step-install-instructions:
When trying to do a:
install.packages('shiny', repos='http://cran.rstudio.com/')
It goes through the dependencies, but fails to install Rcpp. See error log below:
* installing *source* package 'Rcpp' ...
* package 'Rcpp' successfully unpacked and MD5 sums checked
* libs
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -O3 -pipe -g -c Date.cpp -o Date.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -O3 -pipe -g -c Module.cpp -o Module.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -O3 -pipe -g -c Rcpp_init.c -o Rcpp_init.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -O3 -pipe -g -c Timer.cpp -o Timer.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -O3 -pipe -g -c api.cpp -o api.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -O3 -pipe -g -c attributes.cpp -o attributes.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -O3 -pipe -g -c barrier.cpp -o barrier.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -O3 -pipe -g -c exceptions.cpp -o exceptions.o
g++ -shared -o Rcpp.so Date.o Module.o Rcpp_init.o Timer.o api.o attributes.o barrier.o exceptions.o -L/usr/lib/R/lib -lR
g++ -o libRcpp.so Date.o Module.o Rcpp_init.o Timer.o api.o attributes.o barrier.o exceptions.o -shared -L/usr/lib/R/lib -lR
ar qc libRcpp.a Date.o Module.o Rcpp_init.o Timer.o api.o attributes.o barrier.o exceptions.o
cp libRcpp.so ../inst/lib
cp libRcpp.a ../inst/lib
rm libRcpp.so libRcpp.a
installing to /usr/local/lib/R/site-library/Rcpp/libs
* R
* inst
* preparing package for lazy loading
Error : package 'codetools' was built before R 3.0.0: please re-install it
Error : unable to load R code in package 'Rcpp'
ERROR: lazy loading failed for package 'Rcpp'
* removing '/usr/local/lib/R/site-library/Rcpp'
* installing *source* package 'httpuv' ...
* package 'httpuv' successfully unpacked and MD5 sums checked
* libs
g++ -I/usr/share/R/include -DNDEBUG -I./libuv/include -I./http-parser -I./sha1 -I./base64 -I"/usr/lib/R/site-library/Rcpp/include" -fpic -O3 -pipe -g -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp:75:10: error: 'uint32_t' was not declared in this scope
RcppExports.cpp: In function 'SEXPREC* httpuv_run(SEXP)':
RcppExports.cpp:79:5: error: 'uint32_t' was not declared in this scope
RcppExports.cpp:79:14: error: expected ';' before 'timeoutMillis'
RcppExports.cpp:80:25: error: 'timeoutMillis' was not declared in this scope
RcppExports.cpp:80:38: error: 'run' cannot be used as a function
make: * [RcppExports.o] Error 1
ERROR: compilation failed for package 'httpuv'
* removing '/usr/local/lib/R/site-library/httpuv'
ERROR: dependency 'httpuv' is not available for package 'shiny'
* removing '/usr/local/lib/R/site-library/shiny'
EDITED:
Manually downloading and installing Rcpp gives me:
sudo R CMD INSTALL Rcpp_0.10.6.tar.gz
Error : package 'codetools' was built before R 3.0.0: please re-install it
So I manually downloaded and installed codetools and re-tried Rcpp:
sudo R CMD INSTALL codetools_0.2-8.tar.gz
sudo R CMD INSTALL Rcpp_0.10.6.tar.gz
Then followed the instructions again from the Shiny webpage from "Install R" and "Install shiny" and got a similar error but now with caTools, bitops and xtable, so I did the manual installation of each of them. The shiny was installed correctly.
Then followed the next steps in the instructions.
Any ideas why I got this 'was built before R 3.0.0' errors?
Ubuntu 12.04 is a pre-R 3.0.0 release. You have to decide whether you want its long-term support and stability "as is", or if you want newer software.
You can mix and match. Read the CRAN Ubuntu README, adjust your apt settings and enjoy updated r-cran-* packages. With those you can then install shiny and its dependencies.
Manually downloading and installing Rcpp gives me:
sudo R CMD INSTALL Rcpp_0.10.6.tar.gz
Error : package 'codetools' was built before R 3.0.0: please re-install it
So I manually downloaded and installed codetools and re-tried Rcpp:
sudo R CMD INSTALL codetools_0.2-8.tar.gz
sudo R CMD INSTALL Rcpp_0.10.6.tar.gz
Then followed the instructions again from the Shiny webpage from "Install R" and "Install shiny" and got a similar error but now with caTools, bitops and xtable, so I did the manual installation of each of them. The shiny was installed correctly.
Then followed the next steps in the instructions. All went well from there. Not sure why I was getting these was built before 3.0.0 errors.

Resources