igraph在安装Ubuntu时遇到困难17.04
问题描述:
我是igraph
的新手,仍然是绿色的R
('littler'版本0.3.2,其中R
v3.4.0)和Rstudio
(版本1.0.153)。 我刚刚安装了R
和Rstudio
,并且在Ubuntu 17.04(64位)上安装igraph时遇到了问题。这个问题被问到elsewhere,但没有解决,并没有接受答案。igraph在安装Ubuntu时遇到困难17.04
下面描述的安装错误似乎与我尝试安装软件包的库目录无关。我试了两个:
...通过修改文件/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/')\""