Re: Quick tip on building pg with Visual Studio Build Tools 2019 + small patches

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Craig Ringer <craig(dot)ringer(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Quick tip on building pg with Visual Studio Build Tools 2019 + small patches
Date: 2021-07-14 20:28:13
Message-ID: 488b0fa7-7d9c-c4d9-1c4b-c3ec3a399074@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 7/13/21 2:10 AM, Craig Ringer wrote:
>
>
> If you don't have the toolchain installed, you can install Chocolatey
> (there's a one-liner on their website) then:
>
>     choco install -y visualstudio2019buildtools
>
>     choco install -y visualstudio2019-vc++ --packageparameters "--add
> Microsoft.VisualStudio.Component.VC.140"

The first of these is probably redundant, and the second might install
more than required. Here's my recipe for what I use in testing patches
with MSVC:

choco install -y --no-progress --limit-output
visualstudio2019-workload-vctools --install-args="--add
Microsoft.VisualStudio.Component.VC.CLI.Support"

That gives you the normal command line compilers. After that these
packages are installed:

vcredist140 14.29.30037
visualstudio-installer 2.0.1
visualstudio2019-workload-vctools 1.0.1
visualstudio2019buildtools 16.10.1.0

>
> You may also want
>
>     choco install -y winflexbison
>
> (I've attached a patch that teaches pgflex.pl <http://pgflex.pl> and
> pgbision.pl <http://pgbision.pl> to use win_flex.exe and win_bison.exe
> if they're found, and to accept full paths for these tools in
> buildenv.pl <http://buildenv.pl>).

A simpler alternative is just to rename the chocolatey shims. Here's a
ps1 fragment I use:

    $cbin = "c:\ProgramData\chocolatey\bin"
    Rename-Item -Path $cbin\win_bison.exe -NewName bison.exe
    Rename-Item -Path $cbin\win_flex.exe -NewName flex.exe

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-07-14 21:34:51 Re: Avoid repeated PQfnumber() in pg_dump
Previous Message John Naylor 2021-07-14 20:10:26 Re: Replacing pg_depend PIN entries with a fixed range check