[R-SIG-Mac] building R with external Lapack

Baptiste Auguie baptiste.auguie at gmail.com
Sat Mar 5 06:24:37 CET 2016

Dear list,

I have a package using RcppArmadillo for linear algebra; at some point in
the calculation it solves a linear system. I understand the c++ Armadillo
library hands this operation over to Lapack  Unfortunately, somewhere in my
toolchain Armadillo has been configured to use R's internal subset
of Lapack, which triggers the following warning every time I call the R

warning: solve(): refinement and/or equilibration not done due to crippled

This doesn't sound very good, and is also a real nuisance in the terminal
as I'm calling the function hundreds of times in a loop. I've installed the
latest build from https://r.research.att.com, built and installed the
latest version of RcppArmadillo, but the problem persists.

I'm not sure if it's relevant to this question, but I've had some success
with the related issue of switching from R's internal BLAS to the vecLib

cd /Library/Frameworks/R.framework/Resources/lib
ln -sf

giving me a considerable boost in performance. I'm not sure if something
similar can be done for Lapack.

The next step I've taken was to try and build R myself, with explicit flags
telling R to use an external Lapack from Apple's Accelerate (vecLib?)
framework. I have not had any luck with that, every time some kind of error
appears, and I could not find a recent tutorial with step-by-step
instructions to build R on a Mac.

I've downloaded the R source, followed by

./configure SHELL='/bin/bash' r_arch=x86_64 CC="gcc -arch x86_64
-std=gnu99" CXX="g++ -arch x86_64" OBJC="gcc -arch x86_64" F77="gfortran
-arch x86_64" FC="gfortran -arch x86_64" --with-system-zlib
--with-blas='-framework vecLib' --with-lapack

with this summary at the end:

R is now configured for x86_64-apple-darwin15.3.0

  Source directory:          .
  Installation directory:    /Library/Frameworks

  C compiler:                gcc -arch x86_64 -std=gnu99
  Fortran 77 compiler:       gfortran -arch x86_64  -g -O2

  C++ compiler:              g++ -arch x86_64  -g -O2
  C++ 11 compiler:           g++ -arch x86_64  -std=c++11 -g -O2
  Fortran 90/95 compiler:    gfortran -arch x86_64 -g -O2
  Obj-C compiler:     gcc -arch x86_64 -g -O2 -fobjc-exceptions

  Interfaces supported:      X11, aqua, tcltk
  External libraries:        readline, zlib, bzlib, lzma, PCRE, curl
  Additional capabilities:   NLS, ICU
  Options enabled:           framework, shared BLAS, R profiling

  Capabilities skipped:      PNG, JPEG, TIFF, cairo
  Options not enabled:       memory profiling

  Recommended packages:      yes


gives me this error:

byte-compiling package 'grDevices'
Warning in solve.default(rgb) :
  unable to load shared object
  dlopen(/Users/baptiste/Downloads/R-rc/modules/x86_64/lapack.so, 6):
Symbol not found: __gfortran_compare_string

I've tried quite a few variations, but I'm shooting in the dark since I
don't understand the issue. If I've missed a standard tutorial, please let
me know.

Best regards,


PS: my sessionInfo() using CRAN's R-devel
R Under development (unstable) (2016-03-02 r70268)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.3 (El Capitan)
[1] en_NZ.UTF-8/en_NZ.UTF-8/en_NZ.UTF-8/C/en_NZ.UTF-8/en_NZ.UTF-8

gfortran -v
gfortran: warning: couldn’t understand kern.osversion ‘15.3.0
Using built-in specs.
Target: x86_64-apple-darwin13.0.0
Configured with: /Builds/gcc-4.8/gcc-4.8.2/configure CC=clang CXX=clang++
Thread model: posix
gcc version 4.8.2 (GCC)

	[[alternative HTML version deleted]]

More information about the R-SIG-Mac mailing list