【问题标题】:Error in R package "igraph" installationR包“igraph”安装出错
【发布时间】:2018-05-24 14:24:26
【问题描述】:

我正在尝试在 Linux 服务器中安装 R 包“igraph”,但遇到了一些错误。

我试过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’
    

我的环境是

  • Linux
  • R 3.4.3

谁能给我一个宝贵的建议?

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

【问题讨论】:

  • 你能找到config.log 并上传吗?
  • 你运行的是什么操作系统?你是如何安装 R 的?你跑过apt-get build-essential之类的东西吗?这应该包括一个编译器。
  • @SeGa 试图找到它,@MrFlick 我在帖子中添加了我的信息。 apt-get build-essential 给了我这个-bash: apt-get: command not found
  • 谢谢,@G5W。我有点挣扎,并试图更改我的 ~/.R/Makevars 文件,它解决了checking whether the C compiler works。但是,我更新的新错误来了。

标签: r igraph


【解决方案1】:

我通过将 ~/.R/Makevars 文件更改为处理了两个问题

C=gcc-5
CXX=g++
CXX1X = g++-5
CFLAGS = -std=c99 -Wall -pedantic

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

【讨论】:

  • 我只是个古董。您是如何从日志中发现这一点的?
  • @akh22 感谢您对此的关注,但是我发帖已经一年多了,所以我现在不记得了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-16
  • 2014-12-02
  • 2021-07-13
相关资源
最近更新 更多