Subject: | Cannot install package due to compile error. |
Trying to build XML::LibXML against a supported libxml2 version (2.6.8, the last one the module claims to support), the make fails with a compilation error as follows:
gcc -c -I/usr/include/libxml2 -fno-strict-aliasing -I/usr/local/include -O2 -march=i386 -mcpu=i686 -DVERSION=\"1.58\" -DXS_VERSION=\"1.58\" -fPIC -I/usr/lib/perl5/5.6.1/i386-linux/CORE -DHAVE_UTF8 -DHAVE_BLANK perl-libxml-mm.c
perl-libxml-mm.c: In function `nodeC2Sv':
perl-libxml-mm.c:968: parse error before `*'
perl-libxml-mm.c:972: `decoded' undeclared (first use in this function)
perl-libxml-mm.c:972: (Each undeclared identifier is reported only once
perl-libxml-mm.c:972: for each function it appears in.)
make: *** [perl-libxml-mm.o] Error 1
Google suggests that at least two people have found and fixed the problem by moving the declaration of "xmlChar * decoded" from line 968 to the start of its block; however this blocking error is still in this package although it was first reported four months ago, and it would be nice if other people don't have to waste man-days in tracking it down ! So here's a patch for anyone else bitten by this.
--- perl-libxml-mm.c.orig Wed Mar 31 20:32:08 2004
+++ perl-libxml-mm.c Sat Nov 6 00:53:41 2004
@@ -959,13 +959,14 @@
if ( refnode != NULL ) {
xmlDocPtr real_doc = refnode->doc;
if ( real_doc != NULL && real_doc->encoding != NULL ) {
+ xmlChar * decoded;
xs_warn( " encode node !!" );
/* The following statement is to handle bad
values set by XML::LibXSLT */
if ( PmmNodeEncoding(real_doc) == XML_CHAR_ENCODING_NONE ) {
PmmNodeEncoding(real_doc) = XML_CHAR_ENCODING_UTF8;
}
- xmlChar * decoded = PmmFastDecodeString( PmmNodeEncoding(real_doc) ,
+ decoded = PmmFastDecodeString( PmmNodeEncoding(real_doc) ,
(const xmlChar *)string,
(const xmlChar*)real_doc->encoding);
xs_warn( "push decoded string into SV" );