MinGW32 & ImageMagick-6.4.8-3 complie error

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
alexkim

MinGW32 & ImageMagick-6.4.8-3 complie error

Post by alexkim »

Hi~
I tried to compile ImageMagic-6.4.8-3 with MinGW32, gnuwin32 under WindowsXP.

I used the following configuration.
( I referred to http://www.imagemagick.org/script/advan ... .php#mingw )

Code: Select all

  ./configure --without-perl --disable-largefile --without-x --disable-shared -
-without-threads 
The result of configure is the following.

Code: Select all

Host system type: i686-pc-mingw32
Build system type: i686-pc-mingw32

                  Option                        Value
-------------------------------------------------------------------------------
Shared libraries  --enable-shared=no            no
Static libraries  --enable-static=yes           yes
Module support    --with-modules=no             no
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              yes
Autotrace         --with-autotrace=no           no
DJVU              --with-djvu=yes               no
DPS               --with-dps=yes                no
FlashPIX          --with-fpx=yes                no
FontConfig        --with-fontconfig=no          no
FreeType          --with-freetype=yes           no (failed tests)
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               yes
JPEG v1           --with-jpeg=yes               yes
JPEG-2000         --with-jp2=yes                no
LCMS              --with-lcms=yes               yes
LQR               --with-lqr=yes                no
Magick++          --with-magick-plus-plus=yes   yes
OpenEXR           --with-openexr=yes            no
PERL              --with-perl=no                no
PNG               --with-png=yes                yes
RSVG              --with-rsvg=no                no
TIFF              --with-tiff=yes               yes
Windows fonts     --with-windows-font-dir=      
WMF               --with-wmf=no         no
X11               --with-x=no                           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.8
  CC              = gcc -std=gnu99
  CFLAGS          = -g -O2 -Wall -W
  MAGICK_CFLAGS   = -g -O2 -Wall -W
  CPPFLAGS        = -I/usr/local/include/ImageMagick -D_LIB
  PCFLAGS         = -D_LIB
  DEFS            = -DHAVE_CONFIG_H
  LDFLAGS         = -Lc:/Progra~1/GnuWin32/lib -L/d/temp/ImageMagick-6.4.8-3/magick/.libs -L/d/temp/ImageMagick-6.4.8-3/magick -L/d/temp/ImageMagick-6.4.8-3/wand
  MAGICK_LDFLAGS  = -L/usr/local/lib -Lc:/Progra~1/GnuWin32/lib -L/d/temp/ImageMagick-6.4.8-3/magick/.libs -L/d/temp/ImageMagick-6.4.8-3/magick -L/d/temp/ImageMagick-6.4.8-3/wand
  LIBS            = -lMagickCore -ljbig -llcms -ltiff -ljpeg -lpng -lbz2 -lz -lgdi32 -lm 
  CXX             = g++
  CXXFLAGS        = -g -O2 -Wall -W
I had some errors in executing make.

Code: Select all

$ make
make  all-am
make[1]: Entering directory `/d/temp/ImageMagick-6.4.8-3'
/bin/sh ./libtool --silent --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I./config  -I./ltdl -I./ltdl  -Ic:/Progra~1/GnuWin32/include -D_LIB -I/d/temp/ImageMagick-6.4.8-3/magick -I/d/temp/ImageMagick-6.4.8-3/wand  -g -O2 -Wall -W -MT magick/magick_libMagickCore_la-animate.lo -MD -MP -MF magick/.deps/magick_libMagickCore_la-animate.Tpo -c -o magick/magick_libMagickCore_la-animate.lo `test -f 'magick/animate.c' || echo './'`magick/animate.c
mv -f magick/.deps/magick_libMagickCore_la-animate.Tpo magick/.deps/magick_libMagickCore_la-animate.Plo
/bin/sh ./libtool --silent --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I./config  -I./ltdl -I./ltdl  -Ic:/Progra~1/GnuWin32/include -D_LIB -I/d/temp/ImageMagick-6.4.8-3/magick -I/d/temp/ImageMagick-6.4.8-3/wand  -g -O2 -Wall -W -MT magick/magick_libMagickCore_la-blob.lo -MD -MP -MF magick/.deps/magick_libMagickCore_la-blob.Tpo -c -o magick/magick_libMagickCore_la-blob.lo `test -f 'magick/blob.c' || echo './'`magick/blob.c
magick/blob.c:120: error: field `properties' has incomplete type
magick/blob.c: In function `FileToBlob':
magick/blob.c:793: error: storage size of 'file_info' isn't known
magick/blob.c:799: warning: implicit declaration of function `_fstat64'
magick/blob.c:793: warning: unused variable `file_info'
magick/blob.c: In function `FileToImage':
magick/blob.c:945: error: storage size of 'file_info' isn't known
magick/blob.c:945: warning: unused variable `file_info'
magick/blob.c: In function `ImageToFile':
magick/blob.c:1478: error: storage size of 'file_info' isn't known
magick/blob.c:1478: warning: unused variable `file_info'
magick/blob.c: In function `InjectImageBlob':
magick/blob.c:1746: error: storage size of 'file_info' isn't known
magick/blob.c:1746: warning: unused variable `file_info'
magick/blob.c: In function `OpenBlob':
magick/blob.c:2371: error: dereferencing pointer to incomplete type
magick/blob.c:2379: error: dereferencing pointer to incomplete type
magick/blob.c: At top level:
magick/blob.c:3670: warning: unused parameter 'map'
magick/blob.c:3670: warning: unused parameter 'length'
magick/blob.c:1959: warning: unused parameter 'file'
magick/blob.c:1959: warning: unused parameter 'mode'
magick/blob.c:1960: warning: unused parameter 'offset'
magick/blob.c:1960: warning: unused parameter 'length'
make[1]: *** [magick/magick_libMagickCore_la-blob.lo] Error 1
make[1]: Leaving directory `/d/temp/ImageMagick-6.4.8-3'
make: *** [all] Error 2
How can I fix it?

Thanks in advance~
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MinGW32 & ImageMagick-6.4.8-3 complie error

Post by magick »

In magick/nt-base.h, change
  • #if !defined(stat)
    # define stat __stat64
    #endif
to
  • #if !defined(stat) && !defined(__MINGW32__)
    # define stat __stat64
    #endif
Does that fix the problem?
alexkim

Re: MinGW32 & ImageMagick-6.4.8-3 complie error

Post by alexkim »

I fixed that problem after editing the code as what you said. thank you :)
But I had another problems. :(

Code: Select all

In file included from magick/identify.c:96:
c:/Progra~1/GnuWin32/include/lcms.h:143: error: conflicting types for 'DWORD'
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:229: error: p                 revious declaration of 'DWORD' was here
c:/Progra~1/GnuWin32/include/lcms.h:143: error: conflicting types for 'LPDWORD'
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:248: error: p                 revious declaration of 'LPDWORD' was here
In file included from magick/identify.c:96:
c:/Progra~1/GnuWin32/include/lcms.h:148:1: warning: "ZeroMemory" redefined
In file included from c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/                 windows.h:50,
                 from ./magick/nt-base.h:32,
                 from ./magick/studio.h:299,
                 from magick/identify.c:45:
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1193:1: warn                 ing: this is the location of the previous definition
In file included from magick/identify.c:96:
c:/Progra~1/GnuWin32/include/lcms.h:149:1: warning: "CopyMemory" redefined
In file included from c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/                 windows.h:50,
                 from ./magick/nt-base.h:32,
                 from ./magick/studio.h:299,
                 from magick/identify.c:45:
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1191:1: warn                 ing: this is the location of the previous definition
In file included from magick/identify.c:96:
c:/Progra~1/GnuWin32/include/lcms.h:154:1: warning: "LOWORD" redefined
In file included from c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/                 windows.h:48,
                 from ./magick/nt-base.h:32,
                 from ./magick/studio.h:299,
                 from magick/identify.c:45:
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:131:1: warnin                 g: this is the location of the previous definition
In file included from magick/identify.c:96:
c:/Progra~1/GnuWin32/include/lcms.h:155:1: warning: "HIWORD" redefined
In file included from c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/                 windows.h:48,
                 from ./magick/nt-base.h:32,
                 from ./magick/studio.h:299,
                 from magick/identify.c:45:
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:132:1: warnin                 g: this is the location of the previous definition
In file included from magick/identify.c:96:
c:/Progra~1/GnuWin32/include/lcms.h:156:1: warning: "MAX_PATH" redefined
In file included from c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/                 windows.h:48,
                 from ./magick/nt-base.h:32,
                 from ./magick/studio.h:299,
                 from magick/identify.c:45:
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:42:1: warning                 : this is the location of the previous definition
make[1]: *** [magick/magick_libMagickCore_la-identify.lo] Error 1
make[1]: Leaving directory `/d/temp/ImageMagick-6.4.8-3'
make: *** [all] Error 2
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MinGW32 & ImageMagick-6.4.8-3 complie error

Post by magick »

These errors appear to be related to the Little CMS package, LCMS. However, we might be able to workaround the problem. Add

#define LCMS_WIN_TYPES_ALREADY_DEFINED 1

in magick/studio.h. Does ImageMagick compile now?
alexkim

Re: MinGW32 & ImageMagick-6.4.8-3 complie error

Post by alexkim »

Thank your for your attention. :)

