Skip to content
Advertisement

Error installing minqa in a non-standard location in Scientific Linux 6.6

I would ultimately like to install lme4 for R-3.2.5 on a system with Scientific Linux 6.6. I’m on a shared system (I’m compiling R packages for a distributed computing problem), so I need to install all the packages to a non-standard location (/a/lot/of/subdirectories/R-3.2.5 instead of the usual /usr/local/).

I’ve already encountered a lot of trouble installing the lme4 dependency, nloptr, which would not install using the usual install.packages command in R. I ended up downloading nlopt-2.4.2.tar.gz, installing it, and then linking to the installed libraries when invoking install.packages in R. I’m now having trouble installing the minqa library, which is another lme4 dependency. Here’s the error message when I attempt to install minqa the following command in R: install.packages("minqa")

trying URL 'http://cran.revolutionanalytics.com/src/contrib/minqa_1.2.4.tar.gz'
Content type 'application/octet-stream' length 53548 bytes (52 KB)
==================================================
downloaded 52 KB

* 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/var/lib/condor/execute/slot1/dir_20833/R-3.2.5/lib64/R/include -DNDEBUG  -I/usr/local/include -I"/var/lib/condor/execute/slot1/dir_20833/R-3.2.5/lib64/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
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 Fatal error: creating temporary file for '-e' failed -lgfortran -lm
g++: Fatal: No such file or directory
g++: error:: No such file or directory
g++: creating: No such file or directory
g++: temporary: No such file or directory
g++: file: No such file or directory
g++: for: No such file or directory
g++: '-e': No such file or directory
g++: failed: No such file or directory
make: *** [minqa.so] Error 1
ERROR: compilation failed for package ‘minqa’
* removing ‘/var/lib/condor/execute/slot1/dir_20833/R-3.2.5/lib64/R/library/minqa’

The downloaded source packages are in
        ‘/var/lib/condor/execute/slot1/dir_20833/RtmpruzdgN/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("minqa") :
  installation of package ‘minqa’ had non-zero exit status

It looks like g++ from install.packages is trying to reference the location /usr/local/lib64 instead of the actual location where I have R installed. Any ideas of how to resolve this? Is there an argument I can pass to install.packages (ex, with the configure.args option) to tell g++ what to do?

Advertisement

Answer

The solution was multipronged:

  1. Install nloptr from Github using install_github from the devtools package. The issue, I discovered, was that due to the workaround I had used to install nloptr, minqa was looking in the wrong place for the various nloptr libraries. The development version of nloptr on Github seems to use a different method for installing the nlopt libraries, which didn’t throw an error
  2. When invoking install.packages, use lib=.libPaths()[2] to set the right library path
  3. When encountering errors using install.packages within R, try using R CMD INSTALL from outside R instead

Combined, these various methods seem to have solved all my issues.

Advertisement