last updated: 2016-04-07
Back to the Gaia-SINS home page

Index of contents


Setting up the MinGW 64 environment

MinGW 64 is an open source C/C++ compiler based on the popular gcc; basically, it is intended to generate executables for Windows 64 bit.

We'll suppose that you already have a basic familiarity with standard MinGW 32 + MSYS: MinGW 64 is more or less the same, but acting (more or less) as a cross-compiler.
This practically means that you can build 64 bit executables on any Win32 platform: but obviously any 64 bit program requires some Windows 64 platform to be executed.

The standard build tool-chain [originally developed for Linux] natively supports cross-compilers: and this works under Windows as well, e.g. using MinGW 64.
As you surely already know, the standard build procedure is the following one:

./configure
make
make install

Using the MinGW 64 cross-compiler is the same of using standard MinGW32: but in this case you are required to always specify the following ./configure argument:

./configure --host=x86_64-w64-mingw32
make
make install

The above --host directive is enough for ./configure to intend that a cross-compilation is required: and that the intended target is Windows 64 bit.
There are many different ways to deploy MinGW 64 (this including cross-compiling on Linux or Cygwin).
After some careful preliminary testing, I choosed the following one because it appairs the most straightforward: mingw disk layout
Once I decided the most appropriate disk layout, I duly started installing MinGW 64 on Windows 7 Pro 64 bit:
Important notice: the most recent versions of the MinGW 64 compiler (gcc 4.8.x) seem to be completely unable to build a 64 bit version of wxWidgets. The build process is apparently succesful for a while, but after several minutes it suddenly stops due to a nasty crash in the cc1 compiler.

I strongly reccommend using TDM gcc 5.1.0-2 64 bit which works in the nicest way.
It's not a cross compiler, and doesn't requires any --host directive at all.

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


PostInstallation tasks

Step #1: carefully check the C:\msys64\etc\fstab file; it must contain the following row: (this will automatically mount C:\MinGW64 as /mingw)
C:/MinGW64/mingw64 /mingw

Step #2: a dangerous issue exists: the MinGW 64 own MSYS is someway broken (as I painfully discoverd by trial and error ...): the C:\msys64\bin\find.exe executable is badly missing.
Unhappily enough, Windows has its own FIND.EXE (and it's a completely different thing from the Linux find): this may cause several builds to misteriously fail ... but now you are well aware of this dangerous pitfall. You simply have to manually pick find.exe from the standard MinGW 32 / MSYS installation, then copying this executable file into C:\msys64\bin.

Preparing to use PKG-CONFIG:

You simply have to follow the same identical procedure already explained for standard MinGW 32 + MSYS

Learming to identify 32 bit and 64 bit exacutables

32 bit binaries file iconv.exe
PE32 executable for MS Windows (console) Intel 80386 32-bit

file libiconv-2.dll
PE32 executable for MS Windows (DLL) (console) Intel 80386 32-bit

64 bit binaries file iconv.exe
PE32+ executable for MS Windows (console) Mono/.Net assembly

file libiconv-2.dll
PE32+ executable for MS Windows (DLL) (console) Mono/.Net assembly

Setting up Windows own (SYSTEM) libraries

Some apps (and libraries) require to be actually linked against MS Windows system libraries. And this is a really puzzling task using MinGW 64.

Very shortly explained: the standard GCC tool-chain has the ability to link both .DLL dynamic libraries and .a static libraries.
When Windows own system libraries are required, this isn't at all an issue for MinGW 32: But when using MinGW 64 a catastrophical issue arises:

How to circumvent this dangerous pitfall

Once we have identified the reasons causing the above link failure, caring any nursing isn't too much difficult.
All right: we are now ready to start creating our Windows 64 bit software. Let's go !

Be warned: building on MinGW 64 is more or less the same as building on MinGW 32: anyway here and there some further patch is absolutely required.

Please, carefully read and verbatim follow any given instruction.


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.14
./configure
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 --disable-shared
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.8
export "INCLUDE_PATH=/usr/local/include"
export "LIBRARY_PATH=/usr/local/lib"
export "BINARY_PATH=/usr/local/bin"
make -f win32/Makefile.gcc
make install -f win32/Makefile.gcc

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

Important notice: you can now choose between two alternative implementations: Building the one or the other under Windows is absolutely a plain and easy task.

How-to-build libjpeg-turbo

Please note: the NASM assembler is absolutely required: if you don't have it already installed on your system, you can download and install now. cd libjpeg-turbo-1.4.2
./configure --host=x86_64-w64-mingw32 --prefix=/usr/local
make
make install-strip

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

How-to-build libjpeg

cd jpeg-8b
./configure
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.21
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/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.

Very important notice the ./configure script supporting the most recent version of libpng seems unable to correctly locate the zlib.h header file; you'll probably get a fatal error about missing zlib.h during the very first steps of make.
So you have to manually apply the following patch to circumvent this issue. Edit the Makefile file as follows:

223c223
< DEFAULT_INCLUDES = -I.
---
> DEFAULT_INCLUDES = -I. -I/usr/local/include

Save and exit; now you are finally ready to build.


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.2
./configure --build=x86_64-w64-mingw32
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.6
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/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 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.2
./configure --without-mutex
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 MinGW + MSYS.
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:

451c451
< libgeotiff_la_LDFLAGS = -version-info 3:1:1
---
> libgeotiff_la_LDFLAGS = -version-info 3:1:1 -no-undefined

Save and exit; now you are ready to build.

cd libgeotiff-1.4.1
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --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; building on Windows is an incredibly time consuming task.

cd geos-3.5.0
export "CXXFLAGS=-DHAVE_STD_ISNAN=1 -DHAVE_LONG_LONG_INT_64=1 -DGEOS_ENABLE_INLINE=ON -DGEOS_ENABLE_TESTS=ON"
./configure
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.1.1
./configure
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.2
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure
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 distclean
./configure --enable-gcov=yes
make
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.0.0e
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure
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 distclean
./configure --enable-gcov=yes
make
make check


Step 13) building libsqlite

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

