Skip to content
Advertisement

Error installing r packages (Linux Mint 17.1) “error: C preprocessor “g++ -E” fails sanity check”

I have transfered to a Linux system (previous OSX user) and I am trying to get my R packages installed.

The first issue I ran across was:

Warning in install.packages("stringi") :
  'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead?  (y/n)

but I got around that by launching R using:

$ sudo R

If someone has a more permanent solution to using ‘sudo’ (because I will be using RStudio in the future), I would be interested to know!

But for now, I have an issue that I cannot find a solution to. When I try to install ‘stringi’, I get the following:

* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for local ICUDT_DIR... icu55/data
checking for R_HOME... /usr/lib/R
checking for R... /usr/lib/R/bin/R
checking for R >= 3.1.0... yes
checking for cat... /bin/cat
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 how to run the C preprocessor... g++ -E
configure: error: in `/tmp/Rtmplf58Ya/R.INSTALL2d1959f5fc41/stringi':
configure: error: C preprocessor "g++ -E" fails sanity check
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/usr/local/lib/R/site-library/stringi’

What does the line:

configure: error: C preprocessor "g++ -E" fails sanity check

refer to? Im fairly certain my C compiler works based on this line:

checking whether the C compiler works... yes

and this line:

checking whether we are using the GNU C compiler... yes

but like I said, I am just now starting to delve into the inner workings of the Linux system, so I could be totally wrong here.

Any and all assistance is greatly appreciated!

Edit: I am using Linux Mint 17.1 (MATE) and R version 3.2.1

Advertisement

Answer

Try installing g++: sudo apt-get install g++

The GNU C Compiler (GCC) may be installed, but g++ isn’t always installed by default.

As for having to sudo into R Studio, that’s the equivalent of having to type your password in when installing a program in OS X – it’s just one of the little intricacies of Linux systems (incidentally, OS X is based on BSD Linux). I imagine you won’t necessarily need to use sudo when you’re not installing a package though (not sure, haven’t really used R Studio to be honest).

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement