2

I tried to install the stringr package in R but failed.

> 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’

I tried to check on this but i dont have any idea what needs to be done How to install stringi library from archive and install the local icu52l.zip

I just ran this code but to no avail.

sudo apt-get install libicu-dev
Community
  • 1
  • 1
dixi
  • 680
  • 1
  • 13
  • 27
  • 5
    Try `sudo apt-get install g++` and re-running the install. `configure: error: C++ preprocessor "/lib/cpp" fails sanity check` can mean the C++ compiler is not installed. – hrbrmstr Jun 03 '15 at 11:52
  • Please add `sessionInfo()` to your post. Also, do you have write permissions? Try `install.packages("stringr",lib="Path/to/my/local/Rpackages)` – zx8754 Jun 03 '15 at 11:54
  • As pointed out by @hrbrmstr, http://askubuntu.com/questions/509663/c-preprocessor-lib-cpp-fails-sanity-check (thanks to my web search engine) –  Jun 03 '15 at 16:48
  • @hrbrmstr: Thank you so much for your help! I was able to successfully install the package! Have a great day! :-D – dixi Jun 04 '15 at 08:28
  • @hrbrmstr: You should upgrade your comment to an answer such that this question can be marked as solved. Don't you think? – MERose Dec 14 '15 at 10:16

1 Answers1

0

Answer goes out to @hbrmstr.

Not installed C++ compiler can be a cause of the error thrown:

configure: error: C++ preprocessor "/lib/cpp" fails sanity check

Try sudo apt-get install g++ and re-run the install.

Artem
  • 3,304
  • 3
  • 18
  • 41