On compiling ImageMagick 6 and 7 using Mingw64

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
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

On compiling ImageMagick 6 and 7 using Mingw64

Post by henrywho »

First, I downloaded
a) MSYS from http://sourceforge.net/apps/trac/mingw-w64/wiki/MSYS
b) Mingw64/GCC 4.7.1 from http://tdm-gcc.tdragon.net/
c) Supporting libraries (all in .tar.gz): zlib-1.2.7, bzip2-1.0.6, xz-5.0.4, jbigkit-2.0, libjpeg-turbo-1.2.1, libpng-1.5.12, tiff-4.0.3, libxml2-2.9.0, fftw-3.3.2, lcms-1.19, lcms2-2.4, ImageMagick-6.7.9-9 and ImageMagick-7.0.0-0

Then I set up Mingw64 under WinXP64 according to the section "Setting up the MinGW 64 environment" (http://www.gaia-gis.it/spatialite-3.0.0 ... ow_to.html). Also, in order to minimize compilation errors, I copied all MinGW64\x86_64-w64-mingw32\bin'\*.exe as MinGW64\bin\x86_64-w64-mingw32-*.exe

For compilation, I did them all in MSYS sh shell. Except for zlib-1.2.7 (of which I edited win32/Makefile.gcc to edit the PREFIX as "x86_64-w64-" and change the optimization flags to "-O2 -march=core2") and bzip2-1.0.6 (also the opt flags in Makefile), I compile the sources by:

Code: Select all

export    CHOST="x86_64-w64-mingw32"
export   CFLAGS="-O2 -march=core2"
export CXXFLAGS="-O2 -march=core2"
export  LDFLAGS="-L/usr/local/lib"
export CPPFLAGS="-I/usr/local/include"
make distclean
./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=/usr/local
make -j 5
make install-strip
The configure command for fftw-3.3.2 is tweaked according to its FAQ:

Code: Select all

./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=/usr/local --with-our-malloc --with-windows-f77-mangling --enable-shared --disable-static --enable-threads --with-combined-threads --enable-fma --disable-alloca --enable-sse2
For ImageMagick-6.7.9-9, it does not build shared version and so I use:

Code: Select all

./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=/usr/local --enable-static --disable-shared --without-perl --without-magick-plus-plus --with-modules --enable-hdri 
For ImageMagick-7.0.0-0, I use:

Code: Select all

./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=/usr/local --enable-static --disable-shared --without-perl --without-magick-plus-plus --with-modules
ImageMagick-7.0.0-0 compilation failed in some system headers with _MSC_VER defined as empty string. If I disable http and ftp in libxml2, IM7 complains about macro errors in other system headers (also macro related). It looks like a problem of TDM-GCC/Mingw64.

BTW, how can I test if ImageMagick 6 is compiled correctly?
Last edited by henrywho on 2012-10-02T19:02:42-07:00, edited 2 times in total.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: On compiling ImageMagick 6 and 7 using Mingw64

Post by henrywho »

Also, some libraries such as "tiff" are rejected by IM6/7's configure. It happens only for TDM-GCC's Mingw64, but not its Mingw32 or xvidvideo.ru's GCC build.
Post Reply