bazel
bazel copied to clipboard
PDB for shared libraries are not copied to the binary output folder
Description of the problem / feature request:
When cc_binary depends on cc_library from the different package and both have linkstatic = False then produced shared library is copied to the output folder of cc_binary, so it can be found at runtime, but library symbols are not copied with it. This makes the debugging of the binary hard.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Repository with the minimal repro: https://github.com/konste/bazel_repro_shared_lib
Build it on Windows and you get hello-world.exe with its hello-world.pdb and a couple shared libraries base_shared.dll and middle_shared.dll, but those come without their PDB files, which is the problem.
What operating system are you running Bazel on?
Windows 10 1809
What's the output of bazel info release?
2.2.0
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 2+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!
@bazelbuild/triage @bazel-io please reopen this
This is still an issue with bazel 8.2.1, and makes debugging bazel executables that use DLLs difficult on windows.
To reproduce (on windows):
git clone https://github.com/konste/bazel_repro_shared_lib
cd bazel_repro_shared_lib
cat > .bazelrc
common --enable_workspace
common --incompatible_disallow_empty_glob=false
common --repo_env=JAVA_HOME=../bazel_tools/jdk
common --action_env=JAVA_HOME=../bazel_tools/jdk
ctrl-D
bazel build //...
dir bazel-bin*.pdb (note, nothing present for each dll) dir bazel-bin\base_shared*.pdb (note, pdb present for dll)
cat >> .bazelrc
common --features="copy_dynamic_libraries_to_binary"
common --output_groups=+pdb_file
common --features="generate_pdb_file"
ctrl-D
bazel build //...
No improvement
I note that there was a possible fix for this that was closed unmerged.
@oquenchil could you reopen this?
It is possible we may have some time to look at this. Could you advise on where the fix might be?