last updated: 2017-11-25
Back to the Gaia-SINS home page

Index of contents


the MinGW64 + MSYS2 environment

MinGW64 is an open source C/C++ compiler for WIndows platforms based on the popular gcc available on Linux and on many other Operating Systems; Mingw64 can create both 32 and 64 bit binary executables.
MSYS2 is a command shell supporting a minimalistic Linux-like environment on Windows.
Using both them you can build standard open source software [originally developed for Linux] under Windows as well, simply using the classic build tool-chain, as in:

./configure
make
make install

Quite obviously, Windows isn't exactly the same as Linux, so you cannot expect to get always an easy and painless build.
May well be you have to adapt something here and there in order to get a successful build under Windows.
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.

Important notice: all the following instructions require using the most recent versions of the compiler (i.e. gcc 6.3.0).

In order to check the actual version you are using, you simply have to execute the following command: gcc --version


The most recent versions of MinGW64 and MSYS2 are reasonably easy to install; just follow the instructions below.

Installing MSYS2

  1. download the MSYS2 intaller from here
  2. start the installer: I suggest you to set C:/dev/msys64 as the base installation path.
  3. once MSYS2 has been installed you must complete several further steps.
    Please follow the instructions you can find here
  4. Note: 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.

Familiarizing with pacman

After properly installing MSYS2 you'll be able to use pacman in order to complete your installation.
Pacman is a package manager similar to Red Hat's yum and Debian's apt-get, and will make really easy the task to prepare a complete build environment.
  1. Start an MSYS2 shell.
    Just click the icon of one between msys2.exe, mingw32i.exe or mingw64.exe you'll find into the C:\dev\msys64 folder (the one or the other is not relevant in this context).
  2. Then execute the following commands from the shell:
  3. all right: you've now completed your MinGW64 + MSYS2 installation, and you are ready to start building your Windows binary executables.
Note: may well be you'll discover before or after that some tool is still missing. You can easily install it when required.
Example: the well known vim text editor is still missing; you can easily install it by executing: pacman -S vim
Hint: you can easily check all packages declaring a matching name and if they are already installed or not by executing: pacman -Ss package-name:

Understanding the two build environments: mingw32 and mingw64

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 /usr/local target as the standard destination where to install our custom builds.

Very important notice

The standard configuration adopted by MinGW64 forbids to effectively link libpthread as a static library.
You are required to manually apply the following small patch in order to avoid this issue.
  • this patch must be applied twice, once for the 32 bit compiler and once for the 64 bit compiler.
  • you must edit the /mingw32/i686-w64-mingw32/include/pthread.h header file for the 32 bit compiler.
  • and/or you must edit the /mingw64/x86_64-w64-mingw32/include/pthread.h header file for the 64 bit compiler.
Near line 85:
  #if defined DLL_EXPORT
  #ifdef IN_WINPTHREAD
  #define WINPTHREAD_API __declspec(dllexport)
  #else
< #define WINPTHREAD_API __declspec(dllimport)
> #define WINPTHREAD_API
  #endif
  #else
  #define WINPTHREAD_API
  #endif


Step 1) building libiconv

libiconv is the standard GNU library supporting locale charsets.
Required by: libspatialite, spatialite-tools

Building under Windows is not too much difficult. cd libiconv-1.15
./configure --prefix=/mingw64/local
make
make install-strip

Anyway, this will simply build and install the DLL: a further step is required in order to get the static library as well.

make distclean
./configure --prefix=/mingw64/local --disable-shared --enable-static
make
make install-strip

Now you've built and installed both the static library and the DLL.
However the above process has installed badly misconfigured libcharset.la and libiconv.la files
(which are required to build other libraries in the following steps).
So in order to get a properly configured libiconv you have to accomplish a further operation:

Step 2) building libz

libz is a popular library implementing Deflate, i.e. the compression algorithm used by gzip and Zip.
Depends on: nothing
Required by: libpng, libtiff, ...

Building under Windows is quite easy, but requires to pay some attenction. cd zlib-1.2.11
export "INCLUDE_PATH=/mingw64/local/include"
export "LIBRARY_PATH=/mingw64/local/lib"
export "BINARY_PATH=/mingw64/local/bin"
make -f win32/Makefile.gcc
make install -f win32/Makefile.gcc
cp libz.dll.a /mingw64/local/lib
cp zlib1.dll /mingw64/local/bin

