Compile LibXML2 from source
Get the source code from
http://xmlsoft.org/downloads.html
Linux and Solaris
(Have to use python 32-bit)
cd /opt/mydir/libxml2
mkdir linux-gcc3
gunzib -c libxml2-2.9.4.tar.gz | tar xvf –
cd libxml2-2.9.4
./configure --prefix=/opt/mydir/libxml2/linux-gcc3 --enable-static --disable-shared 2>&1 | tee conf.log
## 64 bit
## ./configure CC="cc -m64" --prefix=/opt/mydir/libxml2/linux-gcc3 --enable-static --disable-shared 2>&1 | tee conf.log
make 2>&1 | tee make.log
make install
If you have Python 2.5 or older, you have to replace all these lines:
libxml2-2.9.4/python/generator.py
From
except IOError as msg:
To
except IOError, msg:
Windows
Machine must have Microsoft Visual Studio 2010
Extract source code to C:\mydir\libxml2
Create a directory C:\mydir\win64
Go to C:\mydir\libxml2\libxml2-2.9.4\win32
(In libxml2-2.9.2, copy the configure.ac to configure.in) (Maybe it's a bug?)
Open command prompt:
cscript configure.js compiler=msvc iconv=no zlib=no debug=no prefix=C:\mydir\win64
# For 64 bit, run this command first:
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64
nmake /f Makefile.msvc 2>&1 | tee make.log
nmake /f Makefile.msvc install
After that, we need to copy the C:\mydir\win64\include\libxml2\libxml to C:\mydir\win64\include (OMG?!)
libxml2 2.9.4 build error with Visual Studio 2005/2008/2010
https://mail.gnome.org/archives/xml/2016-June/msg00008.html
Apply this patch
diff --git a/relaxng.c b/relaxng.c index 56a3344..93a0f0b 100644 --- a/relaxng.c +++ b/relaxng.c @@ -2087,6 +2087,7 @@ static xmlChar * xmlRelaxNGGetErrorString(xmlRelaxNGValidErr err, const xmlChar * arg1, const xmlChar * arg2) { + xmlChar *result; char msg[1000]; if (arg1 == NULL) @@ -2215,7 +2216,7 @@ xmlRelaxNGGetErrorString(xmlRelaxNGValidErr err, const xmlChar * arg1, snprintf(msg, 1000, "Unknown error code %dn", err); } msg[1000 - 1] = 0; - xmlChar *result = xmlCharStrdup(msg); + result = xmlCharStrdup(msg); return (xmlEscapeFormatString(&result)); } diff --git a/xmlschemas.c b/xmlschemas.c index e1b3a4f..7afe2eb 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -3168,8 +3168,8 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, "valid."); } if (expected) { - msg = xmlStrcat(msg, BAD_CAST " Expected is '"); xmlChar *expectedEscaped = xmlCharStrdup(expected); + msg = xmlStrcat(msg, BAD_CAST " Expected is '"); msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped)); FREE_AND_NULL(expectedEscaped); msg = xmlStrcat(msg, BAD_CAST "'.n");