Search code examples
xmlrosx-elcapitan

R: Unable to update XML package for R 3.2.2 on OSX El Capitan


I am trying to update the R XML package to version 3.98-1.4 on Mac OS X El Capitan with a homebrew installation of R in an R console

packageVersion("XML")
[1] ‘3.98.1.3’

sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin15.0.0 (64-bit)
Running under: OS X 10.11.3 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] XML_3.98-1.3

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

install.packages("XML")
Installing package into ‘/usr/local/lib/R/3.2/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.mtu.edu/src/contrib/XML_3.98-1.4.tar.gz'
Content type 'application/x-gzip' length 1599214 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /usr/local/Library/ENV/4.3/sed
checking for pkg-config... /usr/local/bin/pkg-config
checking for xml2-config... /usr/bin/xml2-config
USE_XML2 = yes
SED_EXTENDED_ARG: -E
Minor 9, Patch 2 for 2.9.2
Located parser file -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2/parser.h
Checking for 1.8:  -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2
Using libxml2.*
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... yes
checking for xmlHashSize in -lxml2... yes
Using built-in xmlHashSize
Checking DTD parsing (presence of externalSubset)...
checking for xmlHashSize in -lxml2... yes
Found xmlHashSize
checking for xmlOutputBufferCreateBuffer in -lxml2... yes
have xmlOutputBufferCreateBuffer()
checking for xmlDocDumpFormatMemoryEnc in -lxml2... yes
checking libxml/xmlversion.h usability... yes
checking libxml/xmlversion.h presence... yes
checking for libxml/xmlversion.h... yes
Expat:  FALSE
Checking for return type of xmlHashScan element routine.
No return value for xmlHashScan
xmlNs has a context field
Checking for cetype_t enumeration
Using recent version of R with cetype_t enumeration type for encoding
checking for xmlsec1-config... no
nodegc default 
xml-debug default 
Version has XML_WITH_ZLIB
Version has xmlHasFeature()

****************************************
Configuration information:

Libxml settings

libxml include directory: -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2
libxml library directory: -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib -lxml2 -lz -lpthread -licucore -lm -lz  -lxml2
libxml 2:                 -DLIBXML2=1

Compilation flags:         -DLIBXML -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2 -DUSE_EXTERNAL_SUBSET=1 -DROOT_HAS_DTD_NODE=1 -DDUMP_WITH_ENCODING=1 -DUSE_XML_VERSION_H=1 -DXML_ELEMENT_ETYPE=1 -DXML_ATTRIBUTE_ATYPE=1 -DNO_XML_HASH_SCANNER_RETURN=1 -DLIBXML_NAMESPACE_HAS_CONTEXT=1 -DHAVE_R_CETYPE_T=1 -DHAVE_XML_WITH_ZLIB=1 -DHAVE_XML_HAS_FEATURE=1 -DUSE_R=1 -D_R_=1  -DHAVE_VALIDITY=1 -DXML_REF_COUNT_NODES=1 
Link flags:               -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib -lxml2 -lz -lpthread -licucore -lm -lz  -lxml2

****************************************
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/supports.R
config.status: creating inst/scripts/RSXML.csh
config.status: creating inst/scripts/RSXML.bsh
** libs
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/opt/libxml2/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include    -fPIC  -g -O2  -c DocParse.c -o DocParse.o
In file included from DocParse.c:10:
./DocParse.h:26:5: error: unknown type name 'USER_OBJECT_'
    USER_OBJECT_ converters;
    ^
./DocParse.h:34:5: error: unknown type name 'SEXP'
    SEXP finalize;
    ^
./DocParse.h:42:1: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(convertXMLDoc)(const char *fileName, xmlDocPtr doc, USER_OBJECT_ converterFunctions, R_XMLSettings *settings);
^
./DocParse.h:42:73: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(convertXMLDoc)(const char *fileName, xmlDocPtr doc, USER_OBJECT_ converterFunctions, R_XMLSettings *settings);
                                                                        ^
./DocParse.h:44:1: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(AttributeList)(xmlNodePtr node, R_XMLSettings *settings);
^
./DocParse.h:45:1: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(createNodeChildren)(xmlNodePtr node, int direction, R_XMLSettings *parserSettings);
^
./DocParse.h:47:1: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(lookupGenericNodeConverter)(xmlNodePtr node, USER_OBJECT_ methods, R_XMLSettings *parserSettings);
^
./DocParse.h:47:66: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(lookupGenericNodeConverter)(xmlNodePtr node, USER_OBJECT_ methods, R_XMLSettings *parserSettings);
                                                                 ^
./DocParse.h:50:1: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(createNameSpaceIdentifier)(xmlNs *space, xmlNodePtr node);
^
./DocParse.h:52:1: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML_xmlXIncludeProcessFlags(USER_OBJECT_ r_doc, USER_OBJECT_ r_flags);
^
./DocParse.h:52:45: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML_xmlXIncludeProcessFlags(USER_OBJECT_ r_doc, USER_OBJECT_ r_flags);
                                            ^
./DocParse.h:52:65: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML_xmlXIncludeProcessFlags(USER_OBJECT_ r_doc, USER_OBJECT_ r_flags);
                                                                ^
./DocParse.h:54:1: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ processNamespaceDefinitions(xmlNs *ns, xmlNodePtr node, R_XMLSettings *parserSettings);
^
In file included from DocParse.c:13:
./Utils.h:24:1: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(invokeFunction)(USER_OBJECT_ fun, USER_OBJECT_ opArgs, USER_OBJECT_ state, xmlParserCtxtPtr ctx);
^
./Utils.h:24:37: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(invokeFunction)(USER_OBJECT_ fun, USER_OBJECT_ opArgs, USER_OBJECT_ state, xmlParserCtxtPtr ctx);
                                    ^
./Utils.h:24:55: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(invokeFunction)(USER_OBJECT_ fun, USER_OBJECT_ opArgs, USER_OBJECT_ state, xmlParserCtxtPtr ctx);
                                                      ^
./Utils.h:24:76: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(invokeFunction)(USER_OBJECT_ fun, USER_OBJECT_ opArgs, USER_OBJECT_ state, xmlParserCtxtPtr ctx);
                                                                           ^
./Utils.h:25:1: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(findFunction)(const char *opName, USER_OBJECT_ functions);
^
./Utils.h:25:55: error: unknown type name 'USER_OBJECT_'
USER_OBJECT_ RS_XML(findFunction)(const char *opName, USER_OBJECT_ functions);
                                                      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [DocParse.o] Error 1
ERROR: compilation failed for package ‘XML’
* removing ‘/usr/local/lib/R/3.2/site-library/XML’
* restoring previous ‘/usr/local/lib/R/3.2/site-library/XML’

The downloaded source packages are in
    ‘/private/var/folders/g8/rqv40nhs3zqcntnz_9t9l60w0000gr/T/RtmpiP7BlJ/downloaded_packages’
Warning message:
In install.packages("XML") :
  installation of package ‘XML’ had non-zero exit status    

'USER_OBJECT_' is defined in RSCommon.h which is present in the downloaded tar file.

Any suggestions ?

Thanks in advance


Solution

  • The configuration step appears to report the relevant flags for the compilation of the C code (see Compilation flags: in the output), but the calls to clang have only -DNEDBUG, and none of the other -D... terms. Check the contents of the src/Makevars file and specifically the PKGCPPFLAGS variable. This should contain the text reported in the "Compilation flags:" displayed on the terminal.