Сборка TinyOWS используя Visual C++ Express Edition 2008 и компоненты OSGeo4W: различия между версиями

Материал из GIS-Lab
Перейти к навигации Перейти к поиску
(Новая страница: «{{Статья|Опубликована|tinyows-compile-vce}} {{Аннотация|Как самому собрать TinyOWS в Windows.}} Это руковод…»)
 
Нет описания правки
Строка 1: Строка 1:
{{Статья|Опубликована|tinyows-compile-vce}}
{{Статья|Опубликована|tinyows-compile-vce}}
{{Аннотация|Как самому собрать TinyOWS в Windows.}}
{{Аннотация|How to build TinyOWS on Windows.}}


Это руководство объясняет как собрать текущую версию TinyOWS (т. н. trunk) под Windows XP Professional с помощью Microsoft Visual C++ 2008 Express Edition имея готовые библиотеки OSGeo4W.
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 ===


Сначала необходимо выполнить первичную настройку сборочной среды. Этот процесс подробно описан в соответствующей [http://gis-lab.info/qa/build-env.html статье].
First of all we need to do initial setup of the build environment. This described in appropriate [http://gis-lab.info/qa/build-env-eng.html article].


=== Ключевые зависимости ===
=== Important dependencies ===


Теперь нужно позаботиться обо всех зависимостях TinyOWS. Нам потребуются:
Now we have to attend to the dependencies of TinyOWS. We need:  


# libxml2 (>=2.6.20)
# libxml2 (>=2.6.20)
Строка 17: Строка 17:
# fastcgi
# fastcgi
# Flex
# Flex
# PostgreSQL (с заголовочными файлами libpq)
# PostgreSQL (with <tt>libpq</tt> include files)
# PostGIS (1.5.x или старше)
# PostGIS (1.5.x or higher)


Все, кроме последних трех пунктов, можно получить при помощи установщика OSGeo4W. В дальнейшем мы предполагаем, что установка выполнена в каталог по умолчанию (<tt>C:\OSGeo4W</tt>). Если это не так, подставляйте свои пути.
Fortunately all dependecies, except last three items, can be installed with OSGeo4W installer. Choose "Advanced install" and standard directory (<tt>C:\OSGeo4W</tt>). If you install it in another directory be careful and correct all path below.


Загружаем [http://gnuwin32.sourceforge.net/downlinks/flex.php Flex] и устанавливаем его в <tt>C:\OSGeo4W</tt>.
Download [http://gnuwin32.sourceforge.net/downlinks/flex.php Flex] and install it in <tt>C:\OSGeo4W</tt>.


В составе OSGeo4W есть только клиентская библиотека PostgreSQL — libpq, поэтому загружаем и устанавливаем [http://www.postgresql.org/download/windows PostgreSQL] нужной версии (например, 9.0.4). Затем, при помощи StackBuilder устанавливаем PostGIS 1.5.0 или более новую. Если по каким-либо причинам воспользоваться StackBuilder'ом не получается, установить PostGIS можно при помощи [http://postgis.refractions.net/download/windows/ установщика].
Unfortunately PostgreSQL and PostGIS are not available in OSGeo4W so download and install [http://www.postgresql.org/download/windows PostgreSQL]. Then using StackBuilder install PostGIS 1.5.0 or higher. If you can't use StackBuilder there is a standalone PostGIS [http://postgis.refractions.net/download/windows/ installer].


=== Получение кода TinyOWS ===
=== Get TinyOWS sources ===


Загрузите и установите клиент для [http://subversion.apache.org/packages.html#windows Subversion]. Добавьте каталог <tt>subversion</tt> к переменной PATH.
Download and install [http://subversion.apache.org/packages.html#windows Subversion]. Add <tt>subversion</tt> directory to the PATH environment variable.


Создайте папку, в которой будет находиться код TinyOWS. Выполните «Пуск Выполнить» и введите <tt>cmd</tt>, после чего перейдите в созданную папку и получите исходный код TinyOWS с помощью следующей команды:
Create directory for TinyOWS sources. Go to "Start Run" and enter <tt>cmd</tt>, then go to directory created on previous step and checkout TinyOWS sources:


<pre>svn co http://www.tinyows.org/svn/tinyows/trunk</pre>
<pre>svn co http://www.tinyows.org/svn/tinyows/trunk</pre>


=== Сборка и установка ===
=== Building and installation ===


Далее предполагается, что PostgreSQL установлен в каталог по умолчанию <tt>C:\Program Files\PostgreSQL\9.0</tt>, а исходный код TinyOWS находится в каталоге <tt>D:\devel\cpp\tinyows</tt>. Если вы выполняли установку или загружали код в другой каталог, вносите необходимые изменения там, где это необходимо.
Assuming that PostgreSQL installed in default directory <tt>C:\Program Files\PostgreSQL\9.0</tt> and TinyOWS sources are in <tt>D:\devel\cpp\tinyows</tt> directory.


Переходим в созданный на предыдущем шаге каталог с исходными кодами TinyOWS, открываем в текстовом редакторе файл <tt>nmake.opt</tt> и начинаем редактировать:
Go to TinyOWS sources directory and edit <tt>nmake.opt</tt> file:


<ol>
<ol>
   <li>находим переменную TINY_BASE (в нашем случае это строка 36) и указываем
   <li>find variable TINY_BASE (string 36) and point it to sources directory<br>
  путь в каталогу исходных кодов TinyOWS<br>
   <pre>TINY_BASE = D:\devel\cpp\tinyows</pre></li>
   <pre>TINY_BASE = D:\devel\cpp\tinyows</pre></li>
   <li>при желании изменяем  переменную BINDIR (строка 46). Путь, указанный
   <li>find POSTGIS_DIR variable (string 102) and point it to the PostgreSQL
  в этой переменной определяет расположение скомпилированного TinyOWS
   installation directory (quotes are important!)<br>
  после выполнения команды nmake /f Makefile.vc install<br>
  <pre>BINDIR = $(TINY_BASE)\bin</pre></li>
  <li>находим переменную POSTGIS_DIR (строка 102) и указываем путь к
   установленной PostgreSQL (обратите внимение на кавычки!)<br>
   <pre>POSTGIS_DIR ="c:\Program Files\PostgreSQL\9.0"</pre></li>
   <pre>POSTGIS_DIR ="c:\Program Files\PostgreSQL\9.0"</pre></li>
   <li>указываем каталог с файлами libxml и iconv (строки 112 и 125). Так
   <li>enter path to libxml and iconv files (strings 112 and 125)<br>
  как эти библиотеки мы установили при помощи OSGeo4W, то каталог будет
  один и тот же<br>
   <pre>LIBXML_DIR=c:\OSGeo4W
   <pre>LIBXML_DIR=c:\OSGeo4W
ICONV_DIR=c:\OSGeo4W</pre></li>
ICONV_DIR=c:\OSGeo4W</pre></li>
   <li>в строке 143 задается расположение файлов библиотеки regex<br>
   <li>setup regex location in string 143<br>
   <pre>REGEX_DIR=c:\OSGeo4W\include\regex-0.12</pre></li>
   <pre>REGEX_DIR=c:\OSGeo4W\include\regex-0.12</pre></li>
   <li>строки 183 и 185 приводятся к виду<br>
   <li>strings 183 and 185 should looks like<br>
   <pre>POSTGIS_INC=-I"c:\Program Files\PostgreSQL\9.0\lib\libpq" -I"c:\Program Files\PostgreSQL\9.0\include"
   <pre>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"</pre></li>
POSTGIS_LIB="c:\Program Files\PostgreSQL\9.0\lib\libpq.lib"</pre></li>
</ol>
</ol>


Сохраняем изменения и закрываем редактор.
Save edits and close editor.


Редактируем файл <tt>D:\devel\cpp\tinyows\Makefile.vc</tt>. В конец строки 19 добавляем <tt>C:\OSGeo4W\lib\libfcgi.lib</tt>, т.е. после редактирования она должна выглядеть так
Edit file <tt>D:\devel\cpp\tinyows\Makefile.vc</tt>. At the end of the string 19 add <tt>C:\OSGeo4W\lib\libfcgi.lib</tt>, so string should look like this


<pre>CFLAGS=$(BASE_CFLAGS) $(TINY_CFLAGS) c:\OSGeo4W\lib\libfcgi.lib</pre>
<pre>CFLAGS=$(BASE_CFLAGS) $(TINY_CFLAGS) c:\OSGeo4W\lib\libfcgi.lib</pre>


Открываем файл <tt>D:\devel\cpp\tinyows\src\ows_define.h.in</tt>. Строку 27 приводим к виду
Edit <tt>D:\devel\cpp\tinyows\src\ows_define.h.in</tt>. String 27 should be


<pre>#if TINYOWS_DEBUG</pre>
<pre>#if TINYOWS_DEBUG</pre>


Строка 32 должна выглядеть так
And string 32


<pre>#define TINYOWS_FCGI                1</pre>
<pre>#define TINYOWS_FCGI                1</pre>


Если поддержка FastCGI не нужна, вместо 1 поставьте 0. '''ВАЖНО'''! Отсутствие поддержки FastCGI отрицательно скажется на производительности.
If you don't want FastCGI support replace 1 with 0. '''IMPORTANT'''! Without FastCGI you get low performance.


Теперь надо отредактировать файл <tt>C:\OSGeo4W\include\regex-0.12\regex.c</tt>. Открываем его в текстовом редакторе, и строки 4876-4880
Now edit file <tt>C:\OSGeo4W\include\regex-0.12\regex.c</tt>. Replace strings 4876-4880


<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
Строка 89: Строка 82:
</syntaxhighlight>
</syntaxhighlight>


заменям следующей строкой
with the single string:


<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
Строка 95: Строка 88:
</syntaxhighlight>
</syntaxhighlight>


Подготовка окончена, переходим к компиляции. Откройте командную строку Visual Studio выполнив «Пуск Программы → Microsoft Visual C++ 2008 Express Edition → Visual Studio Tools → Visual Studio 2008 Command Prompt». Перейдите в каталог с исходным кодом TinyOWS и выполните:
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


<syntaxhighlight lang="dos">
<syntaxhighlight lang="dos">
Строка 101: Строка 94:
</syntaxhighlight>
</syntaxhighlight>


Если компиляция завершится без ошибок, то корне каталога с исходным кодом появятся файлы <tt>tinyows.exe</tt> (сам сервер) и <tt>tiny.lib</tt> (библиотечный файл). Файл <tt>tinyows.exe</tt> необходимо скопировать в каталог <tt>cgi-bin</tt> web-сервера.
Process take a while, when it's done <tt>tinyows.exe</tt> (server application) and <tt>tiny.lib</tt> (library file) should appear in the sources directory.


=== Ссылки по теме ===
=== Ссылки по теме ===


* [http://tinyows.org/trac TinyOWS Project]
* [http://tinyows.org/trac TinyOWS Project]
* [http://gis-lab.info/qa/build-env.html Подготовка к компиляции ПО ГИС используя Visual C++ Express Edition 2008 и компоненты OSGeo4W]
* [http://gis-lab.info/qa/build-env-eng.html Preparing to build GIS software using Visual C++ Express Edition 2008 and OSGeo4W components]
* [http://gis-lab.info/qa/gdal-compile.html Сборка GDAL используя Visual C++ Express Edition 2008]
* [http://gis-lab.info/qa/gdal-compile.html Сборка GDAL используя Visual C++ Express Edition 2008]
* [http://gis-lab.info/qa/qgis-compile-vce.html Сборка QGIS используя Visual C++ Express Edition 2008 и компоненты OSGeo4W]
* [http://gis-lab.info/qa/qgis-compile-vce.html Сборка QGIS используя Visual C++ Express Edition 2008 и компоненты OSGeo4W]

Версия от 12:22, 21 июля 2012

Эта страница опубликована в основном списке статей сайта
по адресу http://gis-lab.info/qa/tinyows-compile-vce.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:

  1. libxml2 (>=2.6.20)
  2. iconv
  3. regex
  4. fastcgi
  5. Flex
  6. PostgreSQL (with libpq include files)
  7. 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:

  1. find variable TINY_BASE (string 36) and point it to sources directory
    TINY_BASE = D:\devel\cpp\tinyows
  2. 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"
  3. enter path to libxml and iconv files (strings 112 and 125)
    LIBXML_DIR=c:\OSGeo4W
    ICONV_DIR=c:\OSGeo4W
  4. setup regex location in string 143
    REGEX_DIR=c:\OSGeo4W\include\regex-0.12
  5. 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.

Ссылки по теме