bazelbuild / bazelbuild/bazel

PDB for shared libraries are not copied to the binary output folder

Open
#11,083 5 comments 0 reactions 0 assignees View on GitHub
P4 platform: windows stale team-Rules-CPP type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### 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

Contributor guide

Open the contributing guide

Research direction

Start with the minimal reproduction repository linked in the issue and reproduce the Windows build using cc_binary and cross-package cc_library targets with linkstatic = False. Trace how the shared DLLs are copied to the binary output and verify that the corresponding PDB files are copied alongside them when the fix is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.