All this will build and install both the static library and the DLL as well.
Anyway this process will not generate the libz.la file (which is required to build libtiff in one of the following steps.
So in order to get a fully installed libz you have to accomplish a further operation:

Step 3) building libjpeg

libjpeg is a popular library supporting the JPEG image compression.
Depends on: nothing
Required by: libtiff, librasterlite2

Building under Windows is absolutely a plain and easy task. cd libjpeg-turbo-1.5.2
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 4) building libpng

libpng is a popular library supporting the PNG image compression.
Depends on: libz
Required by: librasterlite2

Building under Windows is absolutely a plain and easy task. cd libpng-1.6.34
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --prefix=/mingw64/local
make
make install-strip

Important notice: you have to properly set the shell environment in order to retrieve the already installed libz; this is the duty of the two above export directives.

This will build and install both the static library and the DLL as well.


Step 5) building XZ (liblzma)

liblzma is a popular library supporting the LZMA advanced compression (it's a component of the XZ package).
Depends on: nothing
Required by: libtiff

Building under Windows is absolutely a plain and easy task. cd xz-5.2.3
./configure --prefix=/mingw64/local --with-libiconv-prefix=/mingw64/local --with-libintl-prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 6) building libtiff

libtiff is a popular library supporting the TIFF image format.
Depends on: libz, liblzma, libjpeg
Required by: librasterlite2

Building under Windows is absolutely a plain and easy task. cd tiff-4.0.9
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --prefix=/mingw64/local
make
make install-strip

Important notice: you have to properly set the shell environment in order to retrieve the already installed libz; this is the duty of the two above export directives.

This will build and install both the static library and the DLL as well.


Step 7) building libproj

libproj is a library supporting coordinate's transformation between different Reference Systems [PROJ.4]
Depends on: nothing
Required by: libgeotiff, libspatialite, spatialite-tools

Building under Windows is an easy task. cd proj-4.9.3
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 8) building libgeotiff

libgeotiff is a library supporting the GeoTIFF raster format
Depends on: libtiff, libproj
Required by: librasterlite2

Building under Windows is an easy task. Important notice: there is a bug in the standard build scripts forbidding to create a Windows DLL using MinGW64 + MSYS2.
So you have to manually apply the following patch to circumvent this issue.
(many thanks to Alexey Pavlov for suggesting this patch)
Edit the Makefile.in file as follows:

570c570
< libgeotiff_la_LDFLAGS = -version-info 3:2:1
---
> libgeotiff_la_LDFLAGS = -version-info 3:2:1 -no-undefined

Save and exit; now you are ready to build.

cd libgeotiff-1.4.2
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --prefix=/mingw64/local --with-proj --with-libz --with-jpeg --enable-incode-epsg
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 9) building libgeos

libgeos is a library representing a C++ porting of JTS [Java Topology Suite].
Depends on: nothing
Required by: libspatialite, spatialite-tools

This library really is an huge and complex piece of software; cd geos-3.6.2
export "CXXFLAGS=-O3"
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 10) building libexpat

libexpat is a well known standard library supporting XML parsing.
Depends on: nothing
Required by: libfontconfig, spatialite-tools, ...

Building under Windows really is a piece-of-cake. cd expat-2.2.5
./configure --prefix=/mingw64/local
make
make install

This will build and install both the static library and the DLL as well.


Step 11) building FreeXL

FreeXL is an utility library implementing read-access for Excel (.xls) spreadsheets
Depends on: libiconv
Required by: spatialite-tools, libspatialite, spatialite-gui

Building under Windows is an easy task. cd freexl-1.0.4
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.

Please note: if you wish, you can now execute the complete test coverage in order to verify if your build was fully succesful.
This further step is optional and requires a small extra time, but it's strongly suggested anyway.

make check


Step 12) building ReadOSM

ReadOSM is an utility library supporting OSM datasets parsing
Depends on: libz, libexpat
Required by: spatialite-tools

Building under Windows is an easy task. cd readosm-1.1.0
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.

Please note: if you wish, you can now execute the complete test coverage in order to verify if your build was fully succesful.
This further step is optional and requires a small extra time, but it's strongly suggested anyway.

make check


Step 13) building libsqlite

libsqlite is the library implementing the SQLite DBMS engine
Depends on: nothing
Required by: libspatialite, librasterlite

Building under Windows is an easy task. cd sqlite-autoconf-3210000
export "CFLAGS=-DSQLITE_ENABLE_STAT3=1 -DSQLITE_ENABLE_TREE_EXPLAIN=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 \
        -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_THREADSAFE=1"

