[Rd] LAPACK libraries improperly linked

Dirk Eddelbuettel edd at debian.org
Sun Nov 14 21:05:40 CET 2010


On 14 November 2010 at 10:05, Ron Burns wrote:
| I am not sure if this is an R development problem or not. I am starting 
| with completely clean OS and and installing the latest version of R 
| without trying to anything special but I am having trouble with the 
| LAPACK library linking when I try to build packages that require them. 
| I thought perhaps my problem may be if interest here.
| 
| I just dumped Vista off a laptop formatted the disk and installed Ubuntu 
| 10.10 (latest release) as the single operating system. I did all of the 
| updates and then installed emacs and ess. Next I installed R by 
| following the the usual instructions on the CRAN site. At this point all 
| is working I am now in the process of installing the packages that I 
| normally have installed. I am having a problem with the LAPACK libraries 
| when installing lme4, but the problem is not unique to lme4. It is 
| either a link to or missing LAPACK libs. The libs seem to be installed 
| and there are links to them, but perhaps they are the wrong links. I am 
| at a loss as what I am doing wrong since I have started with a 
| completely clean machine and am not trying to anything special.
| 
| -------HERE is the R startup:
|   <wow> (ron) R
| 
| R version 2.12.0 (2010-10-15)
| Copyright (C) 2010 The R Foundation for Statistical Computing
| ISBN 3-900051-07-0
| Platform: i686-pc-linux-gnu (32-bit)
| 
| -------HERE is the final output from trying to install lme4:
| * installing *source* package lme4 ...
| ** libs
| gcc -I/usr/share/R/include   -I"/usr/lib/R/library/Matrix/include" 
| -I"/usr/lib/R/library/stats/include"   -fpic  -std=gnu99 -O3 -pipe  -g 
| -c init.c -o init.o
| gcc -I/usr/share/R/include   -I"/usr/lib/R/library/Matrix/include" 
| -I"/usr/lib/R/library/stats/include"   -fpic  -std=gnu99 -O3 -pipe  -g 
| -c lmer.c -o lmer.o
| gcc -I/usr/share/R/include   -I"/usr/lib/R/library/Matrix/include" 
| -I"/usr/lib/R/library/stats/include"   -fpic  -std=gnu99 -O3 -pipe  -g 
| -c local_stubs.c -o local_stubs.o
| gcc -shared -o lme4.so init.o lmer.o local_stubs.o -llapack -lf77blas 
| -latlas -lgfortran -lm -L/usr/lib/R/lib -lR
| /usr/bin/ld: cannot find -lf77blas
| /usr/bin/ld: cannot find -latlas
| collect2: ld returned 1 exit status
| make: *** [lme4.so] Error 1
| ERROR: compilation failed for package lme4
| * removing /usr/local/lib/R/site-library/lme4
| 
| ---------The
| /usr/bin/ld: cannot find -lf77blas
| /usr/bin/ld: cannot find -latlas
| errors are common to any other packages that use these libraries so it 
| not an lme4 package problem.
| 
| ---------BUT
| [ 48 ] <wow> (ron) /usr/bin/R CMD config LAPACK_LIBS
| -llapack
| 
| ---------AND
| <wow> (ron) dpkg -l | grep lapack
| ii  liblapack-dev                        3.2.1-8 
| library of linear algebra routines 3 - static version
| ii  liblapack3gf                         3.2.1-8 
| library of linear algebra routines 3 - shared version
| [ 44 ] <wow> (ron)
| 
| --------I did see a message indicating "Also do 'ldd 
| /usr/lib/R/bin/exec/R' and make sure you do _not_ have a depends on 
| Rlapack.so.  ....":
| 
| [ 47 ] <wow> (ron) ldd /usr/lib/R/bin/exec/R
|      linux-gate.so.1 =>  (0x00533000)
|      libR.so => /usr/lib/libR.so (0x0073e000)
|      libc.so.6 => /lib/libc.so.6 (0x00110000)
|      libf77blas.so.3gf => /usr/lib/libf77blas.so.3gf (0x00ed4000)
|      libatlas.so.3gf => /usr/lib/libatlas.so.3gf (0x0026e000)
|      libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0x00cca000)
|      libm.so.6 => /lib/libm.so.6 (0x0065f000)
|      libreadline.so.6 => /lib/libreadline.so.6 (0x00534000)
|      libpcre.so.3 => /lib/libpcre.so.3 (0x00f5b000)
|      liblzma.so.2 => /usr/lib/liblzma.so.2 (0x00568000)
|      libz.so.1 => /lib/libz.so.1 (0x0058b000)
|      libdl.so.2 => /lib/libdl.so.2 (0x005a0000)
|      /lib/ld-linux.so.2 (0x00e67000)
|      libcblas.so.3gf => /usr/lib/libcblas.so.3gf (0x005a4000)
|      libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x005c4000)
|      libpthread.so.0 => /lib/libpthread.so.0 (0x005e0000)
|      libncurses.so.5 => /lib/libncurses.so.5 (0x005fa000)
| 
| [ 41 ] <wow> (ron) ls /usr/lib/libatlas*
| /usr/lib/libatlas.so.3gf@
| [ 42 ] <wow> (ron) ls /usr/lib/libf77blas*
| /usr/lib/libf77blas.so.3gf@
| 
| -------- so these are there and linked OK and there is no Rlapack.
| 
| I am at a loss as to where to go from here.

I think you were pretty close by looking at lapack-dev and blas-dev, but you
missed atlas-dev.  Simply do

    $ sudo apt-get install r-base-dev

to install the meta-package providing R-build dependencies and you should be
set. Substitute your favourite package management front-end for apt-get here.

A nice trick is to also check build-dependencies of existing packages. As you
struggled with lme4, you could compare against the recorded Build-Depends on
the r-cran-lme4 package I maintain:

    Build-Depends: debhelper (>= 7.0.0), cdbs, r-base-dev (>= 2.12.0), \
           r-cran-matrix (>= 0.999375-31), r-cran-lattice, r-cran-nlme

That's from the most recent package lme4-0.999375-37 which you may also find
built for Ubuntu thanks to the tireless work of Vincent and Michael who port
my Debian (core) packages for R to the CRAN repositories. See the README at

    http://cran.r-project.org/bin/linux/ubuntu/

If you need further assistance, feel free to come to r-sig-debian for Debian
and Ubuntu matters.

Hth, Dirk

| 
| Thank you all for your consideration.
|      Ron Burns
| 
| 
| 
| -- 
| R. R. Burns
| Physicist (Retired)
| Oceanside, CA
| 
| ______________________________________________
| R-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



More information about the R-devel mailing list