6

I'm trying to install the slam package, but it seems to fail on my system. I'm running ubuntu 12.04. I thought it was a missing library or something so I installed a few that match liblas, but no dice.

* installing *source* package ‘slam’ ...
** package ‘slam’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c grouped.c -o grouped.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c sparse.c -o sparse.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c util.c -o util.o
gcc -std=gnu99 -shared -o slam.so grouped.o sparse.o util.o -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lblas
collect2: ld returned 1 exit status
make: *** [slam.so] Error 1
ERROR: compilation failed for package ‘slam’
* removing ‘/home/brandon/.R/i686-pc-linux-gnu-library/2.15/slam’

I've tried:

sudo apt-get install liblas1 liblas-bin liblas-dev
Brandon Bertelsen
  • 43,807
  • 34
  • 160
  • 255

2 Answers2

4

You may have something fishy going on with your system. Try to follow /usr/lib/libblas.* which on my Ubuntu 12.04 server, with the OpenBLAS package installed, yields:

edd@max:~$ ls -log /usr/lib/libblas.* /etc/alternatives/libblas*                                                                                                                                                                 
lrwxrwxrwx 1 36 Jun 15 09:41 /etc/alternatives/libblas.a -> /usr/lib/openblas-base/libopenblas.a
lrwxrwxrwx 1 37 Jun 15 09:41 /etc/alternatives/libblas.so -> /usr/lib/openblas-base/libopenblas.so
lrwxrwxrwx 1 39 Jun 15 09:41 /etc/alternatives/libblas.so.3gf -> /usr/lib/openblas-base/libopenblas.so.0
lrwxrwxrwx 1 27 May  9  2012 /usr/lib/libblas.a -> /etc/alternatives/libblas.a
lrwxrwxrwx 1 28 May  9  2012 /usr/lib/libblas.so -> /etc/alternatives/libblas.so
lrwxrwxrwx 1 32 May  9  2012 /usr/lib/libblas.so.3gf -> /etc/alternatives/libblas.so.3gf
edd@max:~$ 

You should have something similar, albeit with the base blas you have installed.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • 1
    libBlas not liblas. Thanks for that! I installed libblas-dev and it worked! – Brandon Bertelsen Nov 23 '12 at 19:43
  • By the way, if you install `r-base-dev` this is automagically taken care of. Which is why we created `r-base-dev` in the first place :) – Dirk Eddelbuettel Nov 23 '12 at 19:47
  • I confused -lblas as liblas rather than libblas as it should have been. You pointed out, correctly, that it was libblas (not the other one). – Brandon Bertelsen Nov 23 '12 at 20:16
  • Understood. And `r-base-dev`, which you really should have had installed, has a depends on that package (well, one of the different blas-dev packages) hence preventing the manual search. Do install `r-base-dev` and see if it pulls anything else in for you. – Dirk Eddelbuettel Nov 23 '12 at 20:20
  • Yes, it did. I guess I was missing a bunch of libs! Thanks – Brandon Bertelsen Nov 23 '12 at 22:05
  • On Debian `r-base-dev` depends on `libblas-dev | libatlas-base-dev`, so it might as well happen, that it is not installed. – Jaleks Jul 07 '23 at 14:30
1

If you already have libblas-dev installed (here with the 'openblas' version), but the system cannot find the libs for some reason (although you already played around with LD_LIBRARY_PATH, adjusting it to something you found in ls -log /usr/lib/libblas.* /etc/alternatives/libblas*), the following workaround should do it:

  • manually download the package you see in the output
  • unpack the archive
  • step into the new directory slam
  • type R CMD INSTALL . to see the commands which get executed
  • go into directory src
  • copy and execute the commands manually, which you have seen before, except of the last one (where the -lblas parameter is in)
  • copy the command, but change -lblas to -lopenblas, and execute
  • this last command should now also succeed
  • go back to directory slam with cd ..
  • execute again R CMD INSTALL .
  • because everything is already compiled, this step does not need get repeated, only the rest of the installation will run (and succeed, if the command line with now -lopenblas succeeded)
Jaleks
  • 561
  • 5
  • 19