Building R igraph package in Win7

余生颓废 提交于 2019-12-01 12:02:00

问题


I made a small change to the source code of the igraph package because I want to implement the forest fire method based on the breadth first search method.

I used Rtools to build the package and followed the steps as this link. But, I got a error message:

foreign-graphml.c:38:29: fatal error: libxml/encoding.h: No such file or directory.

I tested using the source code, but still had the same error.

I also used the install.packages() method. It still showed the same error.

Update: I downloaded the Libxml2 and set the bin location to the path. The libxml/encoding.h file is actually in the 'include' folder. Why does this error show?


回答1:


You can build it at http://win-builder.r-project.org/upload.aspx, just don't forget to change the DESCRIPTION file to include your email address as maintainer.

It is actually quite tricky to build it because Rtools has some fixed (?) paths and it is looking for libraries at specific places, so you need to put them there. We build it with something like

...
if ! (subst | grep -qi ^d:); then
  subst d: c:\\
fi

pkg=`ls igraph*.tar.gz`
zip=`echo $pkg | sed 's/.tar.gz/.zip/'`
rfile="r-win/${zip}"

OLDPATH=$PATH
PATH=/cygdrive/c/Program\ Files/R/R-default/bin:/cygdrive/c/Rtools/bin:/cygdrive/c/Rtools/gcc-4.6.3/bin:$PATH

LIB_XML=c:/RCompile/CRANpkg/extralibs64/local R CMD INSTALL -l . $pkg
zip -r ${zip} igraph
PATH=$OLDPATH
...

This uses a cygwin shell. You can get the extra libraries here: http://www.stats.ox.ac.uk/pub/Rtools/libs.html



来源:https://stackoverflow.com/questions/22624216/building-r-igraph-package-in-win7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!