igraph 在 Ubuntu 17.04 中安装时出现问题

igraph trouble upon install in Ubuntu 17.04

我是 igraph 的新手,在 R('littler' 版本 0.3.2,R v3.4.0)和 Rstudio(版本 1.0.153)。 我刚刚安装了 RRstudio,在 Ubuntu 17.04(64 位)上安装 igraph 时遇到问题。此问题已被问及 elsewhere 但未解决且没有可接受的答案。

下面描述的安装错误似乎与我尝试安装包的库目录无关。我都试过了:
...通过修改文件 /etc/R/Renviron.

RStudio 中的结果在每种情况下都是:

> install.packages("igraph")
........
In file included from src/foreign-gml-parser.y:59:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined
 #  define strdup igraph_i_strdup

In file included from /usr/include/string.h:630:0,
                 from src/foreign-gml-parser.y:54:
/usr/include/x86_64-linux-gnu/bits/string2.h:337:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)

gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -DUSING_R -I. -Iinclude -Ics -Iglpk -Iplfit -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -g -O2 -fdebug-prefix-map=/build/r-base-X2xP8j/r-base-3.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.1.1\" -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL=/**/ -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-X2xP8j/r-base-3.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c foreign-graphml.c -o foreign-graphml.o
foreign-graphml.c: In function ‘igraph_write_graph_graphml’:
foreign-graphml.c:1408:46: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "<graphml xmlns=\"" GRAPHML_NAMESPACE_URI "\"\n");
                                              ^~~~~~~~~~~~~~~~~~~~~
foreign-graphml.c:1412:59: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         xsi:schemaLocation=\"" GRAPHML_NAMESPACE_URI "\n");
                                                           ^~~~~~~~~~~~~~~~~~~~~
foreign-graphml.c:1414:38: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         " GRAPHML_NAMESPACE_URI "/1.0/graphml.xsd\">\n");
                                      ^~~~~~~~~~~~~~~~~~~~~
/usr/lib/R/etc/Makeconf:159: recipe for target 'foreign-graphml.o' failed
make: *** [foreign-graphml.o] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/home/ckb/R/x86_64-pc-linux-gnu-library/3.4/igraph’
Warning in install.packages :
  installation of package ‘igraph’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmpli2vyo/downloaded_packages’

如果有人能帮我解决问题,我将不胜感激。某个著名的搜索引擎不是特别有用,可能是因为我不知道如何寻找答案。
谢谢。

解决方法是为所有用户安装包,而不是只为 Rstudio 会话中的一个用户安装包。我完全不清楚为什么我在尝试后者时会系统地出错。 Ubuntu 中的 cli 是:

sudo su - -c "R -e \"install.packages('igraph', repos='http://cran.rstudio.com/')\""