2014-02-15 27 views
7

我想构建Rpng,回购说libpng需要可用。无法构建R包“PNG”Fedora 20

我运行一个Linux的Fedora 20的发行

看起来像我有它...

[[email protected] bin]# yum install libpng 
Loaded plugins: langpacks, refresh-packagekit 
Package 2:libpng-1.6.3-3.fc20.x86_64 already installed and latest version 
Nothing to do 

但是,当我尝试安装它:

> install.packages("png") 
Installing package into ‘/home/statquant/R/x86_64-redhat-linux-gnu-library/3.0’ 
(as ‘lib’ is unspecified) 
trying URL 'http://cran.rstudio.com/src/contrib/png_0.1-7.tar.gz' 
Content type 'application/x-gzip' length 24990 bytes (24 Kb) 
opened URL 
================================================== 
downloaded 24 Kb 

* installing *source* package ‘png’ ... 
** package ‘png’ successfully unpacked and MD5 sums checked 
** libs 
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include `libpng-config --cflags` -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c read.c -o read.o 
/bin/sh: libpng-config: command not found 
read.c:3:17: fatal error: png.h: No such file or directory 
#include <png.h> 
       ^
compilation terminated. 
make: *** [read.o] Error 1 
ERROR: compilation failed for package ‘png’ 
* removing ‘/home/statquant/R/x86_64-redhat-linux-gnu-library/3.0/png’ 

The downloaded source packages are in 
     ‘/tmp/RtmpG5MjG9/downloaded_packages’ 
Warning message: 
In install.packages("png") : 
    installation of package ‘png’ had non-zero exit status 
+4

很多时候包所需要的开发包。尝试'yum install libpng-devel',然后尝试重新安装。 – Dason

+0

你是唯一!它的工作原理 – statquant

+0

@Dason,随时将其作为答案。 –

回答

28

对于一些R封装你需要相应的开发库才能成功安装R包。你的情况,这应该做你需要什么

# Do the following in your terminal (not in an R session) 
yum install libpng-devel 

之后,你应该能够安装将R包

# Do the following in the R console (during an R session) 
install.packages("png")