After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766798 - Compiling libxml2-2.9.4 on windows fails
Compiling libxml2-2.9.4 on windows fails
Status: RESOLVED DUPLICATE of bug 767063
Product: libxml2
Classification: Platform
Component: general
git master
Other Windows
: Normal blocker
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2016-05-23 13:13 UTC by Andrew Hartley
Modified: 2017-06-13 16:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for Window compiler issue on libxml2-2.9.4 (1.12 KB, patch)
2016-10-06 22:41 UTC, Michael Rumph
none Details | Review

Description Andrew Hartley 2016-05-23 13:13:19 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.
Comment 1 Daniel Veillard 2016-05-23 14:32:59 UTC
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
Comment 2 Andrew Hartley 2016-05-23 15:19:31 UTC
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
Comment 3 Michael Rumph 2016-10-06 22:41:12 UTC
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.
Comment 4 Nick Wellnhofer 2017-06-13 16:25:53 UTC

*** This bug has been marked as a duplicate of bug 767063 ***