GNOME Bugzilla – Bug 677626
Unable to build libxml2-2.8.0 on Windows XP using MSVC V6.0
Last modified: 2017-10-09 16:17:22 UTC
Created attachment 215846 [details] libxml2-2.8.0 MSVC Config file Hi, I'm trying to configure and compile libxml2-2.8.0 on Windows XP SP3 using MSVC 6.0. I am using the same options to configure the new version as I did with libxml2-2.7.8. It seems to configure okay, but when trying to build I get the following errors when it tries to compile "nanohttp.c": ... nanohttp.c ..\nanohttp.c(577) : error C2065: 'EINPROGRESS' : undeclared identifier ..\nanohttp.c(577) : error C2051: case expression is not constant ..\nanohttp.c(584) : error C2065: 'ECONNRESET' : undeclared identifier ..\nanohttp.c(584) : error C2051: case expression is not constant ..\nanohttp.c(925) : error C2051: case expression is not constant ... NMAKE : fatal error U1077: 'cl.exe' : return code '0x2' Any help would be greatly appreciated. As an aside libxml2-2.7.8 configures and compiles okay but we get a SEGV in xmlDocFormatDump which I was hoping may have been fixed in the latest version. I will report the libxml2-2.7.8 SEGV as a separate bug.
I can confirm that I get the same NMAKE fatal error as above. In my case, it's Windows 7 x64, building with MSVC 2008 / SDK 7.0. Error output is: nanohttp.c ..\nanohttp.c(574) : error C2065: 'EINPROGRESS' : undeclared identifier ..\nanohttp.c(574) : error C2051: case expression not constant ..\nanohttp.c(581) : error C2065: 'ECONNRESET' : undeclared identifier ..\nanohttp.c(581) : error C2051: case expression not constant ..\nanohttp.c(922) : error C2065: 'EINPROGRESS' : undeclared identifier ..\nanohttp.c(922) : error C2051: case expression not constant followed up by... NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\amd64\cl.exe"' : return code '0x2' Going to look into this further and see if I can't figure out a workaround / patch for it. -RMWChaos
I was able to fix this with a couple of changes, which are below in patch format. Essentially, the code only includes winsock2.h and wsockcompat.h if compiling on mingw32 or if the OS is WinCE with "#if defined(__MINGW32__) || defined(_WIN32_WCE)". Then when wsockcompat.h is called, it in turn only defines EINPROGRESS (WSAEINPROGRESS) and ECONNRESET (WSAECONNRESET) if not compiling with MSVC with "#ifndef _MSC_VER". By removing these #ifdef and #ifndef lines (and their ending #endif lines) respectively, then libxml2-2.8.0 compiles properly. I'm sure someone can tell me why this is not a good idea. ;-) I notice that Neal's line numbers differ from mine - not sure why that is as we're both compiling libxml2-2.8.0. Possibly it's because he's compiling on a WinXP x86 machine while I'm compiling on a Win7 x64 machine, and the 'cscript compile.js' may change things as a result? Not sure. Here are what the patches would look like for me... --- nanohttp.c 2012-08-07 14:10:33 -0500 +++ nanohttp_patch.c 2012-08-07 14:10:49 -0500 @@ -74,7 +74,6 @@ #define XML_SOCKLEN_T unsigned int #endif -#if defined(__MINGW32__) || defined(_WIN32_WCE) #ifndef _WINSOCKAPI_ #define _WINSOCKAPI_ #endif @@ -82,7 +81,6 @@ #include <winsock2.h> #undef XML_SOCKLEN_T #define XML_SOCKLEN_T unsigned int -#endif #include <libxml/globals.h> #include <libxml/xmlerror.h> --- include/wsockcompat.h 2012-08-07 13:54:35 -0500 +++ include/wsockcompat_patch.h 2012-08-07 13:55:00 -0500 @@ -41,7 +41,6 @@ #define EWOULDBLOCK WSAEWOULDBLOCK #define ESHUTDOWN WSAESHUTDOWN -#ifndef _MSC_VER #define EINPROGRESS WSAEINPROGRESS #define EALREADY WSAEALREADY #define ENOTSOCK WSAENOTSOCK @@ -81,6 +80,5 @@ #define ENAMETOOLONG WSAENAMETOOLONG #define ENOTEMPTY WSAENOTEMPTY */ -#endif /* _MSC_VER */ #endif /* __XML_WSOCKCOMPAT_H__ */ Hope that helps, -RMWChaos
Should be fixed with my latest set of Windows-related commits.