From rrburns at cox.net  Sun Nov 14 19:05:24 2010
From: rrburns at cox.net (Ron Burns)
Date: Sun, 14 Nov 2010 10:05:24 -0800
Subject: [Rd] LAPACK libraries improperly linked
Message-ID: <4CE024E4.6080904@cox.net>

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.

Thank you all for your consideration.
     Ron Burns



-- 
R. R. Burns
Physicist (Retired)
Oceanside, CA



[Rd] LAPACK libraries improperly linked
Ron Burns