Page 1 of 1

MingW compile driving me nuts

Posted: 2008-06-10T12:17:57-07:00
by michealvleugel
Trying to compile Imagemagick on Windows using MingW/MSYS but I am going nuts in the process. I want to distribute my own app (which uses the C wand api) as a single installer, so that requires Imagemagick + delegates to be independent of absolute filepaths/registry etc (all dll's in one dir would be fine). I managed to compile everything ok without the delegates, using --without-modules, and also had no problems compiling it with only ./configure (the coders then end up somewhere in my ming directory) But now...the delegates, without a hardcoded path...

Jpg is no problem as well as some others but as soon as I try to compile anythin that depends on Zlib (freetype, png, tiff) I get this error:

C:/msys/1.0/local/lib/libz.a(zutil.o)(.text+0x0):zutil.c: multiple definition of `zlibVersion'

C:/msys/1.0/local/lib/libtiff.dll.a(d000266.o)(.text+0x0): first defined here

C:/msys/1.0/local/lib/libz.a(inflate.o)(.text+0x2c0):inflate.c: multiple definition of `inflateInit_'

C:/msys/1.0/local/lib/libtiff.dll.a(d000250.o)(.text+0x0): first defined here

C:/msys/1.0/local/lib/libz.a(inflate.o)(.text+0x3f0):inflate.c: multiple definition of `inflate'

C:/msys/1.0/local/lib/libtiff.dll.a(d000245.o)(.text+0x0): first defined here

C:/msys/1.0/local/lib/libz.a(inflate.o)(.text+0x1dc0):inflate.c: multiple definition of `inflateEnd'

C:/msys/1.0/local/lib/libtiff.dll.a(d000247.o)(.text+0x0): first defined here

C:/msys/1.0/local/lib/libz.a(deflate.o)(.text+0x18b0):deflate.c: multiple definition of `deflateInit_'

C:/msys/1.0/local/lib/libtiff.dll.a(d000235.o)(.text+0x0): first defined here

C:/msys/1.0/local/lib/libz.a(deflate.o)(.text+0x380):deflate.c: multiple definition of `deflate'

C:/msys/1.0/local/lib/libtiff.dll.a(d000230.o)(.text+0x0): first defined here

C:/msys/1.0/local/lib/libz.a(deflate.o)(.text+0x0):deflate.c: multiple definition of `deflateEnd'

C:/msys/1.0/local/lib/libtiff.dll.a(d000233.o)(.text+0x0): first defined here

Creating library file: magick/.libs/libMagickCore.dll.a

Can anyone please help me? ANy help is greatly appreciated.

Cheers,
Michael

Re: MingW compile driving me nuts

Posted: 2008-06-10T14:04:50-07:00
by michealvleugel
Oh yeah - almost forgot - using IM 6.4.1 and all source files in the "delegates" folder on the FTP server.

Re: MingW compile driving me nuts

Posted: 2008-06-10T16:28:32-07:00
by magick
It looks like your build is needs the Zlib library, generally -lz.

The default Visual C++ build is "non-installed" which means no Window registry is required. Create a static build to reduce the number of dependencies.

Re: MingW compile driving me nuts

Posted: 2008-06-11T00:27:42-07:00
by michealvleugel
Hmmm - have the gzlib installed, tried the gnuwin32 install and to compile it myself - no luck. Arn't "multiple definition" errors in gcc generated when objects are linked twice?

Thanks for our help!

-------------------------------------------------------------

Checking for ZLIB support

-------------------------------------------------------------

checking zconf.h usability... yes

checking zconf.h presence... yes

checking for zconf.h... yes

checking zlib.h usability... yes

checking zlib.h presence... yes

checking for zlib.h... yes

checking for compress in -lz... yes

checking for uncompress in -lz... yes

checking for deflate in -lz... yes

checking for inflate in -lz... yes

checking for gzseek in -lz... yes

checking for gztell in -lz... yes

checking if ZLIB package is complete... yes




Option Value

-------------------------------------------------------------------------------

Shared libraries --enable-shared=yes yes

Static libraries --enable-static=yes yes

Module support --with-modules=yes yes

GNU ld --with-gnu-ld=yes yes

Quantum depth --with-quantum-depth=16 16

High Dynamic Range Imagery

--enable-hdri=no no



Delegate Configuration:

BZLIB --with-bzlib=yes no (failed tests)

DJVU --with-djvu=no no

DPS --with-dps=yes no

FlashPIX --with-fpx=yes no

FontConfig --with-fontconfig=no no

FreeType --with-freetype=yes yes

GhostPCL None pcl6 (unknown)

GhostXPS None gxps (unknown)

Ghostscript None gswin32c (unknown)

result_ghostscript_font_dir='none'

Ghostscript fonts --with-gs-font-dir=default

Ghostscript lib --with-gslib=yes no

Graphviz --with-gvc=yes no

JBIG --with-jbig=yes no

JPEG v1 --with-jpeg=yes yes

JPEG-2000 --with-jp2=yes yes

LCMS --with-lcms=yes yes

LQR --with-lqr=no no

Magick++ --with-magick-plus-plus=yes yes

OpenEXR --with-openexr=yes no

PERL --with-perl=yes no

PNG --with-png=yes yes

RSVG --with-rsvg=no no

TIFF --with-tiff=yes yes

result_windows_font_dir='none'

Windows fonts --with-windows-font-dir=

WMF --with-wmf=yes yes

X11 --with-x= no

XML --with-xml=no no

ZLIB --with-zlib=yes yes



X11 Configuration:

X_CFLAGS =

X_PRE_LIBS =

X_LIBS =

X_EXTRA_LIBS =



Options used to compile and link:

PREFIX = /usr/local

EXEC-PREFIX = /usr/local

VERSION = 6.4.1

CC = gcc

CFLAGS = -g -O2 -Wall -W

MAGICK_CFLAGS = -g -O2 -Wall -W

CPPFLAGS = -I/usr/local/include/ImageMagick -D_DLL -D_MT

PCFLAGS = -D_DLL -D_MT

DEFS = -DHAVE_CONFIG_H

LDFLAGS = -L/usr/local/lib -L/usr/local/lib -lfreetype -lz

MAGICK_LDFLAGS = -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lfreetype -lz

LIBS = -lMagickCore -llcms -ltiff -lfreetype -ljpeg -lz -lgdi32 -lm

CXX = g++

CXXFLAGS = -g -O2 -Wall -W





C:/msys/1.0/local/lib/libz.a(deflate.o)(.text+0x18b0):deflate.c: multiple definition of `deflateInit_'

C:/msys/1.0/local/lib/libtiff.dll.a(d000234.o)(.text+0x0): first defined here

C:/msys/1.0/local/lib/libz.a(deflate.o)(.text+0x380):deflate.c: multiple definition of `deflate'

C:/msys/1.0/local/lib/libtiff.dll.a(d000229.o)(.text+0x0): first defined here

C:/msys/1.0/local/lib/libz.a(deflate.o)(.text+0x0):deflate.c: multiple definition of `deflateEnd'

C:/msys/1.0/local/lib/libtiff.dll.a(d000232.o)(.text+0x0): first defined here

Creating library file: magick/.libs/libMagickCore.dll.a

collect2: ld returned 1 exit status

make[1]: *** [magick/libMagickCore.la] Error 1

make[1]: Leaving directory `/c/imagem/ImageMagick-6.4.1'

make: *** [all] Error 2

Re: MingW compile driving me nuts

Posted: 2008-06-13T05:11:24-07:00
by michealvleugel
Ok found what looks like a solution - it now builds ok with tiff, png and zlib.

There is an offending passage in the configure file of libpng (1.2.29):

#ifdef __cplusplus
extern "C"
#endif
char zlibVersion ();
int
main ()
{
return zlibVersion ();
;
return 0;
}
_ACEOF


After changing return 0; into return "1.2.3"; it worked.

Only took me 3 full days to get IM to compile with mingW - about the same amount of time it took me to write my application in the first place :(