2

我试图在 R 中安装 stringr 包但失败了。

> install.packages("stringr")
Installing package into ‘.../R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
also installing the dependency ‘stringi’

trying URL 'http://cran.stat.upd.edu.ph/src/contrib/stringi_0.4-1.tar.gz'
Content type 'application/octet-stream' length 3461563 bytes (3.3 Mb)
opened URL
==================================================
 downloaded 3.3 Mb

trying URL 'http://cran.stat.upd.edu.ph/src/contrib/stringr_1.0.0.tar.gz'
Content type 'application/octet-stream' length 34880 bytes (34 Kb)
opened URL
==================================================
downloaded 34 Kb

* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for R_HOME... /usr/lib/R
checking for R... /usr/lib/R/bin/R
checking for gcc... gcc -std=gnu99
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 gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking for cat... /bin/cat
checking for pkg-config... /usr/bin/pkg-config
checking with pkg-config for ICU4C installed... 52.1
checking for ICU4C >= 50... yes
checking for proper CPPFLAGS, LDFLAGS, and LIBS... done
checking whether we may build a simple ICU-dependent project... no
*** We will build ICU4C from sources
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/tmp/RtmpsVXxB7/R.INSTALL4e0d5b4186bb/stringi':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/home/xtenit/R/x86_64-pc-linux-gnu-library/3.0/stringi’
* restoring previous ‘/home/xtenit/R/x86_64-pc-linux-gnu-library    /3.0/stringi’
Warning in install.packages :
  installation of package ‘stringi’ had non-zero exit status
* installing *source* package ‘stringr’ ...
** package ‘stringr’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  object 'vI' not found
ERROR: lazy loading failed for package ‘stringr’
* removing ‘.../R/x86_64-pc-linux-gnu-library/3.0/stringr’
* restoring previous ‘.../R/x86_64-pc-linux-gnu-library    /3.0/stringr’
Warning in install.packages :
  installation of package ‘stringr’ had non-zero exit status

The downloaded source packages are in
‘/tmp/RtmpV2oP5k/downloaded_packages’

我试图检查这一点,但我不知道需要做什么如何从存档安装 stringi 库并安装本地 icu52l.zip

我刚刚运行了这段代码,但无济于事。

sudo apt-get install libicu-dev
4

1 回答 1

0

答案发给@hbrmstr。

未安装 C++ 编译器可能是引发错误的原因:

配置:错误:C++ 预处理器“/lib/cpp”未通过完整性检查

尝试sudo apt-get install g++并重新运行安装。

于 2018-09-22T11:29:32.543 回答