./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 14) building OpenSSL

OpenSSL is a well known standard library supporting SSL, i.e. the encrypted HTTPS web protocol.
Depends on: nothing
Required by: libcurl

Building under Windows is a little bit difficult, and requires to pay close attention.
The configure script isn't at all a standard one: please read carefully the following instructions.
tar zxvf openssl-1.1.0g.tar.gz
cd openssl-1.1.0g
./Configure mingw64 --prefix=/mingw64/local shared
make
make install

This will build and install both the static libraries and the DLLs as well.


Step 15) building PostgreSQL

PostgreSQL is a well known enterprise DBMS; building PostgreSQL seems to be a really odd dependency for SpatiaLite (and really is).
Anyway it's required by GDAL/OGR; if you aren't interested in supporting GDAL/OGR you can directy jump to libxml2

Depends on: libz, OpenSSL
Required by: GDAL/OGR
Building under Windows is an easy task. cd postgresql-10.1
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 16) building libxml2

libxml2 is the well known XML parser of Gnome. it's an optional dependency for libspatialite.
If you aren't interested in supporting libxml2 you can directy jump to libspatialite

Depends on: libz, libiconv
Required by: libspatialite
Building under Windows is an easy task. cd libxml2-2.9.7
./configure --prefix=/mingw64/local --without-python --with-zlib=/mingw64/local --with-lzma=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 17) building librttopo

librttopo is a new library implementing several usefull geometry functions and fully supporting ISO-Topology operators.
If you aren't interested in supporting librttopo you can directy jump to libspatialite

Depends on: libgeos
Required by: libspatialite (optional dependency)
Building under Windows is an easy task. cd librttopo-1.0.0
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --prefix=/mingw64/local --with-geosconfig=/mingw64/local/bin/geos-config
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 18) building libspatialite

libspatialite is the main core of SpatiaLite
Depends on: libiconv, libproj, libgeos, FreeXL
Required by: spatialite-tools, librasterlite2, spatialite-gui, LibreWMS, DataSeltzer

Building under Windows is an easy task. cd libspatialite-4.4.0-RC1
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"
./configure --prefix=/mingw64/local --with-geosconfig=/mingw64/local/bin/geos-config --target=mingw32 --enable-rttopo=yes --enable-gcp=yes
make
make install-strip

Please note: the above example assumes that librttopo is available; if this is not your case you should obviously omit to specify the corresponding build option.

This will build and install both the static library and the DLL as well.

Please note: if you wish, you can now execute the complete test coverage in order to verify if your build was fully succesful.
This further step is optional and requires a small extra time, but it's strongly suggested anyway.

make check


Step 19) building spatialite-tools

spatialite-tools the SpatiaLite command-line management tools
Depends on: libiconv, libproj, libgeos, FreeXL, ReadOSM, libspatialite, libexpat
Building under Windows is an easy task. cd spatialite-tools-4.4.0-RC1
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"
./configure --prefix=/mingw64/local --with-geosconfig=/mingw64/local/bin/geos-config --target=mingw32
make
make install-strip

Please note: following the above method you'll get dynamically linked tools [i.e. depending on DLLs].
If you wish instead to build statically linked tools [i.e. self contained, not depending on DLLs], now type:

