[R] Trouble compiling R with self-compiled LAPACK/ATLAS under Linux

Adam D. I. Kramer adik-rhelp at ilovebacon.org
Thu Sep 11 01:01:31 CEST 2008


Hello,

 	I just had a lot of trouble compiling a version of R which uses a
recently-compiled version of ATLAS and LAPACK. ATLAS and LAPACK compiled
correctly and installed fine and passed all of their checks (and yes, I did
compile them all with -fPIC as is required for R). This was my initial
configure line:

./configure --with-x --enable-threads=posix
--with-blas="-L/usr/local/lib -lptf77blas -lptcblas -latlas -lpthread"
--with-lapack="-L/usr/local/lib -llapack -lptf77blas -lptcblas -latlas -lpthread"
--prefix=/usr/local

...this configure line was chosen by examining R-admin.pdf and ./configure --help.
It configured fine, no problem. The trouble was when I attempt to make the
package:

...a lot of stuff compiles correctly...

gcc -std=gnu99 -shared -L/usr/local/lib64 -o grDevices.so chull.o devNull.o devPicTeX.o devPS.o devQuartz.o init.o
../../../../library/grDevices/libs/grDevices.so is unchanged
make[5]: Leaving directory `/home/akramer/R-2.7.2/src/library/grDevices/src'
make[4]: Leaving directory `/home/akramer/R-2.7.2/src/library/grDevices/src'
Warning in solve.default(rgb) :
   unable to load shared library '/home/akramer/R-2.7.2/modules//lapack.so':
   /home/akramer/R-2.7.2/modules//lapack.so: undefined symbol: cblas_izamax
Error in solve.default(rgb) : lapack routines cannot be loaded
Error: unable to load R code in package 'grDevices'
Execution halted
make[3]: *** [all] Error 1
make[3]: Leaving directory `/home/akramer/R-2.7.2/src/library/grDevices'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/home/akramer/R-2.7.2/src/library'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/home/akramer/R-2.7.2/src'
make: *** [R] Error 1

...So, I looked into the troublesome library:

$ nm /home/akramer/R-2.7.2/modules//lapack.so | grep cblas_izamax
                  U cblas_izamax

...the function is not there. However, referring to my configure line,
the function is indeed in the libraries I passed to R:

[akramer at dev170 ~/R-2.7.2] nm /usr/local/lib/libptcblas.a | grep cblas_izamax
0000000000000000 T cblas_izamax

...so, it appears to me that there is a problem in R building lapack.so. So,
I looked back into my config.log file, and found this line:

configure:37951: checking for zgeev_
configure:38015: gcc -std=gnu99 -o conftest -O3 -mtune=opteron  -I/usr/local/include  -L/usr/local/lib64 conftest.c -L/usr/local/lib -lptf77blas -lptcblas -latlas -lpthread  -lgfortran -lm -ldl -lm  >&5

...which then failed. The key to the above line is that -llapack was *not included,*
even though zgeev_ is a lapack function!

Then, I added -llapack to my --with-blas line, and R compiled correctly,
tested fine, and runs nicely.

This information is provided because I feel like I have either done
something wrong, I am misunderstanding the process of building R, or there
is a bug in the configuration for people using --with-blas.

Cordially,
Adam



More information about the R-help mailing list