Building under Windows is an easy task. cd sqlite-autoconf-3130000
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"
./configure
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.0.2h.tar.gz
cd openssl-1.0.2h
./Configure mingw64 --prefix=/usr/local shared
make depend
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-9.5.2
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --prefix=/usr/local --with-libraries=/usr/local/lib
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.4
./configure --without-python --with-zlib=/usr/local --with-lzma=/usr/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-Tology 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/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure
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/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
./configure --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. 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=/usr/local/lib/pkgconfig"

After this you are now ready to build as usual:

cd spatialite-tools-4.4.0-RC1
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --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-MinGW
cp static_bin/* /usr/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.2
mkdir msw_build
cd msw_build
export "CFLAGS=-I/usr/local/include"
export "CXXFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
../configure --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.2 for `i686-pc-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: wxWidgets is now configured for any further usage: but unhappily it assumes being on Win32, and this is obviously wrong.
So you must manually adjust the wx-config script (/usr/local/bin/wx-config) as follows:

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.6.3
./configure
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.11.95
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"

./configure --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.
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=/usr/local/lib/pkgconfig"

All right, your system configuration is ready to build pixman, so you can now: cd pixman-0.34.0
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
./configure
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.
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=/usr/local/lib/pkgconfig"

All right, your system configuration is ready to build libcairo, so you can now: cd cairo-1.14.6
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --disable-pthread
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
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.5.0
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --disable-threading
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 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 MinGW and MSYS.
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
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.7
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --without-threads
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 MinGW requirements. So manually edit the -/src/lib/openjp2/openjpeg.h source:
near line 80:
----------------------------------------
   #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 105:
----------------------------------------
   #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 /* MinGW */

cd openjpeg-2.1.0
mkdir build_dll
cd build_dll
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local \
-DZLIB_INCLUDE_DIR=/usr/local/include \
-DZLIB_LIBRARY=/usr/local/lib/libz.dll.a \
-DPNG_PNG_INCLUDE_DIR=/usr/local/include/libpng16 \
-DPNG_LIBRARY=/usr/local/lib/libpng16.dll.a \
-DTIFF_INCLUDE_DIR=/usr/local/include \
-DTIFF_LIBRARY=/usr/local/lib/libtiff.dll.a \
-DLCMS2_INCLUDE_DIR=/usr/local/include \
-DLCMS2_LIBRARY=/usr/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

Now manually edit the ../CMakeLists.txt file as follows:
near line 164:
----------------------------------------
< option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
> option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." OFF)

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

make openjp2
cp bin/libopenjp2.a /usr/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. 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=/usr/local/lib/pkgconfig"

After this you are now ready to build as usual:

cd curl-7.48.0
export "CPPFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --enable-shared=no --with-zlib=/usr/local
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 --enable-shared=yes --with-zlib=/usr/local
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.
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=/usr/local/lib/pkgconfig"

All right, your system configuration is ready to build librasterlite2, so you can now: cd librasterlite2-1.0.0-devel
export "CFLAGS=-I/usr/local/include -DCURL_STATICLIB"
export "LDFLAGS=-L/usr/local/lib"
./configure --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. 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=/usr/local/lib/pkgconfig"

After this you are now ready to build as usual:

cd spatialite_gui-2.0.0-devel
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --disable-rl2extra
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-MinGW
cp static_bin/* /usr/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=/usr/local/lib/pkgconfig"

After this you are now ready to build as usual:

cd librewms-1.0.0a
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/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-MinGW
cp static_bin/* /usr/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 MinGW/MSYS).
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/usr/local/include"
export "LDFLAGS=-L/usr/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

Warning: you have now to manually apply this patch to the Makefile before continuing.
+ CC = gcc
  prefix = /usr/local
  exec_prefix = ${prefix}

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=/usr/local/lib/pkgconfig"

After this you are now ready to build as usual:

cd dataseltzer-1.0.0
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/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-MinGW

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/usr/local/include"
export "LDFLAGS=-L/usr/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.


Back to the Gaia-SINS home page
last updated: 2016-04-07