I'm trying to install this package from source on Windows and cannot work out what is going on and what I need to do in order to get this working.
I have the tar-gz file from CRAN, I have R-3.1.2 installed and RTools installed.
When I try to install this package I get the following error:
* installing *source* package 'XML' ...
** package 'XML' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG -I/include/libxml2 -I/include -D_R_=1 -DUSE_R=1 -DUSE_XML_VERSION_H=1 -DLIBXML -DUSE_EXTERNAL_SUBSET=1 -DROOT_HAS_DTD_NODE=1 -DUMP_WITH_ENCODING=1 -DXML_ELEMENT_ETYPE=1 -DXML_ATTRIBUTE_ATYPE=1 -DLIBXML2=1 -DHAVE_XML_HAS_FEATURE -DLIBXML_STATIC -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall -std=gnu99 -mtune=core2 -c DocParse.c -o DocParse.o
In file included from DocParse.c:10:0:
DocParse.h:18:27: fatal error: libxml/parser.h: No such file or directory
compilation terminated.
make: *** [DocParse.o] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-31~1.2/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-31~1.2/share/make/winshlib.mk" SHLIB="XML.dll" OBJECTS="DocParse.o EventParse.o ExpatParse.o HTMLParse.o NodeGC.o RSDTD.o RUtils.o Rcatalog.o Utils.o XMLEventParse.o XMLHashTree.o XMLTree.o fixNS.o libxmlFeatures.o schema.o xmlsecurity.o xpath.o"' had status 2
ERROR: compilation failed for package 'XML'
Which seems that this is the actual problem:
DocParse.h:18:27: fatal error: libxml/parser.h: No such file or directory
compilation terminated.
So I've grabbed libxml2 from here:
http://www.zlatkovic.com/libxml.en.html
But I have literally no idea what to do next.
In the source for the libxml2 I can see the parser.h file mentioned in the error but what do I do with it or the library in order to get this install working?
I ran into the exact same issue while trying to update the XML
package, even though I had libxml2
installed in Rtools
, and found the answer here. Next step is simply to throw:
Sys.setenv(LOCAL_CPPFLAGS = "-I/mingw$(WIN)/include/libxml2")
into the console. Then
install.packages("XML")
will run just fine.
If you happen to have libxml2
not installed, you'd want to launch Rtools Bash
from the start menu and run pacman -S mingw-w64-x86_64-libxml2
into the command line...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With