GNOME Bugzilla – Bug 766798
Compiling libxml2-2.9.4 on windows fails
Last modified: 2017-06-13 16:25:53 UTC
I can successfully compile libxml2-2.9.4-rc2 under Windows from the command line. However, using today's source for libxml2-2.9.4 master, results in the following errors: relaxng.c ..\relaxng.c(2218) : error C2275: 'xmlChar' : illegal use of this type as an expression ..\include\libxml\xmlstring.h(28) : see declaration of 'xmlChar' ..\relaxng.c(2218) : error C2065 : 'result' : undeclared identifier ..\relaxng.c(2219) : error C2065 : 'result' : undeclared identifier ..\relaxng.c(2219) : warning C4047 : 'function' : 'xmlChar **' differes in levels of indirection from 'int *' ..\relaxng.c(2219) : warning C4024: 'xmlEscapeFormatString' : different types for formal and actual parameter 1 ..\xmlschemas.c(3172) : error C2275: 'xmlChar' : illegal use of this type as an expression ..\include\libxml\xmlstring.h(28) : see declaration of 'xmlChar' ..\xmlschemas.c(3172) : error C2065: 'expectedEscaped' : undeclared identifier ..\xmlschemas.c(3173) : error C2065: 'expectedEscaped' : undeclared identifier ..\xmlschemas.c(3173) : warning C4047: 'function' : 'xmlChar **' differes in levels of indirection from 'int *' ..\xmlschemas.c(3173) : warning C4024: 'xmlEscapeFormatString' : different types for formal and actual parameter 1 ..\xmlschemas.c(3174) : error C2065 : 'expectedEscaped' : undeclared identifier ..\xmlschemas.c(3174) : warning C4047: '!=' : 'int' differs in levels of indirection from 'void *' ..\xmlschemas.c(3174) : error C2065: 'expectedEscaped' : undeclared identifier ..\xmlschemas.c(3174) : error C2065: 'expectedEscaped' : undeclared identifier ..\xmlschemas.c(3174) : warning C4047: '=' : 'int' differes in levels of indirection from 'void *' NMAKE : fatal error U1077 : '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe"' : return code '0x2' Stop.
Ah crap ... possibly a patch which was under embargo :-( can you try to revert the following change ------------------------------------------ diff --git a/libxml.h b/libxml.h index 4558b70..88e515f 100644 --- a/libxml.h +++ b/libxml.h @@ -9,6 +9,8 @@ #ifndef __XML_LIBXML_H__ #define __XML_LIBXML_H__ +#include <libxml/xmlstring.h> + #ifndef NO_LARGEFILE_SOURCE #ifndef _LARGEFILE_SOURCE #define _LARGEFILE_SOURCE @@ -93,6 +95,7 @@ int __xmlInitializeDict(void); int __xmlRandom(void); #endif +XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg); int xmlNop(void); #ifdef IN_LIBXML ------------------------------------------- I have no windows devel environment, if you could help pinpoint which change led to this regression, thanks ! Daniel
The two issues appear to have been caused by the checkin 6 hours ago by David Kilzer. In file: 'relaxng.c' take out the two lines added at line#2218 and #2219: xmlChar *result = xmlCharStrdup(msg); return (xmlEscapeFormatString(&result)); and put the orriginal line back in their place: return (xmlStrdup((xmlChar *) msg)); That fixes the first issue. Then in the file 'xmlschemes.c' take out the lines added at #3172, #3173 and #3174: xmlChar *expectedEscaped = xmlCharStrdup(expected); msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped)); FREE_AND_NULL(expectedEscaped); and put back the orriginal line: msg = xmlStrcat(msg, BAD_CAST "'.\n"); All will then compile on my Windows machine without the two issues I reported. HTH
Created attachment 337117 [details] [review] Fix for Window compiler issue on libxml2-2.9.4 I came across this issue as well. The problem is that older compilers do not like variable definitions late in a section. The attached patch fixes the problem.
*** This bug has been marked as a duplicate of bug 767063 ***