Version 21 (modified by robe, 13 years ago) ( diff )

Back to Windows Compile

Compiling PostGIS 1.5 under VC++

This is still a work in progress: A good tool for extracting tar, gz, and bz files:

Compile PostgreSQL under VC++ 2008 (express or Studio)

Note that if you are compiling for 64-bit, Express is not supported so you have to use VC++ Professional or above. Full details here

We will just cover enough to be able to compile PostGIS so will not be compiling with additional dependencies

  1. Install Active State ActivePerl (5.8+)
  2. Download PostgreSQL source and Extract PostgreSQL 9.0 source tar ball into folder C:\Projects\PostgreSQL\postgresql-9.0.1win
  3. Create a file C:\Projects\PostgreSQL\postgresql-9.0.1win\src\tools\msvc\

Add add a line — note in our case — we compile with mingw usually, so we are completely overwriting the path with one that doesn't contain mingw because mingw and VC++ don't play well together when compiling PostgreSQL

#-- starts here --
$ENV{PATH}='C:\perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\Support Tools\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\opt\gtk\bin;C:\Program Files\R\R-2.10.1\bin';
$ENV{PATH} = $ENV{PATH} . ';C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages';
# -- ends here --
  1. Open up VC ++ commandling from: start→Programs→Visual c++ Express 2008 →Visual Studio Tools
  1. cd C:\Projects\PostgreSQL\postgresql-9.0.1win\src\tools\msvc
  2. clean.bat
  3. build.bat

Compile GEOS 3.3.0 or 3.2.2 under VC++

  1. download
  2. extract into c:\projects\geos\geos-3.2.2win
  3. Launch start-programs→MS visual c++ 2008→Visual Studio tools command prompt
  4. cd c:\projects\geos\geos-3.2.2win
  5. Following nmake directions from
nmake /f MSVC_VER=1400
  1. The above will generate 2 dlls in the c:\projects\geos\geos-3.2.2win\source folder (geos.dll, geos_c.dll

Compile Proj under VC++

  1. download
  2. extract into c:\projects\proj\proj-4.7.0-win
Note: See TracWiki for help on using the wiki.