R包中的错误" igraph"安装

时间:2018-05-24 14:24:27

标签: r igraph

我试图安装R包" igraph"在Linux服务器上并遇到一些错误。

我已尝试install.packages("igraph"),并收到以下错误消息:

  1. checking whether the C compiler works... no相关的问题:

    * installing *source* package ‘igraph’ ...
    ** package ‘igraph’ successfully unpacked and MD5 sums checked
    checking for gcc... /usr/local/bin/gcc
    checking whether the C compiler works... no
    configure: error: in `/tmp/RtmpPaaksz/R.INSTALL8c157a39a973/igraph':
    configure: error: C compiler cannot create executables
    See `config.log' for more details
    ERROR: configuration failed for package ‘igraph’
    
  2. lazyeval.c:53: error: ‘for’ loop initial declarations are only allowed in C99 mode相关的问题:

    lazyeval.c: In function ‘make_lazy_dots’:
    lazyeval.c:53: error: ‘for’ loop initial declarations are only allowed in C99 mode
    lazyeval.c:53: note: use option -std=c99 or -std=gnu99 to compile your code
    lazyeval.c:63: error: redefinition of ‘nxt’
    lazyeval.c:53: note: previous definition of ‘nxt’ was here
    make: *** [lazyeval.o] Error 1
    ERROR: compilation failed for package ‘igraph’
    
  3. 我的环境是

    • 的Linux
    • R 3.4.3

    有人会给我一些宝贵的建议吗?

    由于我的问题的一致性,我关闭了这篇文章,尽管我仍然无法安装该软件包。谢谢大家!

1 个答案:

答案 0 :(得分:1)

我通过将〜/ .R / Makevars文件更改为

来处理两个问题
C=gcc-5
CXX=g++
CXX1X = g++-5
CFLAGS = -std=c99 -Wall -pedantic

前三行是问题1,最后一行是2。