XMLTree.c:1016: error: void value not ignored as it ought to be

Normally I don't recommend trying to alter code when an installation throws an error - the problem is usually user-related (i.e. me) or totally unfixable. This is one exception:

If you get this error trying to install the R XML library from Omegahat

XMLTree.c: In function `xmlBufferWrite':
XMLTree.c:1016: error: void value not ignored as it ought to be
*** Error code 1
make: Fatal error: Command failed for target `XMLTree.o'


Don't give up. It is actually worth fixing this one.

Expand the tarball and alter the file called 'XMLTree.c'

gunzip XML_1.99-0.tar.gz
tar -xvf XML_1.99-0.tar
rm XML_1.99-0.tar
emacs XML/src/XMLTree.c


The offending code:

#ifdef ADD_XML_OUTPUT_BUFFER_CODE

/* These two taken from libxml2-2.6.27
They are needed if xmlOutputBufferCreateBuffer()
is not in the installed libxml2.
It appeared in libxml2-2.6.23, released on Jan 5 2006
*/
static int
xmlBufferWrite (void * context, const char * buffer, int len) {
int ret;

ret = xmlBufferAdd((xmlBufferPtr) context, (const xmlChar *) buffer, len);
if (ret != 0)
return(-1);
return(len);
}

xmlOutputBufferPtr
xmlOutputBufferCreateBuffer(xmlBufferPtr buffer,
xmlCharEncodingHandlerPtr encoder) {
xmlOutputBufferPtr ret;

if (buffer == NULL) return(NULL);

ret = xmlOutputBufferCreateIO((xmlOutputWriteCallback)
xmlBufferWrite,
(xmlOutputCloseCallback)
NULL, (void *) buffer, encoder);

return(ret);
}

#endif

Notice the disclaimer - if your libxml2 is up to date these methods are not necessary anyway.
So just delete those two methods and the directive they rode in on, from #ifdef to #endif

Recompress
tar -cvf XML_1.99-0.tar XML
gzip XML_1.99-0.tar

and install
R CMD INSTALL XML_1.99-0.tar.gz

Comments

  1. you seem like a smart guy. I can't get an update from Microsoft to install on my Mac. Can you tell me what's wrong?

    ReplyDelete
  2. Hmmm. Might have to change my name to Mary now.

    ReplyDelete

Post a Comment

Popular Posts