Skip to content

Instantly share code, notes, and snippets.

@aborruso
Last active November 5, 2017 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aborruso/ba04d8cdf65cc5203e830c54f3714a5f to your computer and use it in GitHub Desktop.
Save aborruso/ba04d8cdf65cc5203e830c54f3714a5f to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta name="robots" content="index,follow">
<meta name="description" content="mingw how-to">
<title>MinGW (64 bit) how-to</title>
<style type="text/css">
h3 {color:blue;}
h4 {color:red;}
b {color:brown;}
b.cmd {color:navy; font-family:monospace;}
b.err {color:red; font-family:monospace;}
u {color:green;}
i {color:navy;}
td.msw {font-family:monospace;}
b.td {font:red; }
</style>
</head><body bgcolor="#fffff0">
<table width="100%" bgcolor="#ddffdd"><tr><th>last updated: 2017-10-07</th></tr></table>
Back to the <a href="http://www.gaia-gis.it/gaia-sins/index.html">Gaia-SINS</a> home page
<h3>Index of contents</h3>
<ul>
<li><a href="#env">the MinGW64 + MSYS2 environment</a></li>
<li><a href="#libiconv">Step 1) building libiconv</a></li>
<li><a href="#libz">Step 2) building libz</a></li>
<li><a href="#libjpeg">Step 3) building libjpeg</a></li>
<li><a href="#libpng">Step 4) building libpng</a></li>
<li><a href="#liblzma">Step 5) building XZ (liblzma)</a></li>
<li><a href="#libtiff">Step 6) building libtiff</a></li>
<li><a href="#libproj">Step 7) building libproj</a></li>
<li><a href="#libgeotiff">Step 8) building libgeotiff</a></li>
<li><a href="#libgeos">Step 9) building libgeos</a></li>
<li><a href="#libexpat">Step 10) building libexpat</a></li>
<li><a href="#freexl">Step 11) building FreeXL</a></li>
<li><a href="#readosm">Step 12) building ReadOSM</a></li>
<li><a href="#libsqlite">Step 13) building libsqlite</a></li>
<li><a href="#open-ssl">Step 14) building OpenSSL</a></li>
<li><a href="#postgres">Step 15) building PostgreSQL</a></li>
<li><a href="#libxml2">Step 16) building libxml2</a></li>
<li><a href="#librttopo">Step 17) building librttopo</a></li>
<li><a href="#libspatialite">Step 18) building libspatialite</a></li>
<li><a href="#spatialite-tools">Step 19) building spatialite-tools</a></li>
<li><a href="#wxWidgets">Step 20) building wxWidgets MSW</a></li>
<li><a href="#libfreetype">Step 21) building libfreetype</a></li>
<li><a href="#libfontconfig">Step 22) building libfontconfig</a></li>
<li><a href="#libpixman">Step 23) building libpixman</a></li>
<li><a href="#libcairo">Step 24) building libcairo</a></li>
<li><a href="#giflib">Step 25) building giflib</a></li>
<li><a href="#libwebp">Step 26) building libwebp</a></li>
<li><a href="#CharLS">Step 27) building CharLS</a></li>
<li><a href="#lcms2">Step 28) building lcms2</a></li>
<li><a href="#OpenJpeg">Step 29) building OpenJpeg-2</a></li>
<li><a href="#libcurl">Step 30) building libcurl</a></li>
<li><a href="#librasterlite2">Step 31) building librasterlite2</a></li>
<li><a href="#spatialite-gui">Step 32) building spatialite_gui</a></li>
<li><a href="#librewms">Step 33) building LibreWMS</a></li>
<li><a href="#minizip">Step 34) building minizip</a></li>
<li><a href="#libcgi">Step 35) building libgci</a></li>
<li><a href="#dataseltzer">Step 36) building DataSeltzer</a></li>
<li><a href="#gdal">Step 37) building GDAL</a></li>
<li><a href="#fossil">Step 38) building fossil</a></li>
</ul>
<hr>
<h3><a name="env">the MinGW64 + MSYS2 environment</a></h3>
<b>MinGW64</b> is an <i>open source</i> C/C++ compiler for WIndows platforms
based on the popular <b>gcc</b> available on Linux and on many other Operating Systems;
Mingw64 can create both 32 and 64 bit binary executables.<br>
<b>MSYS2</b> is a command shell supporting a minimalistic Linux-like
environment on Windows.<br>
Using both them you can build standard open source software [<i>originally
developed for Linux</i>] under
Windows as well, simply using the <i>classic</i> build tool-chain, as
in:<br><br>
<b>./configure</b><br>
<b>make</b><br>
<b>make install</b><br><br>
Quite obviously, Windows isn't exactly the same as Linux, so you cannot
expect to get always an easy and painless build.<br>
May well be you have to adapt something here and there in order to get a
successful build under Windows.<br>
The following notes are aimed exactly to this goal: allow you to avoid
wasting your time while fighting against
oddities that can quite easily solved.<br><br>
<table width="100%" bgcolor="#ddffdd" cellpadding="16"><tr><th>
<b>Important notice</b>: all the following instructions require using the most recent versions of the compiler (i.e. <b>gcc 6.3.0</b>).<br><br>
In order to check the actual version you are using, you simply have to execute the following command: <b>gcc --version</b>
</th></tr></table><br><br>
The most recent versions of MinGW64 and MSYS2 are reasonably easy to install; just follow the instructions below.<br>
<h3>Installing MSYS2</h3>
<ol>
<li>download the MSYS2 intaller from <a href="http://www.msys2.org/">here</a></li>
<li>start the installer: I suggest you to set <b>C:/dev/msys64</b> as the base installation path.</li>
<li>once MSYS2 has been installed you must complete several further steps.<br>
Please follow the instructions you can find <a href="https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&-MSYS2">here</a></li>
<li><b>Note</b>: MSYS2 is a common shell environment supporting both the 32 bit and the 64 bit compilers, so you have to perform this step just once.</li>
</ol>
<h3>Familiarizing with <b>pacman</b></h3>
After properly installing MSYS2 you'll be able to use <b>pacman</b> in order to complete your installation.<br>
Pacman is a package manager similar to Red Hat's <b>yum</b> and Debian's <b>apt-get</b>, and will make really easy the task to prepare a complete build environment.<br>
<ol>
<li>Start an MSYS2 shell.<br>
Just click the icon of one between <b>msys2.exe</b>, <b>mingw32i.exe</b> or <b>mingw64.exe</b> you'll find into the <b>C:\dev\msys64</b> folder (the one or the other is not relevant in this context).</li>
<li>Then execute the following commands from the shell:
<ul>
<li><b>pacman -S --needed base-devel</b><br>
This will install <b>make</b>, <b>pkg-config</b> and many others useful tools.</li>
<li><b>pacman -S --needed mingw-w64-i686-toolchain</b><br>
This will install the <b>32 bit</b> compiler.</li>
<li><b>pacman -S --needed mingw-w64-x86_64-toolchain</b><br>
This will install the <n>64 bit</b> compiler.</li>
<li><b>pacman -S --needed mingw-w64-i686-cmake mingw-w64-x86_64-cmake</b><br>
This will install <b>CMake</b> for both 32 and 64 bit.</li>
</ul></li>
<li>all right: you've now completed your MinGW64 + MSYS2 installation, and you are ready to start building your Windows binary executables.</li>
</ol>
<b>Note</b>: may well be you'll discover before or after that some tool is still missing.
You can easily install it when required.<br>
Example: the well known <b>vim</b> text editor is still missing; you can easily install it by executing:
<b>pacman -S vim</b><br>
Hint: you can easily check all packages declaring a matching name and if they are already installed or not by executing:
<b>pacman -Ss package-name</b>:<br>
<h3>Understanding the two build environments: <b>mingw32</b> and <b>mingw64</b></h3>
<ul>
<li>the <b>mingw32.exe</b> shell will automatically target the 32 bit compiler.
So you'll simply have to launch <b>ming32</b> in order to build any 32 bit executable.</li>
<li>the <b>C:\dev\msys64\mingw32</b> folder is the base directory for all 32 bit software.
It will be internally mapped by MSYS2 as <b>/mingw32</b></li>
<li>the <b>mingw64.exe</b> shell will automatically target the 64 bit compiler.
So you'll simply have to launch <b>ming64</b> in order to build any 64 bit executable.</li>
<li>the <b>C:\dev\msys64\mingw64</b> folder is the base directory for all 64 bit software.
It will be internally mapped by MSYS2 as <b>/mingw64</b></li>
</ul>
In order to mantain a properly ordered filesystem layout, clearly separating 32 bit and 64 bit components we can't any longer adopt the classic <b>/usr/local</b> target as the standard destination where to install our custom builds.<br>
<ul>
<li><b>/mingw32/local</b><br>
this will be the directory where to install all 32 bit builds.
<li><b>/mingw64/local</b><br>
and this will be the directory where to install all 64 bit builds.
</ul>
<table width="100%" cellspacing="6" cellpadding="8" bgcolor="#e0e090">
<tr><td>
<h3>Very important notice</h3>
The standard configuration adopted by <b>MinGW64</b> forbids to effectively link <b>libpthread</b> as a static library.<br>
You are required to manually apply the following small patch in order to avoid this issue.
<ul>
<li>this patch must be applied twice, once for the 32 bit compiler and once for the 64 bit compiler.</li>
<li>you must edit the <b>/mingw32/i686-w64-mingw32/include/pthread.h</b> header file for the 32 bit compiler.</li>
<li>and/or you must edit the <b>/mingw64/x86_64-w64-mingw32/include/pthread.h</b> header file for the 64 bit compiler.</li>
</ul>
Near line 85:
<table cellpadding="10" bgcolor="#d0d0d0">
<tr><td>
&nbsp;&nbsp;#if defined DLL_EXPORT<br>
&nbsp;&nbsp;#ifdef IN_WINPTHREAD<br>
&nbsp;&nbsp;#define WINPTHREAD_API __declspec(dllexport)<br>
&nbsp;&nbsp;#else<br>
&lt; #define WINPTHREAD_API __declspec(dllimport)<br>
&gt; #define WINPTHREAD_API<br>
&nbsp;&nbsp;#endif<br>
&nbsp;&nbsp;#else<br>
&nbsp;&nbsp;#define WINPTHREAD_API<br>
&nbsp;&nbsp;#endif<br>
</td></tr>
</table>
</td></tr>
</table><br>
<hr>
<h3><a name="libiconv">Step 1) building libiconv</a></h3>
<b>libiconv</b> is the standard <b>GNU</b> library supporting <i>locale
charsets</i>.<br>
Required by: <b>libspatialite</b>, <b>spatialite-tools</b><br><br>
Building under Windows is not too much difficult.
<ul>
<li>download <a href="http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz">libiconv-1.15.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd libiconv-1.15</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
Anyway, this will simply build and install the DLL: a further step is required in order to get the <i>static library</i> as well.<br><br>
<b class="cmd">make distclean</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --disable-shared --enable-static</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
Now you've built and installed both the <i>static library</i> and the DLL.<br>
However the above process has installed badly misconfigured <b>libcharset.la</b> and <b>libiconv.la</b> files<br>
(which are required to build other libraries in the following steps).<br>
So in order to get a properly configured <b>libiconv</b> you have to accomplish a further operation:
<ul>
<li>download <a href="http://www.gaia-gis.it/gaia-sins/mingw64/libiconv.la">libiconv.la</a>
and <a href="http://www.gaia-gis.it/gaia-sins/mingw64/libcharset.la">libcharset.la</a></li>
<li>then copy both files:<br>
<b class="cmd">cp libiconv.la libcharset.la /mingw64/local/lib</b></li>
</ul>
<hr>
<h3><a name="libz">Step 2) building libz</a></h3>
<b>libz</b> is a popular library implementing <i>Deflate</i>, i.e. the
compression algorithm used by <b>gzip</b> and <b>Zip</b>.<br>
Depends on: <b>nothing</b><br>
Required by: <b>libpng</b>, <b>libtiff</b>, ...<br><br>
Building under Windows is quite easy, but requires to pay some
attenction.
<ul>
<li>download the latest sources: <a href="http://zlib.net/zlib1211.zip">zlib1211.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd zlib-1.2.11</b><br>
<b class="cmd">export "INCLUDE_PATH=/mingw64/local/include"</b><br>
<b class="cmd">export "LIBRARY_PATH=/mingw64/local/lib"</b><br>
<b class="cmd">export "BINARY_PATH=/mingw64/local/bin"</b><br>
<b class="cmd">make -f win32/Makefile.gcc</b><br>
<b class="cmd">make install -f win32/Makefile.gcc</b><br>
<b class="cmd">cp libz.dll.a /mingw64/local/lib</b><br>
<b class="cmd">cp zlib1.dll /mingw64/local/bin</b><br><br>
All this will build and install both the <i>static library</i> and the DLL as well.<br>
Anyway this process will not generate the <b>libz.la</b> file (which is required to build <b>libtiff</b> in one
of the following steps.<br>
So in order to get a fully installed <b>libz</b> you have to accomplish a further operation:
<ul>
<li>download <a href="http://www.gaia-gis.it/gaia-sins/mingw64/libz.la">libz.la</a></li>
<li>and then copy this file: <b class="cmd">cp libz.la /mingw64/local/lib</b></li>
</ul>
<hr>
<h3><a name="libjpeg">Step 3) building libjpeg</a></h3>
<b>libjpeg</b> is a popular library supporting the <b>JPEG</b> image
compression.<br>
Depends on: <b>nasm</b> (install it via "pacman -S nasm")<br>
Required by: <b>libtiff</b>, <b>librasterlite2</b><br><br>
Building under Windows is absolutely a plain and easy task.
<ul>
<li>download the latest sources: <a href="http://sourceforge.net/projects/libjpeg-turbo/files/1.5.2/libjpeg-turbo-1.5.2.tar.gz/download">
libjpeg-turbo-1.5.2.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd libjpeg-turbo-1.5.2</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libpng">Step 4) building libpng</a></h3>
<b>libpng</b> is a popular library supporting the <b>PNG</b> image
compression.<br>
Depends on: <b>libz</b><br>
Required by: <b>librasterlite2</b><br><br>
Building under Windows is absolutely a plain and easy task.
<ul>
<li>download the latest sources: <a href="http://prdownloads.sourceforge.net/libpng/libpng-1.6.32.tar.gz?download">libpng-1.6.32.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd libpng-1.6.32</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
<u>Important notice</u>: you have to properly set the shell environment
in order to retrieve the already installed <b>libz</b>;
this is the duty of the two above <u>export</u> directives.<br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="liblzma">Step 5) building XZ (liblzma)</a></h3>
<b>liblzma</b> is a popular library supporting the <b>LZMA</b> advanced
compression (it's a component of the XZ package).<br>
Depends on: <b>nothing</b><br>
Required by: <b>libtiff</b><br><br>
Building under Windows is absolutely a plain and easy task.
<ul>
<li>download the latest sources: <a href="http://tukaani.org/xz/xz-5.2.3.tar.gz">xz-5.2.3.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd xz-5.2.3</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --with-libiconv-prefix=/mingw64/local --with-libintl-prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libtiff">Step 6) building libtiff</a></h3>
<b>libtiff</b> is a popular library supporting the <b>TIFF</b> image
format.<br>
Depends on: <b>libz</b>, <b>liblzma</b>, <b>libjpeg</b><br>
Required by: <b>librasterlite2</b><br><br>
Building under Windows is absolutely a plain and easy task.
<ul>
<li>download the latest sources: <a href="http://download.osgeo.org/libtiff/tiff-4.0.8.zip">tiff-4.0.8.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd tiff-4.0.8</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
<u>Important notice</u>: you have to properly set the shell environment
in order to retrieve the already installed <b>libz</b>;
this is the duty of the two above <u>export</u> directives.<br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libproj">Step 7) building libproj</a></h3>
<b>libproj</b> is a library supporting coordinate's transformation
between different Reference Systems [<b>PROJ.4</b>]<br>
Depends on: <b>nothing</b><br>
Required by: <b>libgeotiff</b>, <b>libspatialite</b>, <b>spatialite-tools</b><br><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://download.osgeo.org/proj/proj-4.9.3.tar.gz">proj-4.9.3.zip</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd proj-4.9.3</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libgeotiff">Step 8) building libgeotiff</a></h3>
<b>libgeotiff</b> is a library supporting the <b>GeoTIFF</b> raster
format<br>
Depends on: <b>libtiff</b>, <b>libproj</b><br>
Required by: <b>librasterlite2</b><br><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.2.zip">libgeotiff-1.4.2.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<u>Important notice</u>: there is a bug in the standard build scripts forbidding
to create a Windows DLL using MinGW64 + MSYS2.<br>
So you have to manually apply the following patch to circumvent this issue.<br>
(many thanks to Alexey Pavlov for suggesting this patch)<br>
Edit the <b>Makefile.in</b> file as follows:<br><br>
<table bgcolor="#ffffe0">
<tbody><tr><td>570c570</td></tr>
<tr><td>&lt; libgeotiff_la_LDFLAGS = -version-info 3:2:1</td></tr>
<tr><td>---</td></tr>
<tr><td>&gt; libgeotiff_la_LDFLAGS = -version-info 3:2:1 -no-undefined</td></tr>
<tr><td><hr></td></tr>
</tbody></table>
Save and exit; now you are ready to build.<br><br>
<b class="cmd">cd libgeotiff-1.4.2</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --with-proj --with-libz --with-jpeg --enable-incode-epsg</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libgeos">Step 9) building libgeos</a></h3>
<b>libgeos</b> is a library representing a <b>C++</b> porting of <b>JTS</b>
[<i>Java Topology Suite</i>].<br>
Depends on: <b>nothing</b><br>
Required by: <b>libspatialite</b>, <b>spatialite-tools</b><br><br>
This library really is an <u>huge and complex</u> piece of software;
<ul>
<li>download the latest sources: <a href="http://download.osgeo.org/geos/geos-3.6.2.tar.bz2">geos-3.6.2.tar.bz2</a></li>
<li>uncompress this bzip2-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd geos-3.6.2</b><br>
<b class="cmd">export "CXXFLAGS=-O3"</b></br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libexpat">Step 10) building libexpat</a></h3>
<b>libexpat</b> is a well known standard library supporting <b>XML parsing</b>.<br>
Depends on: <b>nothing</b><br>
Required by: <b>libfontconfig</b>, <b>spatialite-tools</b>, ...<br><br>
Building under Windows really is a piece-of-cake.
<ul>
<li>download the latest sources: <a href="http://sourceforge.net/projects/expat/files/expat/2.2.5/expat-2.2.5.tar.bz2/download">expat-2.2.5.tar.bz2</a></li>
<li>uncompress this bzip2 -file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd expat-2.2.5</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="freexl">Step 11) building FreeXL</a></h3>
<b>FreeXL</b> is an utility library implementing read-access for Excel (.xls) spreadsheets<br>
Depends on: <b>libiconv</b><br>
Required by: <b>spatialite-tools</b>, <b>libspatialite</b>, <b>spatialite-gui</b><br><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://www.gaia-gis.it/gaia-sins/freexl-1.0.4.zip">freexl-1.0.4.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd freexl-1.0.4</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<u>Please note</u>: if you wish, you can now execute the complete test coverage
in order to verify if your build was fully succesful.<br>
This further step is <u>optional</u> and requires a small extra time,
but it's strongly suggested anyway.<br><br>
<b class="cmd">make check</b><br><br>
<hr>
<h3><a name="readosm">Step 12) building ReadOSM</a></h3>
<b>ReadOSM</b> is an utility library supporting OSM datasets parsing<br>
Depends on: <b>libz</b>, <b>libexpat</b><br>
Required by: <b>spatialite-tools</b><br><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://www.gaia-gis.it/gaia-sins/readosm-1.1.0.zip">readosm-1.1.0.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd readosm-1.1.0</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<u>Please note</u>: if you wish, you can now execute the complete test coverage
in order to verify if your build was fully succesful.<br>
This further step is <u>optional</u> and requires a small extra time,
but it's strongly suggested anyway.<br><br>
<b class="cmd">make check</b><br><br>
<hr>
<h3><a name="libsqlite">Step 13) building libsqlite</a></h3>
<b>libsqlite</b> is the library implementing the <b>SQLite</b> DBMS engine<br>
Depends on: <b>nothing</b><br>
Required by: <b>libspatialite</b>, <b>librasterlite</b><br><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://www.sqlite.org/2017/sqlite-autoconf-3210000.tar.gz">sqlite-autoconf-3210000.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then uncompress the <i>tarball</i></li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd sqlite-autoconf-3210000</b><br>
<b class="cmd">export "CFLAGS=-DSQLITE_ENABLE_STAT3=1 -DSQLITE_ENABLE_TREE_EXPLAIN=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_THREADSAFE=1"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="open-ssl">Step 14) building OpenSSL</a></h3>
<b>OpenSSL</b> is a well known standard library supporting <b>SSL</b>, i.e. the <b>encrypted HTTPS</b> web protocol.<br>
Depends on: <b>nothing</b><br>
Required by: <b>libcurl</b><br><br>
Building under Windows is a little bit difficult, and requires to pay close attention.<br>
The <b>configure</b> script isn't at all a standard one: please read carefully the following instructions.<br>
<ul>
<li>download the latest sources: <a href="https://www.openssl.org/source/openssl-1.1.0g.tar.gz">openssl-1.1.0g.tar.gz</a></li>
<li><u>Important notice:</u> you cannot use tools such as <b>7z</b> to untar the <i>tarball</i>:
this will cause fatal errors during compilation (<i>broken links</i>).<br>
You absolutely have to run all the following commands from the MSYS2 shell.<br>
</ul>
<b class="cmd">tar zxvf openssl-1.1.0g.tar.gz</b><br>
<b class="cmd">cd openssl-1.1.0g</b><br>
<b class="cmd">./Configure mingw64 --prefix=/mingw64/local shared</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install</b><br><br>
This will build and install both the <i>static libraries</i> and the DLLs as well.<br><br>
<hr>
<h3><a name="postgres">Step 15) building PostgreSQL</a></h3>
<b>PostgreSQL</b> is a well known enterprise DBMS; building PostgreSQL seems to be a really odd dependency for SpatiaLite (and really is).<br>
Anyway it's required by <b>GDAL/OGR</b>; if you aren't interested in supporting GDAL/OGR you can directy jump to <a href="#libxml2">libxml2</a><br><br>
Depends on: <b>libz</b>, <b>OpenSSL</b><br>
Required by: <b>GDAL/OGR</b><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://ftp.postgresql.org/pub/source/v9.6.5/postgresql-9.6.5.tar.bz2">postgresql-9.6.5.tar.bz2</a></li>
<li>uncompress this bzip2-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd postgresql-9.6.5</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libxml2">Step 16) building libxml2</a></h3>
<b>libxml2</b> is the well known XML parser of Gnome. it's an optional dependency for <b>libspatialite</b>.<br>
If you aren't interested in supporting libxml2 you can directy jump to <a href="#libspatialite">libspatialite</a><br><br>
Depends on: <b>libz</b>, <b>libiconv</b><br>
Required by: <b>libspatialite</b><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="ftp://xmlsoft.org/libxml2/libxml2-2.9.7.tar.gz">libxml2-2.9.7.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd libxml2-2.9.7</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --without-python --with-zlib=/mingw64/local --with-lzma=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="librttopo">Step 17) building librttopo</a></h3>
<b>librttopo</b> is a new library implementing several usefull geometry functions and fully supporting ISO-Topology operators.<br>
If you aren't interested in supporting librttopo you can directy jump to <a href="#libspatialite">libspatialite</a><br><br>
Depends on: <b>libgeos</b><br>
Required by: <b>libspatialite</b> (<i>optional dependency</i>)<br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="https://git.osgeo.org/gogs/rttopo/librttopo/archive/master.tar.gz]">master.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd librttopo</b><br>
<b class="cmd">./autogen.sh</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --with-geosconfig=/mingw64/local/bin/geos-config</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL as well.
<br><br>
<hr>
<h3><a name="libspatialite">Step 18) building libspatialite</a></h3>
<b>libspatialite</b> is the main core of <b>SpatiaLite</b><br>
Depends on: <b>libiconv</b>, <b>libproj</b>, <b>libgeos</b>, <b>FreeXL</b>,<b>libxml2</b><br>
Required by: <b>spatialite-tools</b>, <b>librasterlite2</b>, <b>spatialite-gui</b>,
<b>LibreWMS</b>, <b>DataSeltzer</b><br><br>
Building under Windows is an easy task. Use <b><a href="#fossil">fossil</a></b> to download the latest version.
<b class="cmd">fossil clone https://www.gaia-gis.it/fossil/libspatialite libspatialite.fossil</b><br>
<b class="cmd">mkdir libspatialite</b><br>
<b class="cmd">cd libspatialite</b><br>
<b class="cmd">fossil open ../libspatialite.fossil</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --with-geosconfig=/mingw64/local/bin/geos-config --target=mingw32 --enable-rttopo=yes --enable-gcp=yes</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
<u>Please note</u>: the above example assumes that <b>librttopo</b> is available; if this is not your case you should obviously omit to specify the corresponding build option.<br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<u>Please note</u>: if you wish, you can now execute the complete test coverage
in order to verify if your build was fully succesful.<br>
This further step is <u>optional</u> and requires a small extra time,
but it's strongly suggested anyway.<br><br>
<b class="cmd">make check</b><br><br>
<hr>
<h3><a name="spatialite-tools">Step 19) building spatialite-tools</a></h3>
<b>spatialite-tools</b> the <b>SpatiaLite</b> <i>command-line</i>
management tools<br>
Depends on: <b>libiconv</b>, <b>libproj</b>, <b>libgeos</b>, <b>FreeXL</b>,
<b>ReadOSM</b>, <b>libspatialite</b>, <b>libexpat</b><br>
Building under Windows is an easy task. Use <b><a href="#fossil">fossil</a></b> to download the latest version.
<b class="cmd">fossil clone https://www.gaia-gis.it/fossil/spatialite-tools spatialite-tools.fossil</b><br>
<b class="cmd">mkdir spatialite-tools</b><br>
<b class="cmd">cd spatialite-tools</b><br>
<b class="cmd">fossil open ../spatialite-tools.fossil</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --with-geosconfig=/mingw64/local/bin/geos-config --target=mingw32</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
<u>Please note</u>: following the above method you'll get <i>dynamically linked</i> tools [i.e. depending on DLLs].<br>
If you wish instead to build <i>statically linked</i> tools
[i.e. self contained, not depending on DLLs], now type:<br><br>
<b class="cmd">mkdir static_bin</b><br>
<b class="cmd">make -f Makefile-static-mingw64</b><br>
<b class="cmd">cp static_bin/* /mingw64/local/bin</b><br><br>
<hr>
<h3><a name="wxWidgets">Step 20) building wxWidgets MSW</a></h3>
<b>wxWidgets</b> is a popular <i>widgets</i> library, supporting GUI in a
cross-platform fashion;
<b>MSW</b> is the specific porting supporting Windows.<br>
Depends on: <b>nothing</b><br>
Required by: <b>spatialite-gui</b>, <b>spatialite-gis</b><br><br>
This library really is an <u>huge and complex</u> piece of software;
building on Windows is an incredibly time consuming task,
but is quite plain and easy.
<ul>
<li>download the latest sources: <a href="https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.3/wxWidgets-3.0.3.7z">wxWidgets-3.0.3.7z</a></li>
<li>uncompress this 7zipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd wxWidgets-3.0.3</b><br>
<b class="cmd">mkdir msw_build</b><br>
<b class="cmd">cd msw_build</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "CXXFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">../configure --prefix=/mingw64/local --disable-shared --disable-debug \<br>
&nbsp;&nbsp;&nbsp;&nbsp;--disable-threads --enable-monolithic --enable-unicode \<br>
&nbsp;&nbsp;&nbsp;&nbsp;--without-regex --enable-graphics_ctx</b><br><br>
<u>Please note</u>: the wxWidgets ./configure is highly configurable: you
must apply exactly the above settings.<br>
Anyway, when ./configure stops, it's a good practice to check if the
final report looks exactly like this:<br><br>
<table bgcolor="#ffffe0" border="1"><tbody><tr><td class="msw">
Configured wxWidgets 3.0.3 for `x86_64-w64-mingw32'<br><br>
&nbsp;&nbsp;Which GUI toolkit should wxWidgets
use?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msw<br>
&nbsp;&nbsp;Should wxWidgets be compiled into single
library?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;yes<br>
&nbsp;&nbsp;Should wxWidgets be linked as a shared
library?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no<br>
&nbsp;&nbsp;Should wxWidgets be compiled in Unicode
mode?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;yes (using wchar_t)<br>
&nbsp;&nbsp;What level of wxWidgets compatibility should be enabled?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wxWidgets 2.6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wxWidgets 2.8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;yes<br>
&nbsp;&nbsp;Which libraries should wxWidgets use?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;STL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jpeg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sys<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;png&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sys<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;regex&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiff&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sys<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zlib&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sys<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;expat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sys<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libmspack&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sdl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;no<br>
</td></tr></tbody></table><br>
now, when ./configure stops, you have to continue as usual:<br><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
<u>Important notice</u>: <b>make install-strip</b> will probably raise some error, but you could safely ignore it at all.<br><br>
<hr>
<h3><a name="libfreetype">Step 21) building libfreetype</a></h3>
<b>libfreetype</b> is a standard library supporting <b>TrueType</b> fonts.<br>
Depends on: <b>nothing</b><br>
Required by: <b>libcairo</b>, ...<br><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://download.savannah.gnu.org/releases/freetype/freetype-2.8.1.tar.gz">freetype-2.8.1.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd freetype-2.8.1</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --with-bzip2=no</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libfontconfig">Step 22) building libfontconfig</a></h3>
<b>libfontconfig</b> is a standard library supporting <b>font customization</b> and configuration.<br>
Depends on: <b>libexpat</b>, <b>libfreetype</b>, <b>libiconv</b><br>
Required by: <b>libcairo</b>, ...<br><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.6.tar.gz">fontconfig-2.12.6.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd fontconfig-2.12.6</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --disable-docs --enable-shared --enable-static</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libpixman">Step 23) building libpixman</a></h3>
<b>libpixman</b> is the standard library implementing <b>pixel manipulation</b> for Cairo.<br>
Depends on: <b>nothing</b><br>
Required by: <b>libcairo</b>, ...<br><br>
Building under Windows is an easy task.<br>
<ul>
<li>download the latest sources: <a href="http://cairographics.org/releases/pixman-0.34.0.tar.gz">pixman-0.34.0.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd pixman-0.34.0</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libcairo">Step 24) building libcairo</a></h3>
<b>libcairo</b> is a very popular <b>graphics</b> library.<br>
Depends on: <b>libpixman</b>, <b>libfreetype</b>, <b>libfontconfig</b>, <b>libpng</b><br>
Required by: <b>librasterlite2</b>, ...<br><br>
Building under Windows is a little bit harder than usual.<br>
<ul>
<li>download the latest sources: <a href="http://cairographics.org/releases/cairo-1.14.10.tar.xz">cairo-1.14.10.tar.xz</a></li>
<li>uncompress this XZ-compressed file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd cairo-1.14.10</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="giflib">Step 25) building giflib</a></h3>
<b>giflib</b> is a popular library supporting the <b>GIF</b> image
compression.<br>
Depends on: <b>nothing</b><br>
Required by: <b>librasterlite2</b>, ...<br><br>
Building under Windows is absolutely a plain and easy task.
<ul>
<li>download the latest sources: <a href="http://sourceforge.net/projects/giflib/files/giflib-5.1.4.tar.gz/download">giflib-5.1.4.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd giflib-5.1.4</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libwebp">Step 26) building libwebp</a></h3>
<b>libwebp</b> is an innovative library supporting the recently introduced <b>WebP</b> image compression.<br>
Depends on: <b>libjpeg</b>, <b>libpng</b>, <b>libtiff</b><br>
Required by: <b>librasterlite2</b>, ...<br><br>
Building under Windows is absolutely a plain and easy task.
<ul>
<li>download the latest sources: <a href="http://downloads.webmproject.org/releases/webp/libwebp-0.6.0.tar.gz">libwebp-0.6.0.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd libwebp-0.6.0</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="CharLS">Step 27) building CharLS</a></h3>
<b>CharLS</b> is an innovative library supporting the <b>JPEG-LS</b> image compressor; don't be fooled by the name,
JPEG-LS is not JPEG. It's based on a completely different algorithm and it supports genuine <i>lossless</i> compression.<br>
Depends on: <b>nothing</b><br>
Required by: <b>librasterlite2</b>, ...<br><br>
Building under Windows is absolutely a plain and easy task;
anyway you'll surely encounter many annoying complications if you'll try to directly build
CharLS starting from the standard sources available from <a href="http://charls.codeplex.com/downloads/get/165715">here</a>
because the code is not really portable (it's obviously intended for the MVSC compiler alone) and it lacks an effective
build script adequately supporting MinGW64 and MSYS2.<br>
Accordingly to all this I've duly repackaged <b>CharLS 1.0</b> by applying few patches resolving
any <b>gcc</b>-related issue and fully supporting a canonical <b>./configure</b> script.
<ul>
<li>download the already patched sources: <a href="http://gaia-gis.it/gaia-sins/CharLS/charls-1.0.zip">charls-1.0.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd charls-1.0</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="lcms2">Step 28) building lcms2</a></h3>
<b>lcms2</b> is an innovative library implementing a Color Management Engine.<br>
Depends on: <b>libjpeg</b>, <b>libpng</b>, <b>libtiff</b><br>
Required by: <b>OpenJpeg-2</b><br><br>
Building under Windows is absolutely a plain and easy task.
<ul>
<li>download the latest sources: <a href="http://sourceforge.net/projects/lcms/files/lcms/2.8/lcms2-2.8.zip/download">lcms2-2.8.zip</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd lcms2-2.8</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
<u>Important notice</u>: you have to properly set the shell environment
in order to retrieve the already installed <b>libz</b>;
this is the duty of the two above <u>export</u> directives.<br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="OpenJpeg">Step 29) building OpenJpeg-2</a></h3>
<b>OpenJpeg-2</b> is an open source library supporting <b>Jpeg2000</b> compressed images.<br>
Depends on: <b>libcms2</b>, <b>libpng</b>, <b>libtiff</b><br>
Required by: <b>librasterlite2</b><br><br>
Building under Windows is absolutely a plain and easy task.<br>
It only has the rather unusual characteristics to adopt <b>CMake</b>-based build scripts, so you'll probably
be required to install CMake before attempting to build OpenJpeg.<br>
Anyway you can easily download the most recent CMake Windows Installer from <a href="http://www.cmake.org/download/">here</a>
<ul>
<li>download the latest sources: <a href="https://github.com/uclouvain/openjpeg/archive/v2.3.0.zip">openjpeg-2.3.0.zip</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<u>Important notice</u>: you absolutely have to apply the following patch before attempting to build OpenJpeg.<br>
The intended scope is the one to redefine the DLL's specific prefix accordingly to MinGW64 requirements.
So manually edit the <b>-/src/lib/openjp2/openjpeg.h</b> source:
<table bgcolor="#ffffe0">
<tr><td>near line 94:<br>
----------------------------------------</td></tr>
<tr><td>&nbsp;&nbsp; #define OPJ_API<br>
&nbsp;&nbsp; #define OPJ_LOCAL<br>
&nbsp;&nbsp; #endif<br>
&nbsp;&nbsp; #define OPJ_CALLCONV<br>
&lt; #else<br>
&lt; #define OPJ_CALLCONV __stdcall<br>
&gt; #else<br>
&gt; #if defined (__MINGW32__)<br>
&gt; #define OPJ_CALLCONV<br>
&gt; #else<br>
&gt; #define OPJ_CALLCONV __stdcall<br>
&gt; #endif<br></td></tr></table><br>
then you should continue to apply this second patch into the same file:
<table bgcolor="#ffffe0">
<tr><td>near line 110:<br>
----------------------------------------</td></tr>
<tr><td>&nbsp;&nbsp; #if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)<br>
&nbsp;&nbsp; #define OPJ_API __declspec(dllexport)<br>
&nbsp;&nbsp; #else<br>
&lt; #define OPJ_API __declspec(dllimport)<br>
&gt; #if defined (__MINGW32__)<br>
&gt; #define OPJ_API extern<br>
&gt; #else<br>
&gt; #define OPJ_API __declspec(dllimport)<br>
&gt; #endif /* MinGW64 */<br></td></tr></table><br>
<b class="cmd">cd openjpeg-2.3.0</b><br>
<b class="cmd">mkdir build_dll</b><br>
<b class="cmd">cd build_dll</b><br>
<b class="cmd">cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/mingw64/local \<br>
-DBUILD_PKGCONFIG_FILES=ON \<br>
-DZLIB_INCLUDE_DIR=/mingw64/local/include \<br>
-DZLIB_LIBRARY=/mingw64/local/lib/libz.dll.a \<br>
-DPNG_PNG_INCLUDE_DIR=/mingw64/local/include/libpng16 \<br>
-DPNG_LIBRARY=/mingw64/local/lib/libpng16.dll.a \<br>
-DTIFF_INCLUDE_DIR=/mingw64/local/include \<br>
-DTIFF_LIBRARY=/mingw64/local/lib/libtiff.dll.a \<br>
-DLCMS2_INCLUDE_DIR=/mingw64/local/include \<br>
-DLCMS2_LIBRARY=/mingw64/local/lib/liblcms2.dll.a ..</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install/strip</b><br><br>
<u>Please note</u>: this will simply build and install the DLL. Now you must build the <i>static library</i> as follows:<br><br>
<b class="cmd">cd ..</b><br>
<b class="cmd">mkdir build_static</b><br>
<b class="cmd">cd build_static</b><br>
<b class="cmd">cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/mingw64/local \<br>
-DBUILD_SHARED_LIBS=OFF \<br>
-DZLIB_INCLUDE_DIR=/mingw64/local/include \<br>
-DZLIB_LIBRARY=/mingw64/local/lib/libz.dll.a \<br>
-DPNG_PNG_INCLUDE_DIR=/mingw64/local/include/libpng16 \<br>
-DPNG_LIBRARY=/mingw64/local/lib/libpng16.dll.a \<br>
-DTIFF_INCLUDE_DIR=/mingw64/local/include \<br>
-DTIFF_LIBRARY=/mingw64/local/lib/libtiff.dll.a \<br>
-DLCMS2_INCLUDE_DIR=/mingw64/local/include \<br>
-DLCMS2_LIBRARY=/mingw64/local/lib/liblcms2.dll.a ..</b><br>
<b class="cmd">make openjp2</b><br>
<b class="cmd">cp bin/libopenjp2.a /mingw64/local/lib</b><br><br>
All done: now you've built and installed both the <i>static library</i> and the DLL as well.<br><br>
<hr>
<h3><a name="libcurl">Step 30) building libcurl</a></h3>
<b>libcurl</b> is a well known library supporting <b>URL</b>s (networking, web protocols)<br>
Depends on: <b>libz</b>, <b>OpenSSL</b><br>
Required by: <b>librasterlite2</b>, ...<br><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://curl.haxx.se/download/curl-7.56.0.zip">curl-7.56.0.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd curl-7.56.0</b><br>
<b class="cmd">export "CPPFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --enable-shared=no --with-zlib=/mingw64/local \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-libssh2=no --with-gssapi=no --disable-tls-srp --disable-rtsp --with-librtmp=no</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install only the <i>static library</i>; so you are now required to perform a second pass in order to build the <i>dynamic library</i> as well:<br><br>
<b class="cmd">make distclean</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --enable-shared=yes --with-zlib=/mingw64/local \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-libssh2=no --with-gssapi=no --disable-tls-srp --disable-rtsp --with-librtmp=no</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
All right; you are now ready to use libcurl.<br><br>
<hr>
<h3><a name="librasterlite2">Step 31) building librasterlite2</a></h3>
<b>librasterlite2</b> is a library supporting <b>rasters</b><br>
Depends on: <b>libjpeg</b>, <b>libpng</b>, <b>libtiff</b>, <b>libgeotiff</b>, <b>libcairo</b>, <b>libgif</b>, <b>libwebp</b><br><br>
Required by: <b>spatialite-gui</b>, <b>LibreWMS</b><br><br>
Building under Windows is an easy task.<br>
<ul>
<li>download the latest sources: <a href="http://www.gaia-gis.it/gaia-sins/librasterlite2-sources/librasterlite2-1.0.0-devel.zip">librasterlite2-1.0.0-devel.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd librasterlite2-1.0.0-devel</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include -DCURL_STATICLIB"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --target=mingw32</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="spatialite-gui">Step 32) building spatialite_gui</a></h3>
<b>spatialite_gui</b> the <b>SpatiaLite</b> <i>GUI</i> user-friendly tool<br>
Depends on: <b>libspatialite</b>, <b>wxWidgets</b>, <b>librasterlite2</b><br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://www.gaia-gis.it/gaia-sins/spatialite-gui-sources/spatialite_gui-2.0.0-devel.zip">spatialite_gui-2.0.0-devel.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
<b class="cmd">cd spatialite_gui-2.0.0-devel</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --with-wxconfig=/mingw64/local/bin/wx-config \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-geosconfig=/mingw64/local/bin/geos-config</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
<u>Please note</u>: following the above method you'll get a <i>dynamically linked</i> GUI tool [i.e. depending on DLLs].<br>
If you wish instead to build a <i>statically linked</i> GUI tool
[i.e. self contained, not depending on DLLs], now type:<br><br>
<b class="cmd">mkdir static_bin</b><br>
<b class="cmd">make -f Makefile-static-mingw64</b><br>
<b class="cmd">cp static_bin/* /mingw64/local/bin</b><br><br>
<hr>
<h3><a name="librewms">Step 33) building LibreWMS</a></h3>
<b>LibreWMS</b> is an open source WMS Viewer built on
the top of <b>SpatiaLite</b> and <b>RasterLite2</b>.<br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://www.gaia-gis.it/gaia-sins/librewms-1.0.0a.zip">librewms-1.0.0.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
First of all, you must check if you've already installed <b>pkg-config.exe</b><br>
If not, please read the above <a href="#pkg-config">instructions</a><br><br>
And now you must set the <b>PKG_CONFIG_PATH</b> as appropriate:<br><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br><br>
After this you are now ready to build as usual:<br><br>
<b class="cmd">cd librewms-1.0.0a</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --target=mingw32</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
<u>Please note</u>: following the above method you'll get a <i>dynamically linked</i> GUI tool [i.e. depending on DLLs].<br>
If you wish instead to build a <i>statically linked</i> app
[i.e. self contained, not depending on DLLs], now type:<br><br>
<b class="cmd">mkdir static_bin</b><br>
<b class="cmd">make -f Makefile-static-MinGW64</b><br>
<b class="cmd">cp static_bin/* /mingw64/local/bin</b><br><br>
<hr>
<h3><a name="minizip">Step 34) building minizip</a></h3>
<b>minizip</b> is an innovative library supporting direct creation of compressed <b>ZipFile</b> archives.<br>
Depends on: <b>libz</b><br>
Required by: <b>DataSeltzer</b>, ...<br><br>
Building under Windows is absolutely a plain and easy task;
anyway there is a little preliminary complication.<br>
The <b>MiniZIP</b> library isn't directly distributed as such;
it simply is an auxiliary package you'll find within any standard source
tarball distribution of <b>zlib</b> (on the <b>contribs</b> folder).<br>
Unhappily the original distribution is a little bit dirty / unfinished,
and lacks any accompanying <b>./configure</b> script (strictly required by MinGW64/MSYS2).<br>
So there are two possible alternatives to circumvent this issue:
<ol>
<li>build first <b>MiniZIP</b> on some Linux platform.
Then create a standard tarball distribution by calling <b class="cmd">make dist</b>
And finally copy this tarball to your Windows platform.</li>
<li>directly download this pre-configured source tarball: <a href="http://www.gaia-gis.it/gaia-sins/dataseltzer-sources/minizip-1.2.8.tar.gz">minizip-1.2.8.tar.gz</a></li>
</ol>
Once you've got the source tarball you can continue following the usual approach:
<ul>
<li>untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd minizip-1.2.8</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install-strip</b><br><br>
<u>Important notice</u>: you have to properly set the shell environment
in order to retrieve the already installed <b>libz</b>;
this is the duty of the two above <u>export</u> directives.<br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="libcgi">Step 35) building libcgi</a></h3>
<b>libcgi</b> is an standard library supporting the <b>CGI</b> environment.<br>
Depends on: <b>nothing</b><br>
Required by: <b>DataSeltzer</b><br><br>
Building under Windows is absolutely a plain and easy task.
<ul>
<li>download the latest sources: <a href="http://sourceforge.net/projects/libcgi/files/libcgi/1.0/libcgi-1.0.tar.gz/download">libcgi-1.0.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd libcgi-1.0</b><br>
<b class="cmd">./configure</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="dataseltzer">Step 36) building DataSeltzer CGI</a></h3>
<b>DataSeltzer</b> is a CGI component supporting OpenData dissemination built on
the top of <b>SpatiaLite</b>.<br>
Building under Windows is an easy task.
<ul>
<li>download the latest sources: <a href="http://www.gaia-gis.it/gaia-sins/dataseltzer-1.0.0.zip">dataseltzer-1.0.0.zip</a></li>
<li>uncompress this zip-file</li>
<li>then open an MSYS2 shell (<b>mingw64.exe</b>)</li>
</ul>
First of all, you must check if you've already installed <b>pkg-config.exe</b><br>
If not, please read the above <a href="#pkg-config">instructions</a><br><br>
And now you must set the <b>PKG_CONFIG_PATH</b> as appropriate:<br><br>
<b class="cmd">export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"</b><br><br>
After this you are now ready to build as usual:<br><br>
<b class="cmd">cd dataseltzer-1.0.0</b><br>
<b class="cmd">export "CFLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --target=mingw32</b><br>
<b class="cmd">make</b><br>
<u>Please note</u>: following the above method you'll get a <i>dynamically linked</i> CGI component [i.e. depending on DLLs].<br>
If you wish instead to build a <i>statically linked</i> CGI
[i.e. self contained, not depending on DLLs], now type:<br><br>
<b class="cmd">mkdir static_bin</b><br>
<b class="cmd">make -f Makefile-static-MinGW64</b><br><br>
<u>Please note</u>: installing a CGI component requires special precautions depending on the specific Web Server configuration.
<hr>
<h3><a name="gdal">Step 37) building GDAL</a></h3>
<b>GDAL</b> is the well known Geospatial Data Abstraction library. it's strictly required by <b>mod_gdalsplite</b>.<br>
Depends on: practically all libraries built since now<br>
Required by: <b>mod_gdalsplite</b><br>
Building under Windows is a very long but easy task.
<ul>
<li>download the latest source in zip format from <a href="http://download.osgeo.org/gdal/CURRENT/">here</a></li>
<li>uncompress this zipped-file</li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<b class="cmd">cd gdal-2.x.x</b><br>
<b class="cmd">export "CPPLAGS=-I/mingw64/local/include"</b><br>
<b class="cmd">export "LDFLAGS=-L/mingw64/local/lib"</b><br>
<b class="cmd">./configure --prefix=/mingw64/local --with-sqlite3=/mingw64/local --with-spatialite=/mingw64/local --with-static-proj4=/mingw64/local --with-geos=/mingw64/local/bin/geos-config --with-liblzma=/mingw64/local --with-webp=/mingw64/local</b><br>
<b class="cmd">make</b><br>
<b class="cmd">make install</b><br><br>
This will build and install both the <i>static library</i> and the DLL
as well.<br><br>
<hr>
<h3><a name="fossil">Step 38) building fossil</a></h3>
<b>fossil</b> is the SCM [<i>Source Code Management</i>] used by SpatiaLite (and companion) projects.<br>
Building on Windows is an easy and plain task.
<ul>
<li>download the latest sources: <a href="http://www.fossil-scm.org/download/fossil-src-20130216000435.tar.gz">fossil-src-20130216000435.tar.gz</a></li>
<li>uncompress this gzipped-file</li>
<li>then untar the <i>tarball</i></li>
<li>and finally open an MSYS2 shell (<b>ming64.exe</b>)</li>
</ul>
<u>Important notice</u>: you are required to manually edit the <b>-/win/Makefile.mingw</b> script
as follows:<br><br>
<table bgcolor="#ffffe0">
<tr><td><b>Line 55</b>: replace <i># FOSSIL_ENABLE_SSL = 1</i> as: <b>FOSSIL_ENABLE_SSL = 1</b></td></tr>
<tr><td><b>Line 81</b>: replace <i>ZINCDIR = $(SRCDIR)/../zlib-1.2.6</i> as: <b>ZINCDIR = /mingw64/local/include</b></td></tr>
<tr><td><b>Line 82</b>: replace <i>ZLIBDIR = $(SRCDIR)/../zlib-1.2.6</i> as: <b>ZLIBDIR = /mingw64/local/lib</b></td></tr>
<tr><td><b>Line 89</b>: replace <i>OPENSSLINCDIR = $(SRCDIR)/../openssl-1.0.0g/include</i> as: <b>OPENSSLINCDIR = /mingw64/local/include</b></td></tr>
<tr><td><b>Line 90</b>: replace <i>OPENSSLLIBDIR = $(SRCDIR)/../openssl-1.0.0g</i> as: <b>OPENSSLLIBDIR = /mingw64/local/lib</b></td></tr>
<tr><td><b>Line 661,662</b>: delete both lines<br><i>zlib:</i><br><i>&nbsp;&nbsp;&nbsp;&nbsp;$(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc libz.a</i></td></tr>
<tr><td><b>Line 663</b>: delete <i>zlib</i> at the end of the line.</td></tr>
</tbody></table>
<br>
After this you are now ready to build:<br><br>
<b class="cmd">cd fossil-src-20130216000435</b><br>
<b class="cmd">make -f win/Makefile.mingw</b><br>
<b class="cmd">strip --strip-all fossil.exe</b><br><br>
<hr>
Back to the <a href="http://www.gaia-gis.it/gaia-sins/index.html">Gaia-SINS</a> home page
<table width="100%" bgcolor="#ddffdd"><tr><th>last updated: 2017-10-07</th></tr></table>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment