last updated: 2014-09-30
Back to the Gaia-SINS home page

Index of contents


the MinGW + MSYS environment

MinGW is an open source C/C++ compiler based on the popular gcc; MSYS 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.

We'll suppose you are using the latest MinGW and MSYS
So, if you have installed anything using the default settings [the wisest thing to do], now you have the following path correspondence:

C:\MinGW\msys\1.0\local will be mapped [in the MSYS own perspective] as: /usr/local

Accordingly, this one will be the standard home for any software you'll then build and install.

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

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


Important notice: the most recent MinGW update has a serious issue: it contains a broken gettext-0.18.3.2 package causing odd and puzzling error messages like this one:
libtool: link: cannot find the library `/home/keith/staged/mingw32/lib/libiconv.la' or unhandled argument `/home/keith/staged/mingw32/lib/libiconv.la'

Fixing this annoying issue is basically simple: you are just required to manually re-install the previous gettext-0.18.3.1 package.
  1. close any MSYS shell currently opened.
  2. open a standard Windows shell (CMD.exe), then execute the following commands:
    • set PATH=%PATH%;C:\mingw\bin
    • mingw-get upgrade "gettext=0.18.3.1-1*"
  3. all done; you can now safely restart a new MSYS shell.


preparing to use PKG-CONFIG

pkg-config is a well known package configuration manager; it's widely used by many open sorce packages.
Unhappily pkg-config doesn't comes already installed once you've installed MinGW and MSYS.
And, to make things worst, installing pkg-config on Windows is quite difficult and not at all straighforward.

First of all, you must download pkg-config.exe from GTK+ for Windows.
Then you can simply unzip this downloaded zip-file, and then copy the pkg-config.exe executable into /MinGW/bin

That's not enough: this executable depends on the GLib DLL.
So you must download GLib DLL too, always from GTK+ for Windows.
Once again, you have to unzip this downloaded zip-file, and then copy liglib-2.0-0.dll into /MinGW/bin

You have not yet finished: pkg-config still has an unresolved DLL dependency.
But this time simply performing a trivial copy will suffit. So you must now open an MSYS shell:

cd C:/MinGW/bin
cp libintl-8.dll intl.dll

And this time that's really all: now you have pkg-confif properly installed and ready to work.


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
make -f win32/Makefile.gcc

Now you simply have to manually copy the following files:

cp zlib1.dll /usr/local/bin
cp zconf.h zlib.h /usr/local/include
cp libz.a /usr/local/lib
cp libz.dll.a /usr/local/lib

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.3.1
./configure --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.12
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:

217c217
< 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.0.7
./configure
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.3
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.8.0
./configure
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:0:1
---
> libgeotiff_la_LDFLAGS = -version-info 3:0:1 -no-undefined

Save and exit; now you are ready to build.

cd libgeotiff-1.4.0
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; cd geos-3.4.2
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.0
./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.0g
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.0b
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 implementing the SQLite DBMS engine
Depends on: nothing
Required by: libspatialite, librasterlite

Building under Windows is an easy task. cd sqlite-autoconf-3080600
export "CFLAGS=-DSQLITE_ENABLE_STAT3=1 -DSQLITE_ENABLE_TREE_EXPLAIN=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1"
./configure
make
make install-strip

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


Step 14) building OpenSSL

Important notice: if you are not interested in building liblwgeom you can directly jump to libspatialite

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.1i.tar.gz
cd openssl-1.0.1i
./Configure mingw --prefix=/usr/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 strictly required by liblwgeom; if you aren't interested in supporting liblwgeom you can directy jump to libspatialite

Depends on: libz, OpenSSL
Required by: liblwgeom
Building under Windows is an easy task. cd postgresql-9.3.4
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 strictly required by liblwgeom and is an optional dependency for libspatialite.
If you aren't interested in supporting liblwgeom you can directy jump to libspatialite

Depends on: libz, libiconv
Required by: liblwgeom, libspatialite
Building under Windows is an easy task. cd libxml2-2.9.1
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --without-python
make
make install-strip

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


Step 17) building liblwgeom

liblwgeom is a library implementing several usefull geometry functions; it was initially intended to support PostGIS, but it's now a self-standing library.
i.e. PostGIS depends on liblwgeom, but liblwgeom doesn't depends on PostGIS.
Anyway a historical legacy still exists; in order to install liblwgeom you are nessarily forced to build PostGIS, because a standalone build system doesn't exists.

Depends on: libproj, libgeos, libxml2, PostgreSQL
Required by: libspatialite (optional dependency)
Building under Windows is an easy task. cd postgis-2.1.4
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure --without-raster
make
make install

This will build and install the static library alone; building the corresponding DLL seems to be an unsupported option.

That's not all: you are now required to manually edit the /usr/local/lib/liblwgeom.la file, applying this patch:
11c11
< library_names=''
---
> library_names='liblwgeom.a'

All right; you are now ready to use liblwgeom.


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.2.0
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
./configure --target=mingw32 --enable-lwgeom=yes
make
make install-strip

Please note: the above example assumes that liblwgeom 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 distclean
./configure --target=mingw32 --enable-gcov=yes
make
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.2.0
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. Very important notice: there is a broken/defective system header in ming 4.8.1; you absolutely have to fix it before attempnting to configure wxWidget
So open some text editor and apply the following patch to /include/commctrl.h:
2217c2218
< #define TV_DISPINFO __AW(NMTVDISPINFO)
---
> #define TV_DISPINFO NMTVDISPINFO


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: 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.5.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.1
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.

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.32.6
./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.12.16
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure
make
make install-strip

Important notice: you'll probably get a fatal error at some time during the compilation: to resolve this issues you should manually edit the cairo-1.12.16/util/cairo-missing/cairo-missing.h source:
near line 44:
------------
< #ifdndef _SSIZE_T_DEFINED
< typedef SSIZE_T ssize_t;
< #endif
---
delete all three rows

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.0
./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.4.1
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 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.6
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.38.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

That's not all: you are now required to manually edit the /usr/local/lib/libcurl.la file, applying this patch:
14c14
< old_library=''
---
> old_library='libcurl.a'

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-0.5
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-1.7.1
export "CFLAGS=-I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib"
./configure
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
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 34) 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 = /usr/local/include
Line 82: replace ZLIBDIR = $(SRCDIR)/../zlib-1.2.6 as: ZLIBDIR = /usr/local/lib
Line 89: replace OPENSSLINCDIR = $(SRCDIR)/../openssl-1.0.0g/include as: OPENSSLINCDIR = /usr/local/include
Line 90: replace OPENSSLLIBDIR = $(SRCDIR)/../openssl-1.0.0g as: OPENSSLLIBDIR = /usr/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: 2014-09-30