2ndQuadrant is now part of EDB

Bringing together some of the world's top PostgreSQL experts.

2ndQuadrant | PostgreSQL
Mission Critical Databases
  • Contact us
  • EN
    • FR
    • IT
    • ES
    • DE
    • PT
  • Support & Services
  • Products
  • Downloads
    • Installers
      • Postgres Installer
      • 2UDA – Unified Data Analytics
    • Whitepapers
      • Business Case for PostgreSQL Support
      • Security Best Practices for PostgreSQL
    • Case Studies
      • Performance Tuning
        • BenchPrep
        • tastyworks
      • Distributed Clusters
        • ClickUp
        • European Space Agency (ESA)
        • Telefónica del Sur
        • Animal Logic
      • Database Administration
        • Agilis Systems
      • Professional Training
        • Met Office
        • London & Partners
      • Database Upgrades
        • Alfred Wegener Institute (AWI)
      • Database Migration
        • International Game Technology (IGT)
        • Healthcare Software Solutions (HSS)
        • Navionics
  • Postgres Learning Center
    • Webinars
      • Upcoming Webinars
      • Webinar Library
    • Whitepapers
      • Business Case for PostgreSQL Support
      • Security Best Practices for PostgreSQL
    • Blog
    • Training
      • Course Catalogue
    • Case Studies
      • Performance Tuning
        • BenchPrep
        • tastyworks
      • Distributed Clusters
        • ClickUp
        • European Space Agency (ESA)
        • Telefónica del Sur
        • Animal Logic
      • Database Administration
        • Agilis Systems
      • Professional Training
        • Met Office
        • London & Partners
      • Database Upgrades
        • Alfred Wegener Institute (AWI)
      • Database Migration
        • International Game Technology (IGT)
        • Healthcare Software Solutions (HSS)
        • Navionics
    • Books
      • PostgreSQL 11 Administration Cookbook
      • PostgreSQL 10 Administration Cookbook
      • PostgreSQL High Availability Cookbook – 2nd Edition
      • PostgreSQL 9 Administration Cookbook – 3rd Edition
      • PostgreSQL Server Programming Cookbook – 2nd Edition
      • PostgreSQL 9 Cookbook – Chinese Edition
    • Videos
    • Events
    • PostgreSQL
      • PostgreSQL – History
      • Who uses PostgreSQL?
      • PostgreSQL FAQ
      • PostgreSQL vs MySQL
      • The Business Case for PostgreSQL
      • Security Information
      • Documentation
  • About Us
    • About 2ndQuadrant
    • 2ndQuadrant’s Passion for PostgreSQL
    • News
    • Careers
    • Team Profile
  • Blog
  • Menu Menu
You are here: Home1 / Blog2 / Craig's PlanetPostgreSQL3 / Simplifying compilation of PostgreSQL on Windows
craig.ringer

Simplifying compilation of PostgreSQL on Windows

January 9, 2013/2 Comments/in Craig's PlanetPostgreSQL /by craig.ringer

As part of some internal continuous integration and testing work, I’ve put together some scripts to simplify the compilation of PostgreSQL on Windows.

PostgreSQL its self is pretty easy to compile on Windows. You download and install ActiveState Perl and Visual Studio or the Microsoft Windows SDK, unpack a PostgreSQL source tree, copy config_default.pl to src\tools\msvc\config.pl, edit it to reflect your environment, open an SDK command prompt for your Windows SDK version / Visual Studio version, cd to the PostgreSQL directory, and run src\tools\msvc\build.pl. Not too bad.

The trouble is getting the dependencies built, and that’s what I’m working on improving. The scripts I’ve published at github are a step toward that. I’ve written some NMake files and a wrapper Perl script that will download dependencies, compile them, and create a config.pl that points the PostgreSQL build at them. It can build a source tree you’ve checked out yourself, or it can automatically handle checking your specified PostgreSQL version(s) out from git.

At present the scripts are known to work with the Microsoft Windows SDK 7.1, Microsoft’s free stand-alone SDK. They do not yet work with Visual Studio, but that should be along shortly.

