简体   繁体   English

安装r软件包时出错(Linux Mint 17.1)“错误:C预处理程序“ g ++ -E”无法进行健全性检查”

[英]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. 我已经转移到Linux系统(以前的OSX用户),并且试图安装我的R软件包。

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: 但是我通过使用以下命令启动R来解决了这个问题:

$ 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! 如果有人对使用“ sudo”有更永久的解决方案(因为将来我将使用RStudio),那么我想知道!

But for now, I have an issue that I cannot find a solution to. 但是目前,我有一个无法解决的问题。 When I try to install 'stringi', I get the following: 当我尝试安装'stringi'时,得到以下信息:

* 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: 我很确定我的C编译器基于以下代码工作:

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. 但是就像我说的那样,我现在才开始深入研究Linux系统的内部工作原理,因此在这里我可能是完全错误的。

Any and all assistance is greatly appreciated! 任何帮助都将不胜感激!

Edit: I am using Linux Mint 17.1 (MATE) and R version 3.2.1 编辑:我正在使用Linux Mint 17.1(MATE)和R版本3.2.1

Try installing g++: sudo apt-get install g++ 尝试安装g ++: sudo apt-get install g++

The GNU C Compiler (GCC) may be installed, but g++ isn't always installed by default. 可以安装GNU C编译器(GCC),但是默认情况下并非总是安装g ++。

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). 至于必须使用sudo进入R Studio,这等效于在OS X中安装程序时必须输入密码-这只是Linux系统的小巧之处之一(顺便说一下,OS X是基于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). 我想当您不安装软件包时,您不一定需要使用sudo (不确定,说实话,您还没有真正使用过R Studio)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM