Installation of the XML package in Windows 10

Hello RStudio community, I'm having trouble installing the XML package on Windows 10 and hoping someone else may have encountered this and know how to solve this (and hopefully this is an appropriate forum for asking this type of question).

In short; I cannot install the XML library on Windows 10 because it requires compilation, and the compiler can't find the appropriate libxml2 header files. XML is a dependency of another package that I'm trying to install.

I'm currently running R and RStudio under Windows 10 with Rtools 3.5 installed.

Here is the output of my sessionInfo():

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1   

When I try to install the XML package, I receive the following error:

* installing *source* package 'XML' ...
** package 'XML' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/gcc  -I"C:/PROGRA~1/R/R-35~1.1/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         -O3 -Wall  -std=gnu99 -mtune=generic -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
 #include <libxml/parser.h>
                           ^
compilation terminated.
make: *** [C:/PROGRA~1/R/R-35~1.1/etc/i386/Makeconf:208: DocParse.o] Error 1
ERROR: compilation failed for package 'XML'

I've downloaded the windows binaries for libxml from https://www.zlatkovic.com/projects/libxml/ , which expand out to a directory containing bin/ include/ and lib/ which I'm familiar with from linux, but I'm not sure how to link these to the compiler on Windows.

I can reproduce the error installing the last version available only as source.

If you don't need the last version 3.98-1.19, you can install the windows binary using

install.packages("XML", type = "binary")

it will be version 3.98-1.18

3 Likes

Thanks @cderv ,

That works - I'm not sure why my system was not detecting the existence of the windows binary, but manually setting type = "binary" works.

1 Like

I had the same issue and the solution worked for me as well. Thanks @cderv !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.