Currently the tools document the unattended installation procedure for the required 3rd party tools and libraries (Perl, Python, TCL, Windows SDK, etc) and will download and compile zlib for you. I want to add support for more of PostgreSQL’s optional dependencies, automating their installation to prevent everyone from having to suffer through the “fun” of compiling open source libraries like gettext on Windows. It’s just a matter of having the time. The mismash of precompiled binaries recommended by the documentation for compiling on Windows won’t work for x64 builds and isn’t very safe anyway; ideally all the libraries should be compiled with the same compiler and linked to the same runtime.

These scripts are primarily intended to satisfy internal requirements for compiling a variety of PostgreSQL versions and configurations under a Jenkins CI server, but I’d value any use reports or feedback.

Oh: Why perl? Because the PostgreSQL build scripts are written in Perl, so it’s the obvious first choice. I would’ve preferred Python or Powershell, but this way there isn’t an additional dependency above what PostgreSQL its self requires. NMake alone doesn’t offer the text processing features I needed to (for example) extract the Windows SDK version from the output of cl.exe.

To try the scripts out, see the README in the repository. I won’t repeat that documentation here.

UPDATE: I’ve also done some work on extension compilation now, see this follow-up post.

Tags: PostgreSQL, windows
Share this entry
  • Share on Facebook
  • Share on Twitter
  • Share on WhatsApp
  • Share on LinkedIn
2 replies
  1. Alexander Korotkov
    Alexander Korotkov says:
    January 9, 2013 at 3:06 pm

    Building PostgreSQL on Windows is very complicated. Very cool! Thanks!

    Reply

Trackbacks & Pingbacks

  1. Testing PostgreSQL updates/patches in a separate install says:
    August 30, 2013 at 3:34 am

    […] PostgreSQL on Windows is totally different; see this related post […]

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Get in touch with us!

Recent Posts

  • Random Data December 3, 2020
  • Webinar: COMMIT Without Fear – The Beauty of CAMO [Follow Up] November 13, 2020
  • Full-text search since PostgreSQL 8.3 November 5, 2020
  • Random numbers November 3, 2020
  • Webinar: Best Practices for Bulk Data Loading in PostgreSQL [Follow Up] November 2, 2020

Featured External Blogs

Tomas Vondra's Blog

Our Bloggers

  • Simon Riggs
  • Alvaro Herrera
  • Andrew Dunstan
  • Craig Ringer
  • Francesco Canovai
  • Gabriele Bartolini
  • Giulio Calacoci
  • Ian Barwick
  • Marco Nenciarini
  • Mark Wong
  • Pavan Deolasee
  • Petr Jelinek
  • Shaun Thomas
  • Tomas Vondra
  • Umair Shahid

PostgreSQL Cloud

2QLovesPG 2UDA 9.6 backup Barman BDR Business Continuity community conference database DBA development devops disaster recovery greenplum Hot Standby JSON JSONB logical replication monitoring OmniDB open source Orange performance PG12 pgbarman pglogical PG Phriday postgres Postgres-BDR postgres-xl PostgreSQL PostgreSQL 9.6 PostgreSQL10 PostgreSQL11 PostgreSQL 11 PostgreSQL 11 New Features postgresql repmgr Recovery replication security sql wal webinar webinars

Support & Services

24/7 Production Support

Developer Support

Remote DBA for PostgreSQL

PostgreSQL Database Monitoring

PostgreSQL Health Check

PostgreSQL Performance Tuning

Database Security Audit

Upgrade PostgreSQL

PostgreSQL Migration Assessment

Migrate from Oracle to PostgreSQL

Products

HA Postgres Clusters

Postgres-BDR®

2ndQPostgres

pglogical

repmgr

Barman

Postgres Cloud Manager

SQL Firewall

Postgres-XL

OmniDB

Postgres Installer

2UDA

Postgres Learning Center

Introducing Postgres

Blog

Webinars

Books

Videos

Training

Case Studies

Events

About Us

About 2ndQuadrant

What does 2ndQuadrant Mean?

News

Careers 

Team Profile

© 2ndQuadrant Ltd. All rights reserved. | Privacy Policy
  • Twitter
  • LinkedIn
  • Facebook
  • Youtube
  • Mail
Barman 1.1.2 released It’s a long way to Melbourne if you want to rock ‘n’ roll...
Scroll to top
×