Re: BUG #15889: PostgreSQL failed to build due to error MSB8020 with MSVC on windows

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: gaolin01(at)beyondsoft(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: kommi(dot)haribabu(at)gmail(dot)com
Subject: Re: BUG #15889: PostgreSQL failed to build due to error MSB8020 with MSVC on windows
Date: 2019-07-03 11:35:51
Message-ID: 20190703113551.GH3084@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

(Adding Hari who has helped with this work.)

On Wed, Jul 03, 2019 at 09:10:34AM +0000, PG Bug reporting form wrote:
> PostgreSQL failed to build due to error MSB8020: The build tools for v142
> (Platform Toolset = 'v142') cannot be found with MSVC on windows. It can be
> first reproduced on master branch 2b1394fc2b52a2573d08aa626e7b49568f27464e
> reversion which is 'Add support for Visual Studio 2019 in build scripts'.
>
> Further investigation we found that VS2017 does not seem to be supported in
> this commit. We mainly use open source projects to test VS compilers.
> Currently we are using VS2017 and there is no plan to migrate to VS2019.
> Could you please help look at this issue and provide a work around to us to
> solve this issue? Thanks a lot!

Mumble. VS 2017 should be supported in our builds.

It happens that we do have a buildfarm member called bowerbird which
uses Visual Studio 2017, and this is not complaining at all:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2019-07-02%2018%3A30%3A56

So at first sight the logic we have does not seem that wrong because
it has already tested the commit which adds VS 2019 :)

> Failures:
> C:\Program Files (x86)\Microsoft Visual
> Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(57,5):
> error MSB8020: The build tools for v142 (Platform Toolset = 'v142') cannot
> be found. To build using the v142 build tools, please install v142 build
> tools. Alternatively, you may upgrade to the current Visual Studio tools by
> selecting the Project menu or right-click the solution, and then selecting
> "Retarget solution". [D:\PostgreSQL\src\postgres.vcxproj]

Looking at the code, it looks to be an effect of the version checking
in CreateProject()/MSBuildProject.pm, causing a VC2019Project object
to be generated instead of a VC2017Project one. Your scripts seem to
be rather advanced, and I have little idea how your installation looks
like. What's the return result of DetermineVisualStudioVersion()?
With VS 2017, the result is assumed to be between 14.10 and 14.20 as
far as I know. You can also know that by looking at the version of
nmake shipped with your installation using the native tool terminal
for example. I guess that in your case the version of nmake is
between 14.20.XX.YY and 15.00.NN.PP?
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2019-07-03 13:01:41 Re: BUG #15890: Planner can't use index "(col) where col is not null" for query "where col in ($1, $2, ... $100+)"
Previous Message Juan José Santamaría Flecha 2019-07-03 10:10:44 Re: BUG #15889: PostgreSQL failed to build due to error MSB8020 with MSVC on windows