aws / aws-sdk-cpp

AWS SDK for C++
Apache License 2.0
1.99k stars 1.06k forks source link

PDB files generated for some but not all projects #1936

Open Mike4Online opened 2 years ago

Mike4Online commented 2 years ago

Describe the bug

When building AWS SDK for C++ version 1.9.267, for Windows, as static libraries, some of the Debug|x64 builds fail to generate a .pdb file along with the .lib file.

Expected Behavior

All .vcxproj files generated by CMake should specify:

<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>

within Debug build configurations (also in RelWithDebugInfo build configurations).

.pdb files should be generated by default for all Debug builds on Windows.

Current Behavior

After running the following two commands from the CMake build directory I created...

cmake ..\aws-sdk-cpp -DCMAKE_BUILD_TYPE="Debug" -DBUILD_ONLY="s3" -DBUILD_SHARED_LIBS="OFF" -DFORCE_SHARED_CRT="OFF" -DENABLE_TESTING="OFF"

"C:\Program Files\Microsoft Visual Studio\2022\Professional\Msbuild\Current\Bin\MSBuild.exe" ALL_BUILD.vcxproj -target:Rebuild -property:Configuration=Debug;Platform=x64 -maxCpuCount:7

...I can then find a .pdb file IN ONLY THE LAST of the following three output folders:

..\CodeRepos\sdk_build_debug\aws-cpp-sdk-core\Debug
..\CodeRepos\sdk_build_debug\aws-cpp-sdk-s3\Debug
..\CodeRepos\sdk_build_debug\crt\aws-crt-cpp\Debug

Upon examining the .vcxproj files generated by CMake, only the one for aws-crt-cpp specifies:

<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>

..within the ItemDefinitionGroup for Debug|x64. The other two .vcxproj files instead specify:

<DebugInformationFormat>OldStyle</DebugInformationFormat>

and therefore fail to generate a .pdb file.

Reproduction Steps

See "Current Behavior", reported above, for reproduction steps.

Possible Solution

..alter the CMake files for each AWS SDK project, so when a VC++ project is generated by CMake, the ItemDefinitionGroup for each Debug|x64 build in each AWS SDK project will specify:

<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>

rather than:

<DebugInformationFormat>OldStyle</DebugInformationFormat>

The same should be done for Debug|Win32 build configurations, as well as all RelWithDebugInfo build configurations.

Since the CMake files which back the aws-crt-cpp project are already doing this properly, they can be used as a model in this regard for other CMake projects within the AWS SDK for C++.

Additional Information/Context

No response

AWS CPP SDK version used

1.9.267

Compiler and Version used

Visual Studio 2022 build 17.2.2 - MSVC 19.29.30143.0

Operating System and version

Windows 10 version 21H2 build 19044.1706

jmklix commented 6 months ago

This is still a problem as pointed out in this issue: https://github.com/aws/aws-sdk-cpp/issues/2963

A short term work around would be to manually copy over the pdb files. A long term solution would be to make sure they get copied over in cmake as @nanocom suggests in the duplicate issue:

if (MSVC)
    install(FILES $<TARGET_PDB_FILE:MyExecutable> DESTINATION bin OPTIONAL)
endif()

We are still working on improving the build process, https://github.com/aws/aws-sdk-cpp/issues/1888. I'm not sure when this will get fixed