[R] 'nlme' package not compiling

David Winsemius dwinsemius at comcast.net
Mon Apr 18 19:44:34 CEST 2016

> On Apr 18, 2016, at 12:48 AM, Angelo Varlotta <angelovarlotta at gmail.com> wrote:
> Hi,
> I'm trying to install from source code the 'nlme' package in 
> RStudio. When I try, I get the following error message:
> 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: *** [nlme.so] Error 1
> ERROR: compilation failed for package ‘nlme’
> * removing 
> ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/nlme’
> * restoring previous 
> ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/nlme’
> Warning in install.packages :
>   installation of package ‘nlme’ had non-zero exit status
> I'm using gfortran 4.8 from Macports and running OS X 10.11.4 
> with RStudio Version 0.99.893. I've tried to use the FLIBS 
> command in R:
> FLIBS="-L/opt/local/lib/gcc48/gcc/x86_64-apple-darwin15/4.8.5/"
> so that it knows where the Fortran libraries are at and compile 
> again, but it still searchesregardless for the directory:
> /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2.

This is the fortran against which the Mac R is compiled, provided as a disk image:


If you had been reading the R-SIG-Mac forum (or searching the archives you should have seen repeated warnings against Macports versions.)

The proper site for Mac questions regarding package compilation.

I'm was using Version 0.99.491 but updated to the same version as you have. The install packages dialog doesn't offer compiling from source as an options so the first test was to see if the binary could be install easily on version 3.3.0 of R.... it did.

I then tried compiling from source and do get the same error as did you. I'm  not a very capable Unix programmer and am unable to tell why this is happening. Perhaps something RStudio is doing? So I tried in the R.app gui with : 

install.packages("~/Downloads/nlme_3.1-127.tar.gz", repo=NULL, type="source")

#==== result=======
* installing *source* package ‘nlme’ ...
** package ‘nlme’ successfully unpacked and MD5 sums checked
** libs
gfortran-4.8   -fPIC  -g -O2  -c chol.f -o chol.o
make: gfortran-4.8: No such file or directory
make: *** [chol.o] Error 1
ERROR: compilation failed for package ‘nlme’
Warning message:
In install.packages("~/Downloads/nlme_3.1-127.tar.gz", repo = NULL,  :
  installation of package ‘/Users/davidwinsemius/Downloads/nlme_3.1-127.tar.gz’ had non-zero exit status
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/nlme’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/nlme’

Also tried from Terminal.app session with similar error report.

> which of course doesn't exist. Any suggestions?

A) Install from binary. That's certainly seems easiest.

Or B)
-- install gfortran 4.8 in the directory that your installation of R expects it to be found. 


Or at the Unix command line:

curl -s http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2 | sudo tar fxj - -C /

(As was suggested by Simon Urbanek two years ago and  was reported successful by Jason Eyerly on R-SIG-Mac.)

But in any case this thread belongs on R-SIG-MAC so copying there, and if any response is needed then when responding you should remove r-help from future replies.


David Winsemius

> Cheers,
> Angelo
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

More information about the R-help mailing list