0

I'm trying to follow the instructions here to add PGO for my project. After I added the /GENPROFILE flag, I start getting the link error:

LINK : fatal error LNK1104: cannot open file 'pgort.lib'

After debugging it a bit, I believe the problem is that my Library Directories (found under VC++ Directories tab) has a value of $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) which is evaluating to:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\atlmfc\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\lib\x64
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\UnitTest\lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\lib\um\x64

It looks like the .\spectre\x64 paths don't have the pgort.lib library, but the non-spectre path does:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\x64

What do I do to fix this? I find it hard to believe that if I'm using the spectre binaries (which I am not even sure how/why I am in the first place) that I can't optimize my project.

BTW, I tried this on a machine with Enterprise VS installed and it's the same. So this isn't specific to Community edition.

Nick Banks
  • 4,298
  • 5
  • 39
  • 65
  • Just copy it, can't imagine how it is critical to spectre counter-measures. – Hans Passant May 24 '20 at 20:34
  • This is an open source project that a few people work on, so I'd like to have some automated approach here. I was considering setting the LibraryPath to `$(LibraryPath);$(VC_LibraryPath_VC_x64_Desktop)` when compiling for PGO. But you think I should just copy pgort.lib into the spectre folder as a part of my build script (if not already there)? – Nick Banks May 24 '20 at 20:39

1 Answers1

1

I ended up updating my build configuration/scripts to dynamically update the LibraryPath to add the appropriate, architecture-specific version of $(VC_LibraryPath_VC_x64_Desktop) when compiling for PGO.

Nick Banks
  • 4,298
  • 5
  • 39
  • 65