Documentation home Previous page Next page

Compiling PostGIS GDO

PostGIS GDO is written in C++ and makefile for MinGW is provided. PostGIS directly links libpq, the PostgreSQL front end library. If you want to compile PostGIS GDO by another compiler, you might need to update or re-create the makefile to suit to your particular compiler.

Compilation tools

The source code contains no special libraries, such us MFC ar ATL, so the project can virtually be compiled by any Win32 target compatible compiler.

Moreover, to compile the connection properties control, MIDL is required. MIDL comes with any version of MS Visual Studio. You may need to add some path to the environment variable to run MIDL successfully.

Compiling with MinGW (GNU C++ compiler)

To compile the source code with MinGW, extract the content of the zip archive into any directory. Create a "Build" subdirectory of your root project directory and type "compile c" at command prompt. The "c" switch is used to build also the connection properties control, otherwise only the PostGISGDO and DBUtilities are compiled. Another defined switch is "a" (so "compile a") which deletes all intermediate files, thus rebuilding the whole project in fact.

Compiling with MS VC++ (VS 2010 version)

Starting with PostGIS GDO it is also possible to compile the libraries with MS VC++. The versions of MS compiler tested are: 2005 - does not work since resource compiler does not understand the Vista compatible icon format, 2010 - this seems to work OK. To compile the project, you need either the full PostgreSQL installation, or to extract the compiled PostgreSQL binaries somewhere on your hard disc. Then change the path to the PostgreSQL Include folder in "" and run the "compilems.bat" file.
You may get some errors, which most likely means that some VS folders need to be add to the PATH environment variable.

The compiled binaries are, unlike the version compiled with MinGW, dependent on some other dll's from the PostgreSQL binary folder. You can download the compiled version with all mandatory dll's in the "PostGIS GDO xxx MS" release under the Downloads tab.

The version compiled with MS VC++ might fix the problems with loading the PostGIS GDO dll on Windows Vista or Windows 7.

Post-compilation steps

After you successfully compile the project, you may need to register GMPsgCtl.ocx and PostGISGDO.dll by the Regsvr32 utility.

Preprocessor switches, debugging

There is one symbol definition which controls the PostGIS GDO behavior. The symbol is called DBGLEVEL. If DBGLEVEL is defined, the GDO server will create a file called PostGISGDO.log in the same directory where the binary PostGISGDO.dll file resides. Variety of information is logged in that file during the process execution. The log details depends on the DBGLEVEL numeric value, starting from 0 - the least comprehensive log and ending with 3 - the most comprehensive log. The log information can be very helpful when debugging various problems.

Each start of GDO server will overwrite the previous log. If no DBGLEVEL symbol is defined, no log file is created.

Note: If you change the DBGLEVEL, the whole project needs to be rebuilt.

Compiling the coordinate systems resource

Both the GDO server and DB Utilities link a binary file "csres.bin". This file is delivered with the project and it is located in the "Common" folder. See Appendix 2 for the purpose. This binary file can be recreated using the MakeCSRes.exe utility. To rebuilt the resource file, use the MakeCSRes.bat batch file. After you modified the csres.bin, the whole project must be rebuilt.

Looking into future

The code contains no or minimum platform specific symbols, so it should be very easy to recompile it for the 64bit platform.

Documentation home Previous page Next page

Last edited Feb 29, 2012 at 8:36 PM by pkrejcir, version 3


mabram Jun 24, 2011 at 1:20 PM 
The coordinate System I need (EPSG31466) isn't supported by the PostGIS GDO. So I copied the file "epsg31466.csf" to the directory "CoordSystems". Then I rebuild the resource using "MakeCSRes.bat".
After that I tried to compile the project using "compile.bat c" with minGW, but "PostGISGDO.dll" was not rebuild.

In file included from PostGISGDO/PostGISGDO.hpp:19:0,
from PostGISGDO/PostGISClsFactory.hpp:20,
from PostGISGDO/PostGIS.cpp:20:
PostGISGDO/../Common/GDOUtils.hpp:38:1: warning: 'typedef' was ignored in this declaration
In file included from PostGISGDO/PostGISGDO.hpp:21:0,
from PostGISGDO/PostGISClsFactory.hpp:20,
from PostGISGDO/PostGIS.cpp:20:
PostGISGDO/PGSCols.hpp:30:1: warning: 'typedef' was ignored in this declaration
In file included from PostGISGDO/PostGISGDO.hpp:23:0,
from PostGISGDO/PostGISClsFactory.hpp:20,
from PostGISGDO/PostGIS.cpp:20:
PostGISGDO/PGSRecordset.hpp:338:17: error: extra qualification 'GRecordsets::' on member 'FindRecordset'
PostGISGDO/PostGIS.cpp: In function 'HRESULT DllGetClassObject(const CLSID&, const IID&, void**)':
PostGISGDO/PostGIS.cpp:67:41: warning: deprecated conversion from string constant to 'CHAR*'
mingw32-make: *** [PostGIS.o] Error 1

Can anyone help me to resolve the problem?