Compile Graphics Magick, Boost, Botan and QT with MinGW64 under Windows 7 64
Compile Graphics Magick, Boost, Botan and QT with MinGW64 under Windows 7 64
INTRODUCTION
This tutorial explains how to compile several important C++ libraries under Windows 7 64 bits using MinGW 64 for 64 bits architectures:
- Graphics Magick 1.4 and Image Magick
- Open SSL
- Boost 1.57
- Botan
- Qt 5.4 and Qt Creator 3.2.1
- OpenCV 2.4.9
All patches, configuration files and compilation scripts described in the document can be downloaded here: 20150202-compile.7z
On a PC with a processor Intel(R) Core(TM) i7-2600K CPU @ 3.4GHz with 32GB of RAM and State Solid disk it takes approximately 5 hours to compile all libraries described in the document in parallel for both 32 and 64 bits architecture.
On a laptop with a processor Intel(R) Core(TM) i7-2720QM CPU @ 2.2GHz with 8GB of RAM and State Solid disk the same process takes 9 hours.
If you have any suggestions or corrections please do not esitate to contact me using the Contact Me form. And if you find it useful let me know too, a little thank will help me keeping it up-to-date :-)
Toolchain MingGW
To compile all the following code I will use Ming Builds 64bits with GCC 4.9.2, with SEH exceptions and POSIX threads. This version of GCC support all features of C++ up to version 14.
The toolchain is available from the following link
The file I downloaded is
x86_64-4.9.2-release-posix-seh-rt_v3-rev1.7z
Warning: before compiling anything on Windows I strongly advice you to disable any running Antivirus. Not only the compilation is considerably slowed down by an antivirus, but it can also causes a lot of unespected problems. As an example the configure command failing immediately after the message "Checking how to run the C preprocessor".
Warning: you may face unexpected issues when running make commands with the -jx option, where x is the number of cores in your system. On my system this option works on most (not all) packages, but it seems to cause race conditions on Windows 8. Please consider to remove the -jx option from all make commands if you face unexpected issues during the compilation.
SETUP THE BUILDING ENVIRONMENT
This part of the guide is similar to the one written by Ingar Satgnu - http://ingar.satgnu.net/devenv/mingw32/index.html
The main difference is that here there are no build32 and build64 directories and all packages are installed into separate directories. More work is required to configure compilation FLAGS and PATH but the resulting structure is more versatile for distribution of self-contained packages.
MSYS 2 installation
MSYS 2 is a minimalistic collection of GNU utilities, including a UNIX console, that will be used, together with MinGW, to compile all the following source code. It derives from Cygwin but it is more Windows friendly. Download the latest version from
http://sourceforge.net/projects/msys2/files/Base/x86_64/
I prefer to download the tar.xz version instead of the executable because it is more versatile and reduce to the minimum Windows register pollution.
msys2-base-x86_64-20141113.tar.xz
This new version of MSYS 2 is the only one that works while compiling Qt 5.4 with MinGW 64: if you use the previous version, simply called MSYS, you will have issues with compiled objects file size.
Simply extract the content of the archive into the following directory using for example the free software 7zip.
C:\Tools\
Warning: in MSYS 2 there is some sort of limitation in the lenght of environment paths: it can be any path e.g. LD_LIBRARY_PATH or LIBRARY_PATH. In this scenario any command can unexpectedly fail with a subtle error like "Bad address". I suggest to give the base directory a name shorter or equal to 5 character (e.g. "Tools"). Consider also to remove all unused path when possible.
You should have 2 batch files sitting in C:\Tools\
mingw64_shell.bat
mingw32_shell.bat
The first command opens a terminal and sets a series of environment variables to use the 64 bits compiler located in /mingw64 while the second will do the same for the 32 bits compiler located in /mingw32. Run the first one.
The first time you start MSYS 2 you will see a lot of configuration messages. Once the console is open, type the following commands to update MSYS 2 packages and restart the console
pacman -Sy
pacman -Su
Temporary files will be downloaded into the following directory and can be deleted at the end of the process
/var/cache/pkgfile
You will need to install few additional packages that are required later. Remember to restart MSYS 2 after the installation.
pacman -S zip unzip tar make diffutils patch
Should you experience some issues with the the package repository run the following commands to clean it up
run pacman-key --init
pacman-key --populate
MinGW 64 installation
It is possible to install default versions of both MinGW for 32 and 64 bits compilers running the following two commands but I personally prefer to download the version I want as it gives me more freedom to experiment (see above).
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-i686-toolchain
To install the chosen version of MinGW 64 simply delete both directories /mingw32 and /mingw64 and uncompress the following file into C:\Tools\mingw64
x86_64-4.9.2-release-posix-seh-rt_v3-rev1.7z
Once you restart MSYS 2 you can test if gcc is working with the following command
gcc --version
Now create the following directory
mkdir /local64
This will be used to compile and install libraries and tool for 64 bits specific architectures. Now create the following directories where we are installing compiled packages, additional configurations and source files.
mkdir /local64/{etc,dst,src,tmp} /src
Toolchain configuration
To compile 64 bits applications we need to create a profile.local file and save it under /local64/etc
Be sure the file is in UNIX format, in case use Notepad++ to change it.
alias dir='ls -la --color=auto' |
The array APPLICATION_ARRAY is used to build all libraries into separate directories but it can be easily updated to build all libraries into one common directory.
We also want to load this configuration file whenever we lunch an MSYS 2 console for a 64 bits environment. To do so we modify the file /etc/profile as follows (we add also the option for 32 bits environment in case).
... MINGW32) |
You can always manually load a configuration running the following command
source /local64/etc/profile.local
Once finished restart MSYS 2 console.
Cmake
Cmake is the more modern counterpart to configure. Both are used to prepare source code for compiling with make. Here it will be used to compile OpenCV.
Download the latest version of CMake for Windows cmake-3.1.1-win32-x86.zip from http://www.cmake.org/cmake/resources/software.html and unpack it under
/opt/cmake
As a result you should have the following structure
/opt/cmake/bin
/opt/cmake/doc
/opt/cmake/man
/opt/cmake/share
Perl
In order to compile Qt you need to install Perl. If you don't, the Qt configure.exe command will complain about some missing header files.
In this guide I use Active Perl 5.20.1. You can download the 64 bit version from the following link http://www.activestate.com/activeperl and install it under
C:\Tools\opt\perl
Do no install it into "Programs Files" if you don't want to have problems with the infamous space and also do not add this path to the Windows PATH variable, because we are adding it to the configuration files inside MSYS. We do not need to install the 32 bits version of Perl because this is used to process configuration scripts and not to compile.
Python
To compile Botan and OpenCV you must install Python. All the tools in this page work with both version 3.3.3 and 2.7.6 with the exception of SCons. If you plan to use SCons to compile your own software then use Python 2.7.9.
Download the installation file for Windows 7 64 bits
python-2.7.9.amd64.msi
from http://python.org/download/ and follow the installation process. I installed Python in
C:\Toos\opt\python
Do no install it into "Programs Files" if you don't want to have problems with the infamous space and also do not add this path to the Windows PATH variable, because we are adding it to the configuration files inside MSYS. We do not need to install the 32 bits version of Python because this is used to process configuration scripts and not to compile.
SCons
SCons is a software construction tool—that is, a superior alternative to the classic "Make" build tool.
You don't need SCons to compile the source code described in this document. But if you plan to use SCons to build your own personal software, remember that it currenlty supports Python 2.7 only. Support for Python 3.3 is under development. SCons is installed directly into the Python installation directory. I tried several different approaches to install SCons using MSYS and the following is the only one that works.
Download the file
scons-2.3.4.tar.gz
from http://www.scons.org into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $GLOBAL_SRC_DIR
tar zxvf scons-2.3.4.tar.gz
cd scons-2.3.4
python setup.py bdist_wininst
start dist/scons-2.3.4.win-amd64.exe
The installation software should detect Python instalation directory (from Windows regiter) and install SCons scripts directly into it. Once finished run the following commands to rename SCons Python script and test it.
cp /opt/python/Scripts/scons.py /opt/python/Scripts/scons scons --version
Be sure the Python Scripts directory is added to the PATH variable.
Ruby
To compile Qt 5.4 you need Ruby.
Download the installation file for Windows 7 64 bits
rubyinstaller-2.1.5-x64.exe
from http://rubyinstaller.org and follow the installation process. I installed Python in
C:\Tools\opt\ruby
Do no install it into "Programs Files" if you don't want to have problems with the infamous space and also do not add this path to the Windows PATH variable, because we are adding it to the configuration files inside MSYS. We do not need to install the 32 bits version of Python because this is used to process configuration scripts and not to compile.
Once installed open a MSYS console and run the following command to be sure that the right version of Python is used
ruby --version
Win Flex-Bison
You will need a version of Flex and Bison for MSYS in order to compile Qt 5.4 WebKit. Download the file
win_flex_bison-latest.zip
from http://sourceforge.net/projects/winflexbison/ and uncompress it under
C:\Tools\opt\win_flex_bison
Do no install it into "Programs Files" if you don't want to have problems with the infamous space and also do not add this path to the Windows PATH variable, because we are adding it to the configuration files inside MSYS as shown later in the document.
BUILDING THE SOURCE CODE
To reduce the amount of disk required to build both 64 and 32 version of all libraries I decided to save all source files into the same directory
$GLOBAL_SRC_DIR=/src
All source files must be saved into this directory.
Pkg-config Lite 0.28-1
This is a package configuration tool. The original tool has a circular dependency with GLib libraries making it difficult to compile. This lite version works the same while removing this circular dependency.
Download the file
pkg-config-lite-0.28-1.tar.gz
from http://sourceforge.net/projects/pkgconfiglite/files/0.28-1/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -zxf $GLOBAL_SRC_DIR/pkg-config-lite-0.28-1.tar.gz
cd $SRC_DIR/pkg-config-lite-0.28-1
sh configure --prefix=$PKGCONFIG_PREFIX --build $MACHTYPE
make -j8
make install
The option
-j8
is for an 8 CPUs computer. Just use the appropriate number according to your system. Please note that this simply speeds up the compilation time but does not affect the actual result except for some highlighted packages that cannot be compiled in parallel, Qt included.
Libiconv 1.14
GNU libiconv is a Unicode support library. Please note that the MinGW64 Toolchain might come with a 32 bits version of libiconv, so it is better to recompile it in 64 bits anyway.
Download the file
libiconv-1.14.tar.gz
from http://ftp.gnu.org/pub/gnu/libiconv/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -zxf $GLOBAL_SRC_DIR/libiconv-1.14.tar.gz
cd $SRC_DIR/libiconv-1.14/
sh /configure –-prefix=$LIBICONV_PREFIX --build $MACHTYPE --enable-shared
make -j8
make install
zlib 1.2.8
This is a popular library implementing Deflate, i.e. the compression algorithm used by Gzip and Zip. Download the file
zlib-1.2.8.tar.gz
from http://zlib.net into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR tar -xf $GLOBAL_SRC_DIR/zlib-1.2.8.tar.gz
cd $SRC_DIR/zlib-1.2.8/
make -f win32/Makefile.gcc SHAREDLIB=libz.dll
mkdir -p $ZLIB_PREFIX/bin mkdir -p $ZLIB_PREFIX/include
mkdir -p $ZLIB_PREFIX/lib
cp libz.dll $ZLIB_PREFIX/bin/
cp zconf.h zlib.h $ZLIB_PREFIX/include/
cp libz.a $ZLIB_PREFIX/lib/
cp libz.dll.a $ZLIB_PREFIX/lib/
Bzip2 1.0.6
This is a high-quality data compressor. Download the file
bzip2-1.0.6.tar.gz
from http://www.bzip.org into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/bzip2-1.0.6.tar.gz
cd $SRC_DIR/bzip2-1.0.6
make -f Makefile
gcc -shared -Wl,--out-implib,libbz2.dll.a -o libbz2.dll blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o mkdir -p $BZIP2_PREFIX/bin
mkdir -p $BZIP2_PREFIX/include
mkdir -p $BZIP2_PREFIX/lib cp bzip2 $BZIP2_PREFIX/bin/bzip2.exe
cp libbz2.dll $BZIP2_PREFIX/bin/
cp bzlib.h $BZIP2_PREFIX/include/
cp libbz2.a $BZIP2_PREFIX/lib/
cp libbz2.dll.a $BZIP2_PREFIX/lib/libbz2.dll.a
Libtool 2.4.2
GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface. Download the file
libtool-2.4.2.tar.gz
from http://www.gnu.org/software/libtool/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR tar -xf $GLOBAL_SRC_DIR/libtool-2.4.2.tar.gz
cd $SRC_DIR/libtool-2.4.2
sh configure prefix=$LIBTOOL_PREFIX --build $MACHTYPE --enable-shared
make -j8
make install
LibXML2 2.9.1
Libxml2 is a XML parser and toolkit developed for the Gnome project. Download the file
libxml2-2.9.1.tar.gz
from http://www.xmlsoft.org/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR tar -xf $GLOBAL_SRC_DIR/libxml2-2.9.1.tar.gz
cd $SRC_DIR/libxml2-2.9.1
sh configure prefix=$LIBXML2_PREFIX --build $MACHTYPE --without-threads --without-python --enable-shared
make # Fails with segmentation fault if compiled with option -j8
make install
LibPNG 1.6.12
This is a library to manpulate files in PNG format. Download the file
libpng-1.6.12.tar.gz
from http://www.libpng.org/pub/png/libpng.html into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/libpng-1.6.12.tar.xz
cd $SRC_DIR/libpng-1.6.12
sh configure prefix=$LIBPNG_PREFIX --build $MACHTYPE --enable-shared
make -j8
make install
LibJPEG v9a
This is a library to manpulate files in Jpeg format. Download the file
jpegsrc.v9a.tar.gz
from http://www.ijg.org into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/jpegsrc.v9a.tar.gz
cd $SRC_DIR/jpeg-9a
sh configure prefix=$LIBJPEG_PREFIX --build $MACHTYPE --enable-shared
make -j8
make install
LibTIFF 4.0.3
This is a library to manpulate files in TIFF format. Download the file
tiff-4.0.3.tar.gz
from ftp://ftp.remotesensing.org/pub/libtiff/ into $GLOBAL_SRC_DIR directory.
The latest library archive has some compatibility issues with the tar command shipped with MSYS. Use the following syntax to extract the archive and ignore the errors.
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/tiff-4.0.3.tar.gz 2> /dev/null || /bin/true
cd $SRC_DIR/tiff-4.0.3/
sh configure –-prefix=$LIBTIFF_PREFIX --build $MACHTYPE --enable-shared
make -j8
make install
Freetype 2.5.3
This is a software font engine. Download the file
freetype-2.5.3.tar.gz
from http://download.savannah.gnu.org/releases/freetype/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/freetype-2.5.3.tar.gz
cd $SRC_DIR/freetype-2.5.3
sh configure prefix=$FREETYPE2_PREFIX --build $MACHTYPE --enable-shared
make -j8
make install
Lcms2 2.6
This is a color management engine based on International Color Consortium (ICC). Download the file
lcms2-2.6.tar.gz
from http://sourceforge.net/projects/lcms/files/lcms/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/lcms2-2.6.tar.gz
cd $SRC_DIR/lcms2-2.6
sh configure prefix=$LCMS2_PREFIX --build $MACHTYPE --enable-shared
make -j8
make install
FFTW 3.3.4
This is a library implementing the Fast Fourier Transform. Download the file
fftw-3.3.4.tar.gz
from ftp://ftp.fftw.org/pub/fftw/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/fftw-3.3.4.tar.gz
cd $SRC_DIR/fftw-3.3.4/
sh configure prefix=$FFTW_PREFIX --build $MACHTYPE --enable-shared --disable-static
make -j8
make install
Graphics Magick 1.4.020140831
Download the snapshot
GraphicsMagick-1.4.020140831.tar.xz
from ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/snapshots/ into $GLOBAL_SRC_DIR directory.
Using the following commands we will compile Graphics Magick in both Q8 and Q16 version (see below)
Compile and install Graphics Magick with Quantum Depth 8 and store the compiled libraries in the diretory gm-q8
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/GraphicsMagick-1.4.020140831.tar.xz
cd $SRC_DIR/GraphicsMagick-1.4.020140831
sh configure prefix=$GMQ8_PREFIX --build $MACHTYPE --enable-shared --disable-static --with-quantum-depth=8 --without-perl --disable-installed
make -j8
make install
Compile and install Graphics Magick with Quantum Depth 16 and store the compiled libraries in the diretory gm-q16
make clean
sh configure prefix=$GMQ16_PREFIX --build $MACHTYPE --enable-shared --disable-static --with-quantum-depth=16 --without-perl --disable-installed
make install
Note: pay a lot of attention to the optionS
–with-quantum-depth=8
–with-quantum-depth=16
This means that Graphics Magick will manipulate all images using 8 bits or 16 bits per channel. The 8 bits per channel version is of course faster and use less memory.
Note: the option
--disable-uninstalled
causes the line
#define UseInstalledMagick 1
to be commented out from the following file.
/magick/magick_config.h
This compiles GraphicsMagick without hardcoded paths. If you don't add this option, some programs built with GraphicsMagick will stop working as soon as you delete the Toochain directory or you install the program in a brand new machine.
Notes: to debug GraphicsMagick add the following environment variable, useful to understand where GraphicsMagick searches for defaults configuration files during a command execution.
export MAGICK_DEBUG=configure
To test if Graphics Magick has been correctly compiled, open the MSYS console and run the following commands
gm -version
gm convert -list resources
The first commands should return the following info
Feature Support:
Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP yes
DPS no
FlashPix no
FreeType yes
Ghostscript (Library) no
JBIG no
JPEG-2000 no
JPEG yes
Little CMS yes
Loadable Modules yes
OpenMP yes (200805)
PNG yes
TIFF yes
TRIO no
UMEM no
WMF no
X11 no
XML yes
ZLIB yes
I also recommend to run the command "make check" to run all Graphics Magick tests.
make check
Image Magick 6.8.9-7
Download the file
ImageMagick-6.8.5-3.tar.xz
from any of the mirros listed here http://www.imagemagick.org/script/download.php into $GLOBAL_SRC_DIR directory.
Image Magick compiles exactly like GraphicsMagick with one single exception: it fails randomly when using the make option -j8
Compile and install Image Magick with Quantum Depth 8 and store the compiled libraries in the diretory im-q8
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/ImageMagick-6.8.9-7.tar.xz
cd $SRC_DIR/ImageMagick-6.8.9-7
sh configure prefix=$IMQ8_PREFIX --build $MACHTYPE --enable-shared --disable-static --with-quantum-depth=8 --without-perl --disable-installed
make -j8 CFLAGS="-L$ZLIB_PREFIX/lib -L$BZIP2_PREFIX/lib -I$FREETYPE2_PREFIX/include/freetype2"
make install
Compile and install Image Magick with Quantum Depth 16 and store the compiled libraries in the diretory im-q16
make clean sh configure prefix=$IMQ16_PREFIX --build $MACHTYPE --enable-shared --disable-static --with-quantum-depth=16 --without-perl --disable-installed
make -j8 CFLAGS="-L$ZLIB_PREFIX/lib -L$BZIP2_PREFIX/lib -I$FREETYPE2_PREFIX/include/freetype2"
make install
Boost 1.57
Boost is a standard C++ library with a lot of interesting cross-platform functionalities: smart pointers, filesystem access, etc. Compiling 1.57 with MSYS requires a small patch. Put the patch file into
/local64/src/compile/boost-1.57-bootstrap.patch
I thank the people behind http://nuwen.net/mingw.html who wrote the patch.
Download the file
boost_1_57_0.tar.gz
from http://www.boost.org into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/boost_1_57_0.tar.gz 2> /dev/null || /bin/true
cd $SRC_DIR/boost_1_57_0
patch -d $SRC_DIR/boost_1_57_0 -p1 < $SRC_DIR/compile/patch/boost-1.57-bootstrap.patch
sh bootstrap.sh --with-toolset=mingw
The bootstrap command builds the tools b2.exe and bjam.exe that are used to compile Boost. The two files are identical but in recent distribution of Boost the file bjam.exe has been renamed into b2.exe.
Run the following command
b2 -j4 --prefix=$BOOST_PREFIX --disable-filesystem2 --without-context --without-coroutine --without-python toolset=gcc /
address-model=64 variant=release link=shared threading=multi pch=off install
Finally run the following commands to move all dll files into the bin directory to complain with the standard build structure.
mkdir $BOOST_PREFIX/bin
mv $BOOST_PREFIX/lib/*.dll $BOOST_PREFIX/bin
The option
--disable-filesystem2
is used to disable the compilation of a deprecated filesystem API.
From Boost documentation the new module Context requires MASM64 (ml64.exe) that is a part of Microsoft's Windows Driver Kit. See
http://www.boost.org/doc/libs/1_56_0/libs/context/doc/html/context/requirements.html
You can either download it or simply disable the compilation of the Context module using the option
--without-context
Same story with the coroutine module.
Botan 1.10.9
Botan is a BSD-licensed crypto library for C++. In order to configure Botan you must install either Python 3.3.2 or 2.7.
Download the file
Botan-1.10.9.tgz
from http://botan.randombit.net/download.html into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/Botan-1.10.9.tgz
cd Botan-1.10.9
If you are using a 64 compiler run the following command
python configure.py --prefix=$BOTAN_PREFIX --cc=gcc --os=mingw --cpu=x86_64
If you are using a 32 compiler run the following command
python configure.py --prefix=$BOTAN_PREFIX --cc=gcc --os=mingw --cpu=i386
Then run the following. This is not required with Python 2.7, only with Python 3.3, but it doesn't harm to run it anyway.
sed 's#\\\(.\)#/\1#g' Makefile > Makefile.tmp # Fix an issue with incorrect python path separator in Windows
mv Makefile.tmp Makefile
make -j8
make install
The "sed" command is used to fix an issue with the python configuration script when run using mingw. This procedure will create a quite big static library and, if you want to reduce its size, you must specify the modules to compile using a command like the following one.
The option "--link-method=copy" seems to fix some issues when compiling the code on Windows 8.
python configure.py --prefix=/mingw/local --cc=gcc --os=mingw --cpu=x86_64 --no-autoload --link-method=copy --enable-modules=aes,/
algo_base,algo_factory,auto_rng,base64,bigint,datastor,emsa4,engine,/
filters,hash,hex,hmac,hmac_rng,if_algo,kdf,keypair,libstate,mac,md5,/
mdx_hash,mgf1,mode_pad,pbe,pbkdf,pem,pk_filts,pubkey,randpool,rng,rsa,/
sha1_sse2,sha2_32,sha2_64,win32_crit_section,win32_stats
Important: If you want to build a shared DLL and an import library type the following commands inside the Botan source directory
g++ -shared -o libbotan-1.10.dll -Wl,--out-implib=libbotan-1.10.dll.a -Wl,--export-all-symbols -Wl,--add-stdcall-alias \
-Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc build/lib/*.o
cp libbotan-1.10.dll $BOTAN_PREFIX/bin
cp libbotan-1.10.dll.a $BOTAN_PREFIX/lib
Open SSL 1.0.1h
This is required to compile Qt 5.3.2. Download the file
openssl-1.0.1h.tar.gz
from http://www.openssl.org/ and copy it into the directory $GLOBAL_SRC_DIR. Open a MSYS terminal and run the following commands:
cd $SRC_DIR
tar -zxvf $GLOBAL_SRC_DIR/openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
sh Configure --prefix=$OPENSSL_PREFIX no-idea no-mdc2 no-rc5 shared mingw64
Then run the following commands. Do not add the option -j8 to make otherwise you will experience random failures.
make depend
make
make install
ICU4c 54
ICU4c is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support for software applications.
This is required to compile Qt 5.3.2. Download the source file
icu4c-54_1-src.zip
from http://download.icu-project.org/files/icu4c/54.1/ and copy it into the directory $GLOBAL_SRC_DIR. Open a MSYS terminal and run the following commands:
cd $SRC_DIR
unzip $GLOBAL_SRC_DIR/icu4c-54_1-src.zip
cd icu/Source
sh configure --prefix=$ICU_PREFIX --build $MACHTYPE
make
make install
mv $ICU_PREFIX/lib/*.dll $ICU_PREFIX/bin
gperf 3.0.4
GNU gperf is a perfect hash function generator. For a given list of strings, it produces a hash function and hash table, in form of C or C++ code, for looking up a value depending on the input string.
This is required to compile Qt 5.3.2. Download the source file
gperf-3.0.4.tar.gz
from http://www.gnu.org/software/gperf/ and copy it into the directory $GLOBAL_SRC_DIR. Open a MSYS terminal and run the following commands:
cd $SRC_DIR
tar xf $GLOBAL_SRC_DIR/gperf-3.0.4.tar.gz
cd gperf-3.0.4
sh configure --prefix=$GPERF_PREFIX --build $MACHTYPE
make -j8
make install
Qt 5.4 (without WebKit)
Note: If you don't want to compile QT you can download a precompiled version from here: http://www.tver-soft.org/qt64
Please note that, as explained earlier, you need Perl 64 bits installed first otherwise the configure command will complain about some missing header files. The Qt distribution can be downloaded from Nokia at http://download.qt.io/official_releases/qt/5.4/5.4.0/single/
Download the file
qt-everywhere-opensource-src-5.4.0.tar.xz
into $GLOBAL_SRC_DIR directory. Open a MSYS console and run the following commands to reset all Qt related environment variables that we set by default in the configuration file. This step is absolutely required to compile Qt.
export QMAKESPEC=$QT_SRC_DIR/qtbase/mkspecs/win32-g++/
export QTDIR=
export QT_PLUGIN_PATH=
export QT_PRIVATE_HEADERS=
export LANG=
Then run the following commands to start a build inside the same directory
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/qt-everywhere-opensource-src-5.4.0.tar.xz 2> /dev/null || /bin/true
cd $QT_SRC_DIR
Finally run the configuration procedure and build
sh $QT_SRC_DIR/configure -v -prefix $QT_PREFIX -opensource -confirm-license -platform win32-g++ -shared -release /
-opengl desktop -c++11 -skip webkit -openssl -icu -nomake tests sh $QT_SRC_DIR/configure -v -prefix $QT_PREFIX -opensource -confirm-license -platform win32-g++ -shared -release / -skip webkit -opengl desktop -c++11 -openssl -icu -nomake tests
Run the mingw make command
mingw32-make
mingw32-make install
Warning: do not use -j option when compiling Qt as it generate rare and random errors. Because of this limitation compiling Qt requires several hours.
An additional and important step is still required for a working Qt environment and for qmake to function properly: you have to create a qt.conf file inside the $QT_PREFIX/bin directory with the following content:
[Paths]
Prefix=..
Eventualy, to have a properly working Qt environment you need to set the following variables that have been reset before the compliation.
export QMAKESPEC=$QT_PREFIX/mkspecs/win32-g++/
export QTDIR=$QT_PREFIX
export QT_PLUGIN_PATH=$QT_PREFIX/plugins
export QT_PRIVATE_HEADERS=$QT_PREFIX/include
export LANG=en_US
designer.exe
To compile and install the documentation run the following commands. Find and sed command are used to fix a path problem when compiling with MSYS
cd $QT_SRC_DIR
find . -type f -name 'Makefile*' -print0 | xargs -0 sed -i 's,\\local64\\dst\\qt\\bin\\,/local64/dst/qt/bin/,'
make docs # For some reason mingw32-make doesn't work when building the documentation.
make install_docs
Once the docs are installed run the assistant and check if the documentation is available
assistant.exe
Qt Creator 3.2.1 for Qt 5.4
Download the file
qt-creator-opensource-src-3.2.1.tar.gz
from http://download.qt-project.org/official_releases/qtcreator/3.2/3.2.1/
into $GLOBAL_SRC_DIR directory. Be sure you have the Qt environment correctly configured as explained in the previous paragraph, the file qt.conf in place and the variable QT_CREATOR_PREFIX set. Open a MSYS terminal and run the following commands to properly configured all Qt
cd $SRC_DIR
tar xf $GLOBAL_SRC_DIR/qt-creator-opensource-src-3.2.1.tar.gz 2> /dev/null || /bin/true
cd $SRC_DIR/qt-creator-opensource-src-3.2.1
mkdir build
cd build
qmake ../qtcreator.pro -r CONFIG+=release
mingw32-make release
mingw32-make install INSTALL_ROOT=$QT_CREATOR_PREFIX
To check if qtcreator has been compiled and istalled properly tyoe the command
qtcreator.exe
OpenCV 2.4.9
OpenCV is a powerful set realtime image processing libraries. You need to download the following file from the GIT repository in zip format
opencv-2.4.9.zip
from https://github.com/Itseez/opencv/archive/2.4.9.zip into $GLOBAL_SRC_DIR directory and using a MSYS terminal run the following commands. Please note that we need CMake installed. OpenCV supports both Python 3 and 2.7.
cd $SRC_DIR
unzip $GLOBAL_SRC_DIR/opencv-2.4.9.zip
cd $SRC_DIR/opencv-2.4.9
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=$OPENCV_PREFIX -D CMAKE_SH=/mingw/msys/bin/sh.exe \
-D CMAKE_CXX_COMPILER=$MINGW_HOME/bin/g++.exe -D CMAKE_C_COMPILER=$MINGW_HOME/bin/gcc.exe \
-D CMAKE_MAKE_PROGRAM=$MINGW_HOME/bin/mingw32-make.exe -D CMAKE_RC_COMPILER=$MINGW_HOME/bin/windres.exe \
-D CMAKE_LINKER=$MINGW_HOME/bin/ld.exe -G "MinGW Makefiles" $SRC_DIR/opencv-2.4.9
mingw32-make -j8
mingw32-make install
To develop with OpenCV you may need a configuration file for pkg-config. Download the file opencv.pc (this is for the 64 bits toolchain) and save it into the directory
$OPENCV_PREFIX/lib/pkgconfig/
libffi 3.0.13
FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. Download the file
libffi-3.0.13.tar.gz
from http://sourceware.org/libffi/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/libffi-3.0.13.tar.gz
cd libffi-3.0.13
sh configure --prefix=$LIBFFI_PREFIX --host=x86_64-w64-mingw32
The run the following commands
make -j8
make install
gettext 0.18.3
This is a set of tools that provides a framework to help other GNU packages produce multi-lingual messages. Download the file
gettext-0.18.3.tar.gz
from http://www.gnu.org/software/gettext/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/gettext-0.18.3.tar.gz
cd gettext-0.18.3
sh configure --prefix=$GETTEXT_PREFIX --build=x86_64-w64-mingw32 --enable-threads=win32 \
--enable-relocatable
The run the following commands
cd gettext-runtime
make -j8
make install
glib 2.43.2
Download the file
glib-2.43.2.tar.xz
from http://ftp.gnome.org/pub/GNOME/sources/glib/2.43/ into $GLOBAL_SRC_DIR directory. Open a MSYS terminal and run the following commands
cd $SRC_DIR
tar -xf $GLOBAL_SRC_DIR/glib-2.43.2.tar.xz
cd glib-2.43.2
sh configure --prefix=$GLIB_PREFIX --build=x86_64-w64-mingw32 --with-threads=win32 \
--with-pcre=internal --disable-debug --disable-gtk-doc
The run the following commands
make -j8
make install
CREDITS
I want to thank the Photivo team for their documentation and key suggestions, Bob Friesenhahn of Graphics Magick and Ruben of MinGW64 for their help. Thanks to Ingar Satgnu for his guide about installing the latest MSYS tools and configuring the Toolchain to allow both 32 and 64 bits compilers.
Photivo - http://photivo.org
Graphics Magick - http://www.graphicsmagick.org
MinGW-w64 - http://mingw-w64.sourceforge.net
Ingar Satgnu - http://ingar.satgnu.net/devenv/mingw32/index.html
ASCEND - http://ascend4.org/Setting_up_a_MinGW-w64_build_environment
EXTERNAL LINKS
Tver-Soft.org - http://www.tver-soft.org/qt64
DOCUMENT LOG
01 February 2015 - Big upgrade from MSYS to MSYS2, few changes to installation procedure and configuration files. Now compiling with MinGW 64 toolchain with gcc 4.9.2 (C++14). Qt 5.4 without WebKit, Boost 1.57.
08 October 2014 - Using new Toolchain Ming Builds for 64 bits - in this document I won't support 32 bits architectures anymore. The new Toolchain is quite important and requires modifications in most configuration file. Update of CMake 3.0.2 now installed into a different directory. Update to Python 2.7.8, Scons 2.3.3, Ruby 2.3.1, libpng 1.6.3, libjeg 9a, libtif 4.0.3, Freetyle 2.5.3, lcms 2.6, GraphicsMagick 1.4.020140831, Image Magick 6.8.9-7, Boost 1.56, Open SSL 1.0.1h, ICU4c 54, OpenCV 2.4.9, latest Flex-Bison, QT 5.3.2 (without Webkit - If anybody is able to compile WebKit please contact me), Qt Creator 3.2.1.
08 January 2014 - Updated the following software: Boost 1.55, Botan 1.10.7, Qt 5.2.0, Qt 3.0.0, GraphicMagick 1.4.020140101, OpenCV 2.4.8, GLib 2.39.2. Rollback to Python 2.7 to support SCons. Small update to profile.local for both 32 and 64 toolchains.
13 September 2013 - Added an option to Botan configure command to fix an issue when compiling on Windows 8. Fixed few syntax errors and added a note regarding -j option on Window 8. Thanks Steve Dewey for the feedback. Updated Qt to version 5.1.1 and GraphicsMagick to build 1.4.020130908.
14 August 2013 - Fixed incorrect pkgconfig path in configuration files. Updated GraphicsMagick to build 1.4.020130810. Updated gettext to version 0.18.3. Added compilation instructions for libffi 3.0.13 and glib 2.34.3.
11 August 2013 - Updated OpenSSL to version 1.0.1e and ICU to version 51.2. Added some important notes to configure a properly working Qt 5.1 environment. Added compilation instructions for Qt Creator 2.8.0.
08 August 2013 - Added Win Flex-Bison software for MSYS required to compile Qt 5.1 WebKit. Added instrution to compile OpenSSL, ICU and gperf required by Qt 5.1.
05 August 2013 - Compilation instructions for Qt 5.1. Relocation of Perl 64 bits and Python 64 bits into the toolchain. Installation of Ruby 64 bits required by Qt 5.1. Configuration files rewritten to clearly separate the building environment from the system environment and to simplify the compilation of Qt 5.1 in both 32 and 64 bits. Added a patch to MinGW 32 bits compiler to fix a compilation problem with Qt 5.1. Updated compilation instructions for libxml and ImageMagick.
31 July 2013 - All source code is now stored into a common position $GLOBAL_SRC_DIR and the same one is used to compile both 32 and 64 bits versions of all libraries. The procedure described in the document has now been tested with the following new libraries: pkg-config-lite 0.28-1, zlib 1.2.8, libxml2 2.9.1, libpng 1.6.3, jpeg v9, freetype 2.5.0, lcms2 2.5, fftw 3.3.3.
30 July 2013 - Now using Active Perl 5.16.3 and Python 3.3.2. Updated compilation instructions for OpenCV 2.4.6.1.
27 July 2013 - Patch and compilation instructions for Boost 1.54.
29 April 2013 - Latest Ruben toolchain with gcc 4.8. Updated compilation instructions (added option pch=off) for Boost 1.53. Updated the following libraries: Open CV 2.4.5, GraphicsMagick 1.4.020130420, ImageMagick 6.8.5-3.
13 March 2013 - New versions of Graphics Magick 1.4.020130303, Image Magick 6.8.3-9, Boost 1.53 and Open CV 2.4.4. Added some notes regarding the correct version of Python to use, preferably 2.7.
24 December 2012 - Dll files produced during boost compilation are now moved into a bin directory to complain with standard structure.
07 December 2012 - Installation of latest MSYS. Toolchain structure fully reviewed to allow both 32 and 64 bits compilers at the same time. Built packages now installed into separate directories. New packages added: OpenCV, pkg-config and gettext.
28 November 2012 - All documentation is now focused on MingW64 Ruben toolchain with gcc 4.7.2. Updated the following libraries: Boost 1.52, Graphics Magick snapshot 1.4.020121119, Qt 4.8.3. Added compiling instructions for Image Magick 6.8.0-7.
05 October 2012 - Latest Ruben toolchain release with gcc 4.7.2. Updated the following libraries: Boost 1.51, lcms2-2.4, libpng-1.5.13, libxml2-2.9.0, tiff-4.0.3, Qt 4.8.2, Graphics Magick snapshot 1.4.020120930. Graphics Magick now compiled in both Q8 and Q16 version.
19 June 2012 - Botan 1.10.2 now working with Python 3.2.3 even though path separators still requires fix.
18 June 2012 - Added compilation instructions for BZip2, Libtool, LibXML2 and FreeType. Updated the following libraries: Botan 1.10.2, Jpeg v.8d, libPNG 1.5.11, libXML2 2.8.0, libTiff 4.0.2, zlib 1.2.7, GraphicsMagick build 1.4.020120616.
21 May 2012 - Latest Ruben toolchain release and Graphics Magick build 1.4.020120516.
25 April 2012 - New Ruben toolchain with GCC 4.7, Qt 4.8.1 and CMake 2.8.8.
20 April 2012 - New libraries libpng 1.5.10 and boost 1.49.0. Using now GraphicsMagick build 1.4.020120419.
23 February 2012 - New libraries libpng 1.5.9 and libtiff 4.0.1. Using now GraphicsMagick build 1.4.020120219.
07 February 2012 - New libraries zlib 1.2.6 and libpng 1.5.8. Patches for zlib no longer required. Using now GraphicsMagick build 1.4.020120205.
http://www.kineticsystem.org/mingw
Compile Graphics Magick, Boost, Botan and QT with MinGW64 under Windows 7 64的更多相关文章
- windows 10 上源码编译boost 1.66.0 | compile boost 1.66.0 from source on windows 10
本文首发于个人博客https://kezunlin.me/post/854071ac/,欢迎阅读! compile boost 1.66.0 from source on windows 10 Ser ...
- How to compile pycrypto 2.4.1 (python 3.2.2 for Windows 7 x64)
How to compile pycrypto 2.4.1 (python 3.2.2 for Windows 7 x64) Nov 10 Posted by alesk This note is a ...
- QT + OpenCV + MinGW 在windows下配置开发环境
由于研究项目需要,最近开始接触C++界面设计,关于“QT + OpenCV + MinGW在windows下配置开发环境”着实让人头疼,单次配置时间相当长,也十分不容易,本人第一次配置成 ...
- Qt 学习之路 2(64):使用 QJsonDocument 处理 JSON
Home / Qt 学习之路 2 / Qt 学习之路 2(64):使用 QJsonDocument 处理 JSON Qt 学习之路 2(64):使用 QJsonDocument 处理 JSON 豆子 ...
- Qt开发程序在Windows 10应用须要管理员执行的解决思路
Qt开发程序在Windows 10应用须要管理员执行的解决思路 过了非常长的时间没有公布博客了.可是我依旧努力地开发Qt程序.眼下呢.我发现开发Qt程序在Windows 10上有一个怪现象--有些程序 ...
- Qt开发环境搭建 - Windows + VS2010 + VS插件
Qt 开发环境搭建 - Windows+VS2010+VS插件 1.Qt在Windows平台下的三种开发环境 方案 编辑器 编译器 调试器 一 Qt Creator MinGW GDB 二 Qt Cr ...
- Linux下编译boost库和qt和ImageMagick
需要把整个PCIE的工程移植到Linux下,当初就是用cmake来管理的工程的.但是命令行之类的还是需要改动.改动还不少,cmake里面很多东西都依赖于windows.包括我用cmake重新管理的工程 ...
- Create a Qt Widget Based Application—Windows
This turtorial describes how to use Qt Creator to create a small Qt application, Text Finder. It is ...
- Qt from Linux to Windows target
45down voteaccepted Just use M cross environment (MXE). It takes the pain out of the whole process: ...
随机推荐
- c编程:僵尸吃大脑
第一行输入一个正整数n 以下每一行输入僵尸已经吃了的大脑数量a,和需要生存必需要吃的大脑数量b.总共n行. 例子输入 3 4 5 3 3 4 3 例子输出 NO BRAINS MMM BRAINS M ...
- js进阶 13-11/12 jquery如何实现折叠导航
js进阶 13-11/12 jquery如何实现折叠导航 一.总结 一句话总结:还是用的slideToggle滑动效果,并且这一个展开时,所有兄弟都关闭. 1.文字缩进怎么设置? 感觉设置margin ...
- js进阶 13-8 jquery如何实现侧边栏
js进阶 13-8 jquery如何实现侧边栏 一.总结 一句话总结:先是把侧边栏设置为left为-100px,隐藏起来,jquery自定义动画animate里面的改变元素的距左边的宽度left,sl ...
- 区分json与jsonp
JSON(JavaScript Object Notation)和JSONP(JSON with Padding)虽然只有一个字母的差别,但其实他们根本不是一回事儿,下边简单区分概括一下: JSON是 ...
- (转) 通过UUID在vSphere虚拟机内外识别硬盘
转自:http://ju.outofmemory.cn/entry/28398 简单介绍下应用场景:开发基于虚拟化IaaS的一些应用就免不了要跟虚拟机(VM)打交道,因为VM逻辑上独立于宿主机(hos ...
- xxxyyy
https://www.gaojinan.com/vps-o p e n v p n-china-telecom-unicom-mobile-mianliu-ml.html
- [ACM] ural 1057 Amount of degrees (数位统计)
1057. Amount of Degrees Time limit: 1.0 second Memory limit: 64 MB Create a code to determine the am ...
- usart和uart 的区别
摘自:https://blog.csdn.net/meic51/article/details/7714847 什么是同步和异步 转自https://blog.csdn.net/seashine_ya ...
- strace跟踪线程调用
方法一:strace -fp pid , 可以跟踪所有线程, 进程的系统调用. [root@xxxx]strace -p 24091 Process xxx attached - interrupt ...
- mysql 查询重复 去除重复等等
查找所有重复标题的记录: SELECT * FROM t_info a WHERE ((SELECT COUNT(*) FROM t_info WHERE Title = a.Title) > ...