I add that define code to magick/studio.h, excute "make clean" and compile it again.

But I couldn't fix those errors.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MinGW32 & ImageMagick-6.4.8-3 complie error

Post by magick »

Again its a LCMS problem rather than a ImageMagick problem but we'll take a look. Post a URL so we can download the lcms.h from your system and match up the compile errors with the source file. If you don't need LCMS in ImageMagick you can add --without-lcms to the ImageMagick configure script command line and rebuild.
alexkim

Re: MinGW32 & ImageMagick-6.4.8-3 complie error

Post by alexkim »

I attached the lcms.h file on the following url
http://www.upshare.net/download.php?id= ... setlang=en

Before being fixed the error related lcms.h
I re-configured with "--without-lcms" and compiled it.
I succeed to install. :D

I'll wait for the answer about lcms.h

thanks~
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MinGW32 & ImageMagick-6.4.8-3 complie error

Post by magick »

It appears that LCMS on your system is older and does not have a conditional compile for defining DWORD. Under Windows DWORD should not be defined since it already defined in windows.h. This problem has been corrected in modern releases of LCMS.
alexkim

Re: MinGW32 & ImageMagick-6.4.8-3 complie error

Post by alexkim »

Maybe lcms lib in GnuWin32(http://gnuwin32.sourceforge.net/) is outdated.

I downloaded the recent file from "http://www.littlecms.com/downloads.htm", compile and install it.
and I deleted "#define LCMS_WIN_TYPES_ALREADY_DEFINED 1" because the code made other errors.
Finally I fixed the errors related to "lcms.h".

Thank you!!!
Post Reply