mkdir static_bin
make -f Makefile-static-mingw64
cp static_bin/* /mingw64/local/bin


Step 20) building wxWidgets MSW

wxWidgets is a popular widgets library, supporting GUI in a cross-platform fashion; MSW is the specific porting supporting Windows.
Depends on: nothing
Required by: spatialite-gui, spatialite-gis

This library really is an huge and complex piece of software; building on Windows is an incredibly time consuming task, but is quite plain and easy. cd wxWidgets-3.0.3
mkdir msw_build
cd msw_build
export "CFLAGS=-I/mingw64/local/include"
export "CXXFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
../configure --prefix=/mingw64/local --disable-shared --disable-debug \
    --disable-threads --enable-monolithic --enable-unicode \
    --without-regex --enable-graphics_ctx


Please note: the wxWidgets ./configure is highly configurable: you must apply exactly the above settings.
Anyway, when ./configure stops, it's a good practice to check if the final report looks exactly like this:

Configured wxWidgets 3.0.3 for `x86_64-w64-mingw32'

  Which GUI toolkit should wxWidgets use?                 msw
  Should wxWidgets be compiled into single library?       yes
  Should wxWidgets be linked as a shared library?         no
  Should wxWidgets be compiled in Unicode mode?           yes (using wchar_t)
  What level of wxWidgets compatibility should be enabled?
                                       wxWidgets 2.6      no
                                       wxWidgets 2.8      yes
  Which libraries should wxWidgets use?
                                       STL                no
                                       jpeg               sys
                                       png                sys
                                       regex              no
                                       tiff               sys
                                       zlib               sys
                                       expat              sys
                                       libmspack          no
                                       sdl                no

now, when ./configure stops, you have to continue as usual:

make
make install-strip

Important notice: make install-strip will probably raise some error, but you could safely ignore it at all.


Step 21) building libfreetype

libfreetype is a standard library supporting TrueType fonts.
Depends on: nothing
Required by: libcairo, ...

Building under Windows is an easy task. cd freetype-2.8.1
./configure --prefix=/mingw64/local --with-bzip2=no
make
make install

This will build and install both the static library and the DLL as well.


Step 22) building libfontconfig

libfontconfig is a standard library supporting font customization and configuration.
Depends on: libexpat, libfreetype, libiconv
Required by: libcairo, ...

Building under Windows is an easy task. cd fontconfig-2.12.6
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"
./configure --prefix=/mingw64/local --disable-docs --enable-shared --enable-static
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 23) building libpixman

libpixman is the standard library implementing pixel manipulation for Cairo.
Depends on: nothing
Required by: libcairo, ...

Building under Windows is an easy task.
cd pixman-0.34.0
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 24) building libcairo

libcairo is a very popular graphics library.
Depends on: libpixman, libfreetype, libfontconfig, libpng
Required by: librasterlite2, ...

Building under Windows is a little bit harder than usual.
cd cairo-1.14.10
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 25) building giflib

giflib is a popular library supporting the GIF image compression.
Depends on: nothing
Required by: librasterlite2, ...

Building under Windows is absolutely a plain and easy task. cd giflib-5.1.4
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 26) building libwebp

libwebp is an innovative library supporting the recently introduced WebP image compression.
Depends on: libjpeg, libpng, libtiff
Required by: librasterlite2, ...

Building under Windows is absolutely a plain and easy task. cd libwebp-0.6.0
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 27) building CharLS

CharLS is an innovative library supporting the JPEG-LS 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 lossless compression.
Depends on: nothing
Required by: librasterlite2, ...

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 here 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.
Accordingly to all this I've duly repackaged CharLS 1.0 by applying few patches resolving any gcc-related issue and fully supporting a canonical ./configure script. cd charls-1.0
./configure --prefix=/mingw64/local
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 28) building lcms2

lcms2 is an innovative library implementing a Color Management Engine.
Depends on: libjpeg, libpng, libtiff
Required by: OpenJpeg-2

Building under Windows is absolutely a plain and easy task. cd lcms2-2.8
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --prefix=/mingw64/local
make
make install-strip

Important notice: you have to properly set the shell environment in order to retrieve the already installed libz; this is the duty of the two above export directives.
This will build and install both the static library and the DLL as well.


Step 29) building OpenJpeg-2

OpenJpeg-2 is an open source library supporting Jpeg2000 compressed images.
Depends on: libcms2, libpng, libtiff
Required by: librasterlite2

Building under Windows is absolutely a plain and easy task.
It only has the rather unusual characteristics to adopt CMake-based build scripts, so you'll probably be required to install CMake before attempting to build OpenJpeg.
Anyway you can easily download the most recent CMake Windows Installer from here Important notice: you absolutely have to apply the following patch before attempting to build OpenJpeg.
The intended scope is the one to redefine the DLL's specific prefix accordingly to MinGW64 requirements. So manually edit the -/src/lib/openjp2/openjpeg.h source:
near line 94:
----------------------------------------
   #define OPJ_API
   #define OPJ_LOCAL
   #endif
   #define OPJ_CALLCONV
< #else
< #define OPJ_CALLCONV __stdcall
> #else
> #if defined (__MINGW32__)
> #define OPJ_CALLCONV
> #else
> #define OPJ_CALLCONV __stdcall
> #endif

then you should continue to apply this second patch into the same file:
near line 110:
----------------------------------------
   #if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
   #define OPJ_API __declspec(dllexport)
   #else
< #define OPJ_API __declspec(dllimport)
> #if defined (__MINGW32__)
> #define OPJ_API extern
> #else
> #define OPJ_API __declspec(dllimport)
> #endif /* MinGW64 */

