Re: Compile from source using latest Microsoft Windows SDK

From: Peifeng Qiu <pqiu(at)pivotal(dot)io>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Compile from source using latest Microsoft Windows SDK
Date: 2019-07-19 07:39:49
Message-ID: CABmtVJhCU-qR6TAPgGPw5RrARMU0TUV1Y6Ex=cZhvbM1BpPAvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Michael. Thanks for your review.
I updated the patch to only include the WindowsTargetPlatformVersion node
if WindowsSDKVersion is present.
I can confirm that this issue no longer exists for VS2019. So only VS2017
is problematic.

I'm also very curious on how hamerkop and bowerbird build postgres with
VS2017.
Looks like hamerkop and bowerbird both exist before VS2017 and maybe they
get SDK v8.1 from previous
VS installations. I will contact admin of hamerkop and bowerbird and see if
that's the case.
As of now I can still encounter the same issue with fresh installed Windows
Server 2016 and
VS2017, on both azure and google cloud. So better to patch the build system
anyway.

Peifeng Qiu
Best regards,

On Thu, Jul 18, 2019 at 4:09 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> Hi Peifeng,
>
> On Fri, Mar 29, 2019 at 12:01:26AM +0900, Peifeng Qiu wrote:
> > 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.
>
> Actually up to 10, no? Sorry for the delay, I have just noticed this
> patch registered in the commit fest. And now is review time.
>
> > 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.
>
> So... This actually boils down to that behavior:
>
> https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html
>
> While WindowsSDKVersion seems to be present all the time. I think
> that we should be more defensive if the variable is not defined, and
> instead rely on the default provided by the system, whatever it may
> be. In short it seems to me that the tag WindowsTargetPlatformVersion
> should be added only if the variable exists, and your patch always
> sets it.
>
> For anything with Postgres on Windows, I have been using Visual Studio
> 2015 and 2019 lately to compile Postgres mainly with the Native Tools
> command prompt so I have never actually faced this failure even with
> the most recent VS 2019. Using just a command prompt causes a failure
> when finding out nmake for example as that's not in the default PATH.
> Our buildfarm members don't complain either, and there are two animals
> using VS 2017: hamerkop and bowerbird.
> --
> Michael
>

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ian Barwick 2019-07-19 08:08:39 [PATCH] minor bugfix for pg_basebackup (9.6 ~ )
Previous Message Laurenz Albe 2019-07-19 06:50:17 Re: pg_receivewal documentation