mingw build with gnuwin32 for jpeg/png/tiff support

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
neuviemep

mingw build with gnuwin32 for jpeg/png/tiff support

Post by neuviemep »

Hi there,

I was successful in building IM with MinGW, but it lacked support for the above mentioned image formats. I installed packages for libjpeg, libpng and libtiff from the GnuWin32 repository and tried again but this time the build failed.

Code: Select all

$ export CPPFLAGS="-I/c/gnuwin32/include"
$ export LDFLAGS="-L/c/gnuwin32/lib"
$ ./configure --prefix=/c/im --exec-prefix=/c/im --disable-static --disable-installed --disable-largefile --without-perl --without-x --without-modules

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

                  Option                        Value
-------------------------------------------------------------------------------
Shared libraries  --enable-shared=yes           yes
Static libraries  --enable-static=no            no
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              no
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
GhostPCL          None                          pcl6 (unknown)
GhostXPS          None                          gxps (unknown)
Ghostscript       None                          gswin32c (unknown)
Ghostscript fonts --with-gs-font-dir=default    none
Ghostscript lib   --with-gslib=no               no
Graphviz          --with-gvc=yes                no
JBIG              --with-jbig=yes               no
JPEG v1           --with-jpeg=yes               yes
JPEG-2000         --with-jp2=yes                no
LCMS              --with-lcms=yes               no
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=      none
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          = /c/im
  EXEC-PREFIX     = /c/im
  VERSION         = 6.5.4
  CC              = gcc -std=gnu99
  CFLAGS          = -O2 -march=i686 -Wall -W
  MAGICK_CFLAGS   = -O2 -march=i686 -Wall -W
  CPPFLAGS        = -I/c/im/include/ImageMagick -D_DLL -D_MT
  PCFLAGS         = -D_DLL -D_MT
  DEFS            = -DHAVE_CONFIG_H
  LDFLAGS         = -L/c/GnuWin32/lib
  MAGICK_LDFLAGS  = -L/c/im/lib -L/c/GnuWin32/lib
  LIBS            = -lMagickCore -ltiff -ljpeg -lpng -lz -lgdi32 -lm -lltdl
  CXX             = g++
  CXXFLAGS        = -g -O2 -Wall -W
As shown above, the configuration was successful. But I got some warnings during the build process:

Code: Select all

libtool: link: warning: library `/c/GnuWin32/lib/libpng.la' was moved.

*** Warning: linker path does not have real file for library -lintl.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libintl and none of the candidates passed a file format test
*** using a file magic. Last file checked: /c/GnuWin32/lib/libjpeg.dll.a
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.
copying selected object files to avoid basename conflicts...

*** Warning: This system can not link to static lib archive magick/libMagickCore.la.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.
libtool: link: warning: `/c/GnuWin32/lib/libpng.la' seems to be moved
libtool: link: warning: `/mingw/lib//libltdl.la' seems to be moved
Then finally, the build failed with:

Code: Select all

libtool: link: warning: library `/c/GnuWin32/lib/libpng.la' was moved.
libtool: link: warning: library `/c/GnuWin32/lib/libpng.la' was moved.
c:\mingw\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lintl
collect2: ld returned 1 exit status
make[1]: *** [utilities/animate.exe] Error 1
make[1]: Leaving directory `/home/ImageMagick-6.5.4-2'
make: *** [all] Error 2
Strange thing is that the problem appears to be with -lintl, not the gnuwin32 libraries, but there must be some connection because the build works fine without gnuwin32. Any suggestions higly appreciated.

Thanks.
alexsmith
Posts: 2
Joined: 2012-07-31T15:39:50-07:00
Authentication code: 15

Re: mingw build with gnuwin32 for jpeg/png/tiff support

Post by alexsmith »

Hi!

I had a similar problem and solved it by downloading and compiling each lib (libpng, libjpeg), then referencing them via export CPPFLAGS and LDFLAGS.
Post Reply