R-找不到-llapack和找不到-lblas

时间:2019-09-02 21:05:01

标签: r devtools openair

由于某些原因,我无法安装openair:

sudo su - -c "R -e \"devtools::install_github('davidcarslaw/openair')\""

结果:

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘openair’ ...
** using staged installation
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-V0XiTa/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c cluster.cpp -o cluster.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-V0XiTa/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-V0XiTa/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c rolling.cpp -o rolling.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o openair.so cluster.o init.o rolling.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:6: openair.so] Error 1
ERROR: compilation failed for package ‘openair’
* removing ‘/usr/local/lib/R/site-library/openair’
Error: Failed to install 'openair' from GitHub:
  (converted from warning) installation of package ‘/tmp/Rtmp36VYYZ/file18ef44881cd2/openair_2.6-5.tar.gz’ had non-zero exit status
Execution halted

我想念什么?

我正在使用Ubuntu 19.04。

2 个答案:

答案 0 :(得分:2)

许多R软件包需要特定的基础DLL(共享对象)进行编译,并且它们的软件包名称通常带有后缀-dev。在我的16.04 Ubuntu系统上,我看到:

$ apt list --installed | egrep 'lapack|blas'

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libblas-common/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]
libblas-dev/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]
libblas3/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]
liblapack-dev/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]
liblapack3/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]

(我也经常作弊,看看:

$ ll /var/lib/dpkg/info/*lapack*.list
-rw-r--r-- 1 root root 318 Apr 27  2017 /var/lib/dpkg/info/liblapack3.list
-rw-r--r-- 1 root root 288 Apr 27  2017 /var/lib/dpkg/info/liblapack-dev.list

尽管查看方式不快速或不灵活,但它可以让我快速查看文件列表(这些文件)或安装前/安装后脚本(如果存在)。只是一个hack。)

如果您没有两个-dev软件包,则可以使用以下任一方法或全部安装:

apt-get install libblas-dev liblapack-dev

答案 1 :(得分:2)

@ r2evans在一般情况下给出了正确的答案。

对于Debian和Ubuntu上的R,有一些捷径值得了解:捷径已经存在并将近20年了,您需要安装r-base-dev软件包,因为它将带来一个数量要求。

例如这些lapack和blas -dev库。

edd@rob:~$ apt-cache show r-base-dev                                     
Package: r-base-dev                                                                                                                                                                                  
Architecture: all                                                                                                                       
Version: 3.6.1-3disco                                                
Priority: optional                                                                                                                                                                                                 
Section: gnu-r                                                           
Source: r-base                                                                                                                                                                                       
Maintainer: Dirk Eddelbuettel <edd@debian.org>                                                                                          
Installed-Size: 15                                             
Depends: r-base-core (>= 3.6.1-3disco), build-essential, gcc, g++, gfortran, libblas-dev | libatlas-base-dev, liblapack-dev | libatlas-base-dev, libncurses5-dev, libreadline-dev, libjpeg-dev, libpcre2-dev, libpc
re3-dev, libpng-dev, zlib1g-dev, libbz2-dev, liblzma-dev, libicu-dev, xauth, pkg-config
Suggests: texlive-base, texlive-latex-base, texlive-plain-generic, texlive-fonts-recommended, texlive-fonts-extra, texlive-extra-utils, texlive-latex-recommended, texlive-latex-extra, texinfo
Filename: disco-cran35/r-base-dev_3.6.1-3disco_all.deb                                                                                  
Size: 4488                                                            
MD5sum: 9eb92e1184dc4b959cc493ba3fdb4c22                         
SHA1: e7804d6bbd90eb8ed4e2d42340abbc45fd7192a3                         
SHA256: 18509fb6a684d011fe983384b92ba7b2b72717de7e6169007c43a4a875fcbc03
SHA512: 4ea302cddad643ede8ec9719f496b5e74569c39325b86ecebd39d9610e668ed6e0d8619e07341c91a196708f2172a9f594fb6a317e2eb386c928d5e9ed4111f5
Homepage: http://www.r-project.org/                                
Description-en: GNU R installation of auxiliary GNU R packages      
 R is a system for statistical computation and graphics.  It consists  
 of a language plus a run-time environment with graphics, a debugger, 
 access to certain system functions, and the ability to run programs  
 stored in script files.                                               
 .                                                                       
 The design of R has been heavily influenced by two existing languages:
 Becker, Chambers & Wilks' S and Sussman's Scheme.  Whereas the        
 resulting language is very similar in appearance to S, the underlying     
 implementation and semantics are derived from Scheme.              
 .   
 .                                                                
 The core of R is an interpreted computer language which allows            
 branching and looping as well as modular programming using functions. 
 Most of the user-visible functions in R are written in R.  It is
 possible for the user to interface to procedures written in the
 C, C++, or FORTRAN languages for efficiency, and many of R's core
 functions do so.  The R distribution contains functionality for a
 large number of statistical procedures and underlying applied math
 computations.  There is also a large set of functions which provide
 a flexible graphical environment for creating various kinds of data
 presentations.
 .
 Additionally, several thousand extension "packages" are available from
 CRAN, the Comprehensive R Archive Network, many also as Debian packages,
 named 'r-cran-<name>'.
 .
 This package ensures that other Debian packages needed for installation of
 some auxiliary R packages are installed.
Description-md5: 1a1267651faee382ef4781870ce94812
edd@rob:~$