[Share] Compile IM6 with FFTW+HDRI using mingw64
Posted: 2012-10-21T10:07:46-07:00
A) Download the following:
D) run the following in the MSYS prompt to set up some parameters:
(I choose these CFLAGS and CXXFLAGS for Core2-based CPU. If you are not sure, simply use "-O2 -mcpu=native")
E) compile and install the static library of zlib
H) compile and install the static library of freetype
I) compile and install the static library of libjpeg-turbo
L) compile and install the static library of tiff
M) compile and install the static library of libwebp
N) compile and install the static library of lcms2
O) compile and install the static library of fftw
P) finally, compile ImageMagick 6
Q) To test and use the compiled static executables....
- Minimalist GNU for Windows (http://sourceforge.net/projects/mingw/f ... -get-inst/)
- MinGW-builds (http://sourceforge.net/projects/mingwbu ... in32/sjlj/)
- zlib-1.2.7.tar.gz
- bzip2-1.0.6.tar.gz
- xz-5.0.4.tar.gz
- freetype-2.4.10.tar.gz
- libjpeg-turbo-1.2.1.tar.gz
- jbigkit-2.0.tar.gz
- jasper-1.900.1.zip
- libpng-1.5.13.tar.gz
- tiff-4.0.3.tar.gz
- libwebp-0.2.0.tar.gz
- lcms2-2.4.tar.gz
- fftw-3.3.2.tar.gz
- ImageMagick-6.8.0-1.tar.xz
- I believe we need a 64-bit Windows. I tried this procedure on XP64.
- run "mingw-get-inst-20120426.exe" and install everything, say, to c:\MinGW
- copy C:\MinGW\msys\1.0 to C:\msys
- extract "x64-4.7.2-release-win32-sjlj-rev0.7z" to, say, c:\mingw_gcc_472_x64_sjlj_rev0
- edit C:\msys\etc\fstab and keep one line only:
Code: Select all
c:/mingw_gcc_472_x64_sjlj_rev0 /mingw
- copy crypt32.dll, gdi32.dll, msimg32.dll, wldap32.dll, ws2_32.dll from C:\WINDOWS\system32 to c:\mingw_gcc_472_x64_sjlj_rev0\x86_64-w64-mingw32\lib as libcrypt32.dll, libgdi32.dll, libmsimg32.dll, libwldap32.dll, libws2_32.dll
- (not sure if this is correct) In c:\mingw_gcc_472_x64_sjlj_rev0\bin, make a copy of every .exe and name it as x86_64-w64-mingw32-[orig_name].exe (e.g. copy windres.exe as x86_64-w64-mingw32-windres.exe) in the same directory.
D) run the following in the MSYS prompt to set up some parameters:
Code: Select all
export CHOST="x86_64-w64-mingw32"
export PREFDIR="/usr/local"
export LDFLAGS="-L${PREFDIR}/lib"
export CPPFLAGS="-I${PREFDIR}/include"
export LIBS=""
export CFLAGS="-O2 -march=core2 -mfpmath=sse -mmmx -msse -msse2 -msse3 -mssse3"
export CXXFLAGS="-O2 -march=core2 -mfpmath=sse -mmmx -msse -msse2 -msse3 -mssse3"
E) compile and install the static library of zlib
- extract zlib-1.2.7.tar.gz and edit its "configure" script to suppress its checking of mingw. Change the line "MINGW* | mingw*)" to "MIINGW* | miingw*)"
Code: Select all
./configure --static --64 make clean make -j 4 make install
- extract bzip2-1.0.6.tar.gz and edit the corresponding lines of its Makefile:
Code: Select all
... CC=$(CHOST)-gcc AR=$(CHOST)-ar RANLIB=$(CHOST)-ranlib .... CFLAGS=-Wall -Winline $(BIGFILES) -O2 -march=core2 -mfpmath=sse -mmmx -msse -msse2 -msse3 -mssse3 .... chmod a+x $(PREFIX)/bin/bzip2.exe chmod a+x $(PREFIX)/bin/bunzip2.exe chmod a+x $(PREFIX)/bin/bzcat.exe chmod a+x $(PREFIX)/bin/bzip2recover.exe ....
- then compile and install:
Code: Select all
make clean make -j 4 make install
Code: Select all
export LIBS=""
make distclean
make clean
./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=${PREFDIR} --enable-static --disable-shared
make clean
make -j 4
make install-strip
Code: Select all
export LIBS=""
make distclean
make clean
./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=${PREFDIR} --enable-static --disable-shared
make clean
make -j 4
make install-strip
- Edit jmorecfg.h to avoid declaration clash with another mingw64 header
Code: Select all
.... /* typedef int boolean; */ typedef unsigned char boolean; .... /* typedef long INT32; */ typedef signed int INT32; ....
- then compile and install:
Code: Select all
export LIBS="" make distclean make clean ./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=${PREFDIR} --enable-static --disable-shared make clean make -j 4 make install-strip
- edit Makefile
Code: Select all
.... CCFLAGS = -W -O2 -march=core2 -mfpmath=sse -mmmx -msse -msse2 -msse3 -mssse3 ....
- then compile and install:
Code: Select all
make clean make -j 4 mkdir ${PREFDIR}/man/man1 mkdir ${PREFDIR}/man/man5 cp ./libjbig/jbig.h ${PREFDIR}/include cp ./libjbig/jbig85.h ${PREFDIR}/include cp ./libjbig/jbig_ar.h ${PREFDIR}/include cp ./libjbig/libjbig.a ${PREFDIR}/lib cp ./libjbig/libjbig85.a ${PREFDIR}/lib cp ./libjbig/tstcodec.exe ${PREFDIR}/bin cp ./libjbig/tstcodec85.exe ${PREFDIR}/bin cp ./pbmtools/jbgtopbm.exe ${PREFDIR}/bin cp ./pbmtools/jbgtopbm85.exe ${PREFDIR}/bin cp ./pbmtools/pbmtojbg.exe ${PREFDIR}/bin cp ./pbmtools/pbmtojbg85.exe ${PREFDIR}/bin cp ./pbmtools/jbgtopbm.1 ${PREFDIR}/man/man1 cp ./pbmtools/pbmtojbg.1 ${PREFDIR}/man/man1 cp ./pbmtools/pbm.5 ${PREFDIR}/man/man5 cp ./pbmtools/pgm.5 ${PREFDIR}/man/man5
Code: Select all
export LIBS=""
make distclean
make clean
./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=${PREFDIR} --enable-static --disable-shared
make clean
make -j 4
make install-strip
Code: Select all
export LIBS=""
make distclean
make clean
./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=${PREFDIR} --enable-static --disable-shared
make clean
make -j 4
make install-strip
Code: Select all
export LIBS=""
make distclean
make clean
./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=${PREFDIR} --enable-static --disable-shared
make clean
make -j 4
make install-strip
Code: Select all
export LIBS="-ljbig -llzma"
make distclean
make clean
./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=${PREFDIR} --enable-static --disable-shared
make clean
make -j 4
make install-strip
Code: Select all
export LIBS=""
make distclean
make clean
./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=${PREFDIR} --enable-static --disable-shared --with-our-malloc --with-windows-f77-mangling --enable-threads --with-combined-threads --enable-fma --disable-alloca --enable-sse2
make clean
make -j 4
make install-strip
Code: Select all
export LIBS="-ljbig -llzma"
make distclean
make clean
./configure --host=${CHOST} --build=${CHOST} --target=${CHOST} --prefix=${PREFDIR} --enable-static --disable-shared --without-perl --without-magick-plus-plus --enable-hdri
make clean
make -j 4
make install-strip
- create the directory you desire, say, c:\IM6
- copy ImageMagick-6.8.0-1/utilities/*.exe to c:\IM6
- copy ImageMagick-6.8.0-1/config/*.xml to c:\IM6
- before using the compiled executables, set the environmental variable:
Code: Select all
set MAGICK_CONFIGURE_PATH=c:\IM6
- as you can tell from the syntax, you do not need MSYS to run the executables