无法安装' tm' 3.3.3中的R包

时间:2018-04-23 10:04:14

标签: r

您好我试图在Redhat 6上的R 3.3.3中安装tm软件包,但是它失败了Rpoppler依赖性和Rpoppler失败并出现以下错误。我提到了各种链接但没有解决这个问题。

Warning messages:
1: In install.packages("tm", dependencies = TRUE, repos = "http://cran.us.r-project.org/") :
  installation of package ‘Rpoppler’ had non-zero exit status
2: In install.packages("tm", dependencies = TRUE, repos = "http://cran.us.r-project.org/") :
  installation of package ‘tm’ had non-zero exit status
> install.packages("Rpoppler", dependencies = TRUE, repos = "http://cran.us.r-project.org/")
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/Rpoppler_0.1-0.tar.gz'
Content type 'application/x-gzip' length 38275 bytes (37 KB)
==================================================
downloaded 37 KB

* installing *source* package ‘Rpoppler’ ...
** package ‘Rpoppler’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/bin/pkg-config
checking whether pkg-config knows about poppler-glib >= 0.18.0... no
configure: error: cannot determine poppler-glib compile/link flags
ERROR: configuration failed for package ‘Rpoppler’
* removing ‘/usr/lib64/R/library/Rpoppler’

The downloaded source packages are in
        ‘/tmp/RtmpEljcC7/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("Rpoppler", dependencies = TRUE, repos = "http://cran.us.r-project.org/") :
  installation of package ‘Rpoppler’ had non-zero exit status

我在/ usr / lib64 / pkgconfig中修改了poppler的版本,但是能够绕过错误,但是我遇到了新的错误。不确定更改pkgconfig中的元数据是个好主意。

install.packages("Rpoppler",  repos = "http://cran.us.r-project.org/")
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/Rpoppler_0.1-0.tar.gz'
Content type 'application/x-gzip' length 38275 bytes (37 KB)
==================================================
downloaded 37 KB

* installing *source* package ‘Rpoppler’ ...
** package ‘Rpoppler’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/bin/pkg-config
checking whether pkg-config knows about poppler-glib >= 0.18.0... yes
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -m64 accepts -g... yes
checking whether we can use setErrorFunction... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/config.h
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include   -pthread -I/usr/include/poppler/glib -I/usr/include/poppler -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC   -c Rpoppler.c -o Rpoppler.o
Rpoppler.c: In function ‘Rpoppler_PDF_info’:
Rpoppler.c:108: warning: implicit declaration of function ‘poppler_document_get_title’
Rpoppler.c:108: warning: assignment makes pointer from integer without a cast
Rpoppler.c:113: warning: implicit declaration of function ‘poppler_document_get_subject’
Rpoppler.c:113: warning: assignment makes pointer from integer without a cast
Rpoppler.c:118: warning: implicit declaration of function ‘poppler_document_get_keywords’
Rpoppler.c:118: warning: assignment makes pointer from integer without a cast
Rpoppler.c:123: warning: implicit declaration of function ‘poppler_document_get_author’
Rpoppler.c:123: warning: assignment makes pointer from integer without a cast
Rpoppler.c:128: warning: implicit declaration of function ‘poppler_document_get_creator’
Rpoppler.c:128: warning: assignment makes pointer from integer without a cast
Rpoppler.c:133: warning: implicit declaration of function ‘poppler_document_get_producer’
Rpoppler.c:133: warning: assignment makes pointer from integer without a cast
Rpoppler.c:140: warning: implicit declaration of function ‘poppler_document_get_creation_date’
Rpoppler.c:145: warning: implicit declaration of function ‘poppler_document_get_modification_date’
Rpoppler.c:175: warning: implicit declaration of function ‘poppler_document_is_linearized’
Rpoppler.c:179: warning: implicit declaration of function ‘poppler_document_get_pdf_version_string’
Rpoppler.c:179: warning: assignment makes pointer from integer without a cast
Rpoppler.c:184: warning: implicit declaration of function ‘poppler_document_get_metadata’
Rpoppler.c:184: warning: assignment makes pointer from integer without a cast
Rpoppler.c:91: warning: unused variable ‘err’
Rpoppler.c: In function ‘Rpoppler_PDF_fonts’:
Rpoppler.c:207: warning: unused variable ‘i’
Rpoppler.c: In function ‘Rpoppler_PDF_text’:
Rpoppler.c:285: error: too few arguments to function ‘poppler_page_get_text’
make: *** [Rpoppler.o] Error 1
**ERROR: compilation failed for package ‘Rpoppler’
* removing ‘/usr/lib64/R/library/Rpoppler’**

The downloaded source packages are in
        ‘/tmp/Rtmp6HYusM/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("Rpoppler", repos = "http://cran.us.r-project.org/") :
  installation of package ‘Rpoppler’ had non-zero exit status

经过进一步调试,我发现Rpoppler_0.1-0.tar.gz中的配置文件是硬编码的,用于检查0.18.0版本。我确实将值更改为0.12.4,但也导致了相同的结果

3 个答案:

答案 0 :(得分:2)

错误消息告诉您缺少poppler-glib。您应该能够通过以下方式从存储库安装它:

sudo yum install poppler-glib-devel

编辑但是,似乎RHEL 6仅包含poppler-glib-develop版本0.12.4,而Rpoppler至少需要0.18.0版本。快速搜索没有带来任何后退。您可以编译自己的backport或升级操作系统。 RHEL 7应该足够了。

答案 1 :(得分:1)

经过所有研究,tm 0.7.3有一些编译问题。安装0.7.1就可以了。其中也安装了Rpoppler。

答案 2 :(得分:0)

对于在OSX上发现此问题的任何人,这是我发现的工作流程。根据{{​​3}},我们可以看到

安装Poppler

brew install poppler

获取配置

尝试运行此文件。
pkg-config --libs poppler-glib pkg-config --cflags poppler-glib 如果得到类似Package 'poppler-glib' requires 'glib-2.0 >= 2.41' but version of glib-2.0 is 2.36.0的信息,则可能需要更改PKG_CONFIG_PATH的顺序: echo $PKG_CONFIG_PATH

安装新的glib

brew install glib

获取有关已更新版本的安装位置的信息: brew info glib

找到glib在哪里:(例如)/usr/local/Cellar/glib/2.58.1 (435 files, 18.4MB),请确保该数字足够大(例如2.58)。然后添加lib/pkgconfig。我们可以自动化:

glib_path=`brew info glib | grep Cellar | awk '{print $1 }' | tail -n 1` glib_path="${glib_path}/lib/pkgconfig" PKG_CONFIG_PATH="${glib_path}":"${PKG_CONFIG_PATH}" pkg-config --libs poppler-glib 如果可行,请尝试R install.packages("Rpoppler")