cd openjpeg-2.3.0
mkdir build_dll
cd build_dll
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/mingw64/local \
-DBUILD_PKGCONFIG_FILES=ON \
-DZLIB_INCLUDE_DIR=/mingw64/local/include \
-DZLIB_LIBRARY=/mingw64/local/lib/libz.dll.a \
-DPNG_PNG_INCLUDE_DIR=/mingw64/local/include/libpng16 \
-DPNG_LIBRARY=/mingw64/local/lib/libpng16.dll.a \
-DTIFF_INCLUDE_DIR=/mingw64/local/include \
-DTIFF_LIBRARY=/mingw64/local/lib/libtiff.dll.a \
-DLCMS2_INCLUDE_DIR=/mingw64/local/include \
-DLCMS2_LIBRARY=/mingw64/local/lib/liblcms2.dll.a ..

make
make install/strip

Please note: this will simply build and install the DLL. Now you must build the static library as follows:

cd ..
mkdir build_static
cd build_static
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/mingw64/local \
-DBUILD_SHARED_LIBS=OFF \
-DZLIB_INCLUDE_DIR=/mingw64/local/include \
-DZLIB_LIBRARY=/mingw64/local/lib/libz.dll.a \
-DPNG_PNG_INCLUDE_DIR=/mingw64/local/include/libpng16 \
-DPNG_LIBRARY=/mingw64/local/lib/libpng16.dll.a \
-DTIFF_INCLUDE_DIR=/mingw64/local/include \
-DTIFF_LIBRARY=/mingw64/local/lib/libtiff.dll.a \
-DLCMS2_INCLUDE_DIR=/mingw64/local/include \
-DLCMS2_LIBRARY=/mingw64/local/lib/liblcms2.dll.a ..

make openjp2
cp bin/libopenjp2.a /mingw64/local/lib

All done: now you've built and installed both the static library and the DLL as well.


Step 30) building libcurl

libcurl is a well known library supporting URLs (networking, web protocols)
Depends on: libz, OpenSSL
Required by: librasterlite2, ...

Building under Windows is an easy task. cd curl-7.56.1
export "CPPFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"
./configure --prefix=/mingw64/local --enable-shared=no --with-zlib=/mingw64/local \
        --with-libssh2=no --with-gssapi=no --disable-tls-srp --disable-rtsp --with-librtmp=no

make
make install-strip

This will build and install only the static library; so you are now required to perform a second pass in order to build the dynamic library as well:

make distclean
./configure --prefix=/mingw64/local --enable-shared=yes --with-zlib=/mingw64/local \
        --with-libssh2=no --with-gssapi=no --disable-tls-srp --disable-rtsp --with-librtmp=no

make
make install-strip

All right; you are now ready to use libcurl.


Step 31) building librasterlite2

librasterlite2 is a library supporting rasters
Depends on: libjpeg, libpng, libtiff, libgeotiff, libcairo, libgif, libwebp

Required by: spatialite-gui, LibreWMS

Building under Windows is an easy task.
cd librasterlite2-1.0.0-devel
export "CFLAGS=-I/mingw64/local/include -DCURL_STATICLIB"
export "LDFLAGS=-L/mingw64/local/lib"
export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"
./configure --prefix=/mingw64/local --target=mingw32
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 32) building spatialite_gui

spatialite_gui the SpatiaLite GUI user-friendly tool
Depends on: libspatialite, wxWidgets, librasterlite2
Building under Windows is an easy task. cd spatialite_gui-2.0.0-devel
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"
./configure --prefix=/mingw64/local --with-wxconfig=/mingw64/local/bin/wx-config \
        --with-geosconfig=/mingw64/local/bin/geos-config

make
make install-strip

Please note: following the above method you'll get a dynamically linked GUI tool [i.e. depending on DLLs].
If you wish instead to build a statically linked GUI tool [i.e. self contained, not depending on DLLs], now type:

