aws-sdk-cpp icon indicating copy to clipboard operation
aws-sdk-cpp copied to clipboard

Missing debug PDB files when building and installing with cmake

Open nanocom opened this issue 1 year ago • 4 comments

Describe the bug

When building the SDK in debug mode with cmake, it generates the .pdb files alongside the dlls in the build/src folder But when installing, the pdb files are not copied in the install folder

In the build folder: image

In the install folder: image

I would like these debug files to be able to have more detailed stacktraces on sentry

Expected Behavior

Copy the pdb files in the install folder along the dlls in debug mode

Current Behavior

Pdb files are not copied alongside the dll files during the cmake installation

Reproduction Steps

Build the sdk in debug mode

Possible Solution

Maybe add something like this somewhere in the cmake file?

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

Additional Information/Context

My build script:

cmake -B build `
-DCMAKE_BUILD_TYPE=Debug `
-DCMAKE_INSTALL_PREFIX=install `
-DENABLE_TESTING=OFF `
-DAUTORUN_UNIT_TESTS=OFF `
-DCPP_STANDARD=20 `
-DBUILD_ONLY="s3;transfer"

cmake --build build --config=Debug

cmake --install build --prefix install --config Debug

AWS CPP SDK version used

1.11.328

Compiler and Version used

MSVC 14.39.33519

Operating System and version

Windows 11

nanocom avatar May 15 '24 14:05 nanocom

This is a duplicate of this issue: https://github.com/aws/aws-sdk-cpp/issues/1936 closing this one

jmklix avatar May 24 '24 23:05 jmklix

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar May 24 '24 23:05 github-actions[bot]

i don't think it's a duplicate, the pdb files are well generated when compiling on my computer, but they just aren't copied

nanocom avatar May 25 '24 08:05 nanocom

@jmklix

nanocom avatar May 25 '24 08:05 nanocom

I also don't think it's a duplicate. Will it be fixed anytime soon?

oleg-boulanov avatar May 23 '25 13:05 oleg-boulanov

It may be a blocking issue for enterprise use. Without PDB files, we can't run Veracode scans, so we can't use the library in production environment. Can its priority be elevated, please?

oleg-boulanov avatar Aug 27 '25 20:08 oleg-boulanov

As of 1.11.655, installation will include .pdb files. This change affects all aws-sdk-cpp-xxx libraries but does not extend to dependencies we consume.

sbaluja avatar Sep 25 '25 16:09 sbaluja

Thank you.

Trying to run the usual build process:

13:19:44  C:\j\74bd46\src\aws-sdk-cpp\build\Release\Win32>"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" ..\..\..                    
     -G "Visual Studio 17 2022"                 
      -A Win32                    
      -DCMAKE_BUILD_TYPE=Release                 
      -DCMAKE_INSTALL_PREFIX="..\..\..\..\install"                  
      -DBUILD_ONLY="bedrock-runtime;s3"                     
      -DBUILD_SHARED_LIBS=OFF  

fails with multiple errors

...
13:20:25  -- Custom memory management disabled
13:20:25  -- Performing Test AWS_HAS_ALIGNED_ALLOC
13:20:26  -- Performing Test AWS_HAS_ALIGNED_ALLOC - Failed
13:20:26  -- Configuring done (42.1s)
13:20:26  CMake Error:
13:20:26    Error evaluating generator expression:
13:20:26  
13:20:26      $<TARGET_PDB_FILE:aws-cpp-sdk-bedrock-runtime>
13:20:26  
13:20:26    TARGET_PDB_FILE is allowed only for targets with linker created artifacts.
13:20:26  
13:20:26  
13:20:26  CMake Error:
13:20:26    Error evaluating generator expression:
13:20:26  
13:20:26      $<TARGET_PDB_FILE:aws-cpp-sdk-bedrock-runtime>
13:20:26  
13:20:26    TARGET_PDB_FILE is allowed only for targets with linker created artifacts.
...

Did not change anything on my side. What am I missing?

oleg-boulanov avatar Sep 25 '25 17:09 oleg-boulanov

@oleg-boulanov The TARGET_PDB_FILE specifier only works for shared libraries or executables. I've made a PR (#3567) to address this bug, but for now this is failing due to -DBUILD_SHARED_LIBS=OFF.

sbaluja avatar Sep 25 '25 20:09 sbaluja

Thank you, @sbaluja Will you update this ticket after the PR is merged, please?

oleg-boulanov avatar Sep 25 '25 20:09 oleg-boulanov

Fix has been merged and will be apart of today's release.

sbaluja avatar Sep 26 '25 14:09 sbaluja

OK, tried building the latest 1.11.657, the issue persists.

  • only some *.pbd files are created
    • No aws-cpp-sdk-bedrock-runtime.pdb or aws-cpp-sdk-core.pdb created
  • even those created are not copied to install folder
09:51:07  C:\j\a515e9\src>git clone --branch 1.11.657 --recurse-submodules https://github.com/aws/aws-sdk-cpp 
09:51:07  Cloning into 'aws-sdk-cpp'...
09:52:03  Note: switching to '7c054be4157903a1f6be13cd7a379da8411b0c0e'.

