7

由于某些原因,我无法安装 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 上。

4

2 回答 2

7

许多 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

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

如果你没有这两个-dev包,你可以安装一个或两个:

apt-get install libblas-dev liblapack-dev
于 2019-09-02T23:00:40.947 回答
4

@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:~$
于 2019-09-03T01:50:09.730 回答