mkdir static_bin
make -f Makefile-static-mingw64
cp static_bin/* /mingw64/local/bin


Step 33) building LibreWMS

LibreWMS is an open source WMS Viewer built on the top of SpatiaLite and RasterLite2.
Building under Windows is an easy task. First of all, you must check if you've already installed pkg-config.exe
If not, please read the above instructions

And now you must set the PKG_CONFIG_PATH as appropriate:

export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"

After this you are now ready to build as usual:

cd librewms-1.0.0a
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --target=mingw32
make
make install-strip

Please note: following the above method you'll get a dynamically linked GUI tool [i.e. depending on DLLs].
If you wish instead to build a statically linked app [i.e. self contained, not depending on DLLs], now type:

mkdir static_bin
make -f Makefile-static-MinGW64
cp static_bin/* /mingw64/local/bin


Step 34) building minizip

minizip is an innovative library supporting direct creation of compressed ZipFile archives.
Depends on: libz
Required by: DataSeltzer, ...

Building under Windows is absolutely a plain and easy task; anyway there is a little preliminary complication.
The MiniZIP library isn't directly distributed as such; it simply is an auxiliary package you'll find within any standard source tarball distribution of zlib (on the contribs folder).
Unhappily the original distribution is a little bit dirty / unfinished, and lacks any accompanying ./configure script (strictly required by MinGW64/MSYS2).
So there are two possible alternatives to circumvent this issue:
  1. build first MiniZIP on some Linux platform. Then create a standard tarball distribution by calling make dist And finally copy this tarball to your Windows platform.
  2. directly download this pre-configured source tarball: minizip-1.2.8.tar.gz
Once you've got the source tarball you can continue following the usual approach: cd minizip-1.2.8
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure
make
make install-strip

Important notice: you have to properly set the shell environment in order to retrieve the already installed libz; this is the duty of the two above export directives.
This will build and install both the static library and the DLL as well.


Step 35) building libcgi

libcgi is an standard library supporting the CGI environment.
Depends on: nothing
Required by: DataSeltzer

Building under Windows is absolutely a plain and easy task. cd libcgi-1.0
./configure
make
make install

This will build and install both the static library and the DLL as well.


Step 36) building DataSeltzer CGI

DataSeltzer is a CGI component supporting OpenData dissemination built on the top of SpatiaLite.
Building under Windows is an easy task. First of all, you must check if you've already installed pkg-config.exe
If not, please read the above instructions

And now you must set the PKG_CONFIG_PATH as appropriate:

export "PKG_CONFIG_PATH=/mingw64/local/lib/pkgconfig"

After this you are now ready to build as usual:

cd dataseltzer-1.0.0
export "CFLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --target=mingw32
make
Please note: following the above method you'll get a dynamically linked CGI component [i.e. depending on DLLs].
If you wish instead to build a statically linked CGI [i.e. self contained, not depending on DLLs], now type:

mkdir static_bin
make -f Makefile-static-MinGW64

Please note: installing a CGI component requires special precautions depending on the specific Web Server configuration.

Step 37) building GDAL

GDAL is the well known Geospatial Data Abstraction library. it's strictly required by mod_gdalsplite.
Depends on: practically all libraries built since now
Required by: mod_gdalsplite
Building under Windows is a very long but easy task. cd gdal-2.0.1
export "CPPLAGS=-I/mingw64/local/include"
export "LDFLAGS=-L/mingw64/local/lib"
./configure --with-liblzma=yes --with-spatialite=yes --with-webp=yes
make
make install-strip

This will build and install both the static library and the DLL as well.


Step 38) building fossil

fossil is the SCM [Source Code Management] used by SpatiaLite (and companion) projects.
Building on Windows is an easy and plain task. Important notice: you are required to manually edit the -/win/Makefile.mingw script as follows:

Line 55: replace # FOSSIL_ENABLE_SSL = 1 as: FOSSIL_ENABLE_SSL = 1
Line 81: replace ZINCDIR = $(SRCDIR)/../zlib-1.2.6 as: ZINCDIR = /mingw64/local/include
Line 82: replace ZLIBDIR = $(SRCDIR)/../zlib-1.2.6 as: ZLIBDIR = /mingw64/local/lib
Line 89: replace OPENSSLINCDIR = $(SRCDIR)/../openssl-1.0.0g/include as: OPENSSLINCDIR = /mingw64/local/include
Line 90: replace OPENSSLLIBDIR = $(SRCDIR)/../openssl-1.0.0g as: OPENSSLLIBDIR = /mingw64/local/lib
Line 661,662: delete both lines
zlib:
    $(MAKE) -C $(ZLIBDIR) PREFIX=$(PREFIX) -f win32/Makefile.gcc libz.a
Line 663: delete zlib at the end of the line.

After this you are now ready to build:

cd fossil-src-20130216000435
make -f win/Makefile.mingw
strip --strip-all fossil.exe


Back to the Gaia-SINS home page
last updated: 2017-11-25