Compile from source using latest Microsoft Windows SDK

From: Peifeng Qiu <pqiu(at)pivotal(dot)io>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Compile from source using latest Microsoft Windows SDK
Date: 2019-03-28 15:01:26
Message-ID: CABmtVJhw1boP_bd4=b3Qv5YnqEdL696NtHFi2ruiyQ6mFHkeQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, hackers.

The current Windows build system supports compiling with Windows SDK up to
v8.1. When building with the latest Windows SDK v10 which is the default
for Visual Studio 2017, we will get the following error:

error MSB8036: The Windows SDK version 8.1 was not found.

When the build system generates projects files for MSBuild to consume, it
doesn't include a SDK version number. Then MSBuild will assume v8.1 as
default.
But if we only install the latest v10 but not v8.1, MSBuild will error out.

If we open the Visual Studio solution and manually chooses the correct
Windows SDK version in project property dialog, it will compile without
problem.
By doing this, we actually add a "WindowsTargetPlatformVersion" element in
the vcxproj xml file, under "Global" property group like this:

<PropertyGroup Label="Globals">
<ProjectGuid>{E0F9C6B0-1947-4EBE-9848-9AB367FFC49E}</ProjectGuid>

<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>

So if we add WindowsTargetPlatformVersion to every project the whole pgsql
solution will compile.
The SDK version number can be obtained from "WindowsSDKVersion" environment
variable.
This is setup when you start with the Visual Studio Command Prompt.
Attached a patch to fix the build system.

Best regards,
Peifeng Qiu

Attachment Content-Type Size
compile-latest-win-sdk-v1.patch application/octet-stream 970 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2019-03-28 15:02:19 Re: monitoring CREATE INDEX [CONCURRENTLY]
Previous Message Adrien NAYRAT 2019-03-28 14:56:11 Re: clean up docs for log_statement_sample_rate