Re: Quick tip on building pg with Visual Studio Build Tools 2019 + small patches - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Quick tip on building pg with Visual Studio Build Tools 2019 + small patches
Date
Msg-id 488b0fa7-7d9c-c4d9-1c4b-c3ec3a399074@dunslane.net
Whole thread Raw
In response to Quick tip on building pg with Visual Studio Build Tools 2019 + small patches  (Craig Ringer <craig.ringer@enterprisedb.com>)
List 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




pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: Replacing pg_depend PIN entries with a fixed range check
Next
From: Daniel Gustafsson
Date:
Subject: Re: Avoid repeated PQfnumber() in pg_dump