09:54:05  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32>"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" ..\..\..
                         -G "Visual Studio 17 2022"
                         -A Win32
                         -DCMAKE_BUILD_TYPE=Debug
                         -DCMAKE_INSTALL_PREFIX="..\..\..\..\install"
                         -DBUILD_ONLY="bedrock-runtime"
                         -DBUILD_SHARED_LIBS=OFF      

09:54:46  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32>"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --build   . --config=Debug 

10:02:57  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32>"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --install . --config=Debug 

10:02:58  C:\j\a515e9\src\aws-sdk-cpp>dir /b /s /on *.lib *.dll *.pdb 
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\bin\Debug\aws-cpp-sdk-bedrock-runtime-integration-tests.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\bin\Debug\aws-cpp-sdk-core-tests.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\bin\Debug\bedrock-runtime-gen-tests.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-auth\Debug\aws-c-auth.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-auth\Debug\aws-c-auth.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-cal\Debug\aws-c-cal.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-cal\Debug\aws-c-cal.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-common\Debug\aws-c-common.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-common\Debug\aws-c-common.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-compression\Debug\aws-c-compression.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-compression\Debug\aws-c-compression.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-event-stream\Debug\aws-c-event-stream.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-event-stream\Debug\aws-c-event-stream.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-http\Debug\aws-c-http.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-http\Debug\aws-c-http.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-io\Debug\aws-c-io.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-io\Debug\aws-c-io.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-mqtt\Debug\aws-c-mqtt.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-mqtt\Debug\aws-c-mqtt.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-s3\Debug\aws-c-s3.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-s3\Debug\aws-c-s3.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-sdkutils\Debug\aws-c-sdkutils.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-c-sdkutils\Debug\aws-c-sdkutils.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-checksums\Debug\aws-checksums.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\crt\aws-checksums\Debug\aws-checksums.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\Debug\aws-crt-cpp.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\crt\aws-crt-cpp\Debug\aws-crt-cpp.pdb
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\generated\src\aws-cpp-sdk-bedrock-runtime\Debug\aws-cpp-sdk-bedrock-runtime.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\src\aws-cpp-sdk-core\Debug\aws-cpp-sdk-core.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\tests\testing-resources\Debug\aws_test_main.lib
10:02:58  C:\j\a515e9\src\aws-sdk-cpp\build\Debug\Win32\tests\testing-resources\Debug\testing-resources.lib
10:02:59  C:\j\a515e9\src\aws-sdk-cpp\crt\aws-crt-cpp\crt\aws-lc\util\ar\testdata\windows\sample.lib

10:03:03  C:\j\a515e9\src\install>dir /b /s /on *.lib *.dll *.pdb 
10:03:03  C:\j\a515e9\src\install\lib\aws-c-auth.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-c-cal.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-c-common.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-c-compression.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-c-event-stream.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-checksums.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-c-http.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-c-io.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-c-mqtt.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-cpp-sdk-bedrock-runtime.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-cpp-sdk-core.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-crt-cpp.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-c-s3.lib
10:03:03  C:\j\a515e9\src\install\lib\aws-c-sdkutils.lib
10:03:03  C:\j\a515e9\src\install\lib\testing-resources.lib

oleg-boulanov avatar Sep 29 '25 14:09 oleg-boulanov

If building of shared libraries is requested (-DBUILD_SHARED_LIBS=ON), some *.pbd files do get created, but inconsistently with the others:

10:49:11  C:\j\c2ea7d\src\install>dir /b /s /on *.lib *.dll *.pdb 
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-auth.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-cal.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-common.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-compression.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-event-stream.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-checksums.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-http.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-io.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-mqtt.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-cpp-sdk-bedrock-runtime.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-cpp-sdk-bedrock-runtime.lib
10:49:11  C:\j\c2ea7d\src\install\bin\aws-cpp-sdk-bedrock-runtime.pdb
10:49:11  C:\j\c2ea7d\src\install\bin\aws-cpp-sdk-core.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-cpp-sdk-core.lib
10:49:11  C:\j\c2ea7d\src\install\bin\aws-cpp-sdk-core.pdb
10:49:11  C:\j\c2ea7d\src\install\bin\aws-crt-cpp.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-s3.dll
10:49:11  C:\j\c2ea7d\src\install\bin\aws-c-sdkutils.dll
10:49:11  C:\j\c2ea7d\src\install\bin\testing-resources.dll
10:49:11  C:\j\c2ea7d\src\install\bin\testing-resources.lib
10:49:11  C:\j\c2ea7d\src\install\bin\testing-resources.pdb
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-auth.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-cal.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-common.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-compression.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-event-stream.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-checksums.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-http.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-io.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-mqtt.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-crt-cpp.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-s3.lib
10:49:11  C:\j\c2ea7d\src\install\lib\aws-c-sdkutils.lib

oleg-boulanov avatar Sep 29 '25 15:09 oleg-boulanov

The TARGET_PDB_FILE specifier only works for shared libraries or executables so -DBUILD_SHARED_LIBS=OFF will not install the pdb files. The current fix only installs aws-cpp-sdk-xxx PDB's, and does not extend to dependencies we consume.

sbaluja avatar Sep 30 '25 15:09 sbaluja

@sbaluja Thank you for explanation. I guess I will have to live with it, even it's somewhat unusual to see dependency dlls and libs placed in different folders

oleg-boulanov avatar Sep 30 '25 18:09 oleg-boulanov