Cannot open file 'pgort.llib' after adding /GENPROFILE flag

202 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

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.