2.2. Building and Installing on Windows (MinGW tools)

This section describes how to build and install pgtcl-ng on Windows systems using MinGW. Building on Windows systems is less automated than on Unix-like systems, and you are advised to fetch a binary release instead of building it yourself. If you get a binary release, follow the instructions in the release to install it. If you want to compile your own pgtcl-ng using MinGW, read the following sections. A Makefile for MinGW is supplied in the source release. You will edit and use the Makefile to build pgtcl-ng for Windows, as described below.

2.2.1. Prerequisites for Windows Systems (MinGW tools)

Here are the prerequisites for building pgtcl-ng on Windows using MinGW. Note that specific versions of each product are mentioned. Newer versions will probably work, and older versions are less likely to work. The versions listed here have been tested.


This section applies to 32-bit Windows systems, using the 32-bit MinGW project tools and 32-bit versions of Tcl and PostgreSQL. There is currently no support for building with 64-bit components or systems.

To build pgtcl-ng on Windows with MinGW tools, you need:

  • ActiveState ActiveTcl Tcl/Tk version 8.6.1 or 8.5.15, installed with libraries and header files. Note: You may be able to use a MinGW-built Tcl/Tk instead, but this has not been tested.

  • MinGW tools, installed. The exact minimum package requirements are not clear, but you just need to be able to compile programs with GCC. These packages were used: binutils, gcc, gcc-core, libgcc, libgmp, libmpc, libmpfr, libpthread, make, mingwrt, and w32api.

  • EnterpriseDB PostgreSQL for Windows 9.3.x or 9.2.x binary releases. You may download the Zip file instead of using the installer if you aren't actually going to run the PostgreSQL server on Windows. (Go to http://www.postgresql.org and follow the links to Downloads, then Windows to get to the EnterpriseDB Zip package.) All you need from the download is the include files and the library files (include and bin directories). But if you are not using the EnterpriseDB Installer, you need to make sure the target PC(s) have the required Microsoft Visual C++ Redistributables (including msvcr*.dll), which are needed by the PostgreSQL libraries. You do not need PostgreSQL sources. Note: You may be able to use a MinGW-built PostgreSQL instead, but this has not been tested.

2.2.2. Building and Installing - Windows Systems (MinGW tools)

To build with MinGW, simply edit the Makefile mingw.mak with any text editor and set the pathnames as shown below. Note that you can use either forward (/) or backward (\) slashes when specifying pathnames in this Makefile.

  1. Change directory to the unpacked pgtclng source distribution. For example:

    C:\>  cd c:\src\pgtcl

    Edit the file mingw.mak as follows:

    1. Define PGSQL to point to the top-level directory of your PostgreSQL installation.

    2. Define TCL to point to the top of your Tcl installation directory.

    3. Check the TCLLIB definition and the associated comments. If you are building with Tcl stubs, just change the version number in the definition, for example tclstub86 for Tcl-8.6.x. If you are not building with Tcl stubs, change the definition to the non-stubs library, and also comment out the STUBS definition line.

    4. Check the PGDEFS definition. The default enables all features, but requires PostgreSQL-9.3.0 or higher. If you are building with PostgreSQL-9.2.x or lower, follow the instructions in the file to change PGDEFS. (This applies to pgtclng-2.1.0 and higher.)

    Now build libpgtcl:

    C:\>  mingw32-make -f mingw.mak

    This will create the file libpgtcl.dll.

To use pgtcl on Windows, you will need the libpgtcl.dll and also the EnterpriseDB PostgreSQL loadable libraries. The main dependency is the front-end library libpq.dll, but that has other dependent libraries which are distributed with EnterpriseDB's PostgreSQL. In order to run pgtcl applications, you should have the entire EnterpriseDB PostgreSQL distribution bin directory, and it must be in your PATH before loading libpgtcl.dll. Refer to Chapter 3, Loading pgtcl into an Application for information about using these from your application.


The MinGW Makefile does not currently contain installation commands.

SourceForge.net Logo

This version of the manual was produced for the Pgtcl-ng Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the Pgtcl-ng project downloads area.