Re: Cannot compile version 1.3.31 - winsock2.h

Bob Friesenhahn <[email protected]> Sat, 11 May 2019 16:57:30 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Sat, 11 May 2019, Test User wrote:

> Hello All,
>
> Compilation of version 1.3.31 with MinGW (gcc 6.3.0, w32api 5.2.1) fails:
>
> libtool: compile:  gcc -static-libgcc -DHAVE_CONFIG_H -I. 
> -I../GraphicsMagick-1.3.31 -D_MAGICKLIB_ -I/include -D_DLL -D_MT 
> -Ic:/include/freetype2 -Ic:/include/libxml2 -fopenmp -g -O2 -Wall -pthread 
> -MT coders/magick_libGraphicsMagick_la-url.lo -MD -MP -MF 
> coders/.deps/magick_libGraphicsMagick_la-url.Tpo -c 
> ../GraphicsMagick-1.3.31/coders/url.c  -DDLL_EXPORT -DPIC -o 
> coders/.libs/magick_libGraphicsMagick_la-url.o
> In file included from c:/include/libxml2/libxml/nanoftp.h:20:0,
>                 from ../GraphicsMagick-1.3.31/coders/url.c:55:
> c:\mingw\include\winsock2.h:49:2: error: #error "Including <winsock2.h> after 
> <winsock.h> is unsupported."
> #error "Including <winsock2.h> after <winsock.h> is unsupported."
>  ^~~~~

This is clearly a problem with libxml2, or at least the version you 
are using.  It may also be a problem with MinGW's emulations of 
Windows winsock2.h and winsock.h.

Unfortunately, support for HTTP and FTP URLs is still obtained via 
libxml2.  It would be much better to use curl.

I use Visual Studio 2008 Professional to build the release packages. 
This is pretty old but is able to build binaries which work on most 
systems still in use.

if you do not need URL support, or SVG support, then you could disable 
use of libxml2 by adding --without-xml to the configure options. 
Another option is to add the line

#undef HasXML

immediately after the magick/studio.h include in url.c and then make 
any additional small edits necessary (e.g. to magick/static.c) so that 
the software compiles.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt