Building TinyOWS with Visual C++ Express Edition 2008 using dependecies from OSGeo4W
по адресу http://gis-lab.info/qa/tinyows-compile-vce-eng.html
How to build TinyOWS on Windows.
This tutotial shows how to build latest TinyOWS code (trunk) on Windows XP Professional with Microsoft Visual C++ 2008 Express Edition using dependencies from OSGeo4W.
Preparation
First of all we need to do initial setup of the build environment. This described in appropriate article.
Important dependencies
Now we have to attend to the dependencies of TinyOWS. We need:
- libxml2 (>=2.6.20)
- iconv
- regex
- fastcgi
- Flex
- PostgreSQL (with libpq include files)
- PostGIS (1.5.x or higher)
Fortunately all dependecies, except last three items, can be installed with OSGeo4W installer. Choose "Advanced install" and standard directory (C:\OSGeo4W). If you install it in another directory be careful and correct all path below.
Download Flex and install it in C:\OSGeo4W.
Unfortunately PostgreSQL and PostGIS are not available in OSGeo4W so download and install PostgreSQL. Then using StackBuilder install PostGIS 1.5.0 or higher. If you can't use StackBuilder there is a standalone PostGIS installer.
Get TinyOWS sources
Download and install Subversion. Add subversion directory to the PATH environment variable.
Create directory for TinyOWS sources. Go to "Start → Run" and enter cmd, then go to directory created on previous step and checkout TinyOWS sources:
svn co http://www.tinyows.org/svn/tinyows/trunk
Building and installation
Assuming that PostgreSQL installed in default directory C:\Program Files\PostgreSQL\9.0 and TinyOWS sources are in D:\devel\cpp\tinyows directory.
Go to TinyOWS sources directory and edit nmake.opt file:
- find variable TINY_BASE (string 36) and point it to sources directory
TINY_BASE = D:\devel\cpp\tinyows
- find POSTGIS_DIR variable (string 102) and point it to the PostgreSQL
installation directory (quotes are important!)
POSTGIS_DIR ="c:\Program Files\PostgreSQL\9.0"
- enter path to libxml and iconv files (strings 112 and 125)
LIBXML_DIR=c:\OSGeo4W ICONV_DIR=c:\OSGeo4W
- setup regex location in string 143
REGEX_DIR=c:\OSGeo4W\include\regex-0.12
- strings 183 and 185 should looks like
POSTGIS_INC=-I"c:\Program Files\PostgreSQL\9.0\lib\libpq" -I"c:\Program Files\PostgreSQL\9.0\include" POSTGIS_LIB="c:\Program Files\PostgreSQL\9.0\lib\libpq.lib"
Save edits and close editor.
Edit file D:\devel\cpp\tinyows\Makefile.vc. At the end of the string 19 add C:\OSGeo4W\lib\libfcgi.lib, so string should look like this
CFLAGS=$(BASE_CFLAGS) $(TINY_CFLAGS) c:\OSGeo4W\lib\libfcgi.lib
Edit D:\devel\cpp\tinyows\src\ows_define.h.in. String 27 should be
#if TINYOWS_DEBUG
And string 32
#define TINYOWS_FCGI 1
If you don't want FastCGI support replace 1 with 0. IMPORTANT! Without FastCGI you get low performance.
Now edit file C:\OSGeo4W\include\regex-0.12\regex.c. Replace strings 4876-4880
regerror (errcode, preg, errbuf, errbuf_size)
int errcode;
const regex_t *preg;
char *errbuf;
size_t errbuf_size;
with the single string:
regerror (int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
That's all, now we are ready to compile. Open Visual Studio command prompt from "Start → Programs → Microsoft Visual C++ 2008 Express Edition → Visual Studio Tools → Visual Studio 2008 Command Prompt". Go to the TinyOWS source dir and run
nmake /f Makefile.vc
Process take a while, when it's done tinyows.exe (server application) and tiny.lib (library file) should appear in the sources directory.