Skip to content

[Bazel] @llvm-project//llvm:Support fails to build due to incomplete DelimitedScope #139218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hankhsu1996 opened this issue May 9, 2025 · 1 comment
Labels
bazel "Peripheral" support tier build system: utils/bazel invalid Resolved as invalid, i.e. not a bug

Comments

@hankhsu1996
Copy link

hankhsu1996 commented May 9, 2025

When using @llvm-project//llvm:Support as a dependency in a Bazel-based C++ project, the build fails even before any actual LLVM headers are included. This happens because Bazel eagerly compiles all sources listed in the Support target.

In this case, ScopedPrinter.cpp includes ScopedPrinter.h, which forward-declares DelimitedScope but never defines it. This leads to the following compile error from the standard library:

error: invalid application of 'sizeof' to an incomplete type 'llvm::DelimitedScope'

My project uses Bazel modules and depends on LLVM like this:

bazel_dep(name = "llvm-project", version = "17.0.3.bcr.2")

And in my cc_library:

deps = ["@llvm-project//llvm:Support"]

Even without writing any code that includes LLVM headers, Bazel tries to compile all of Support’s sources and fails due to this issue.

Suggested fix: define DelimitedScope or remove ScopedPrinter.cpp from the Support target until it's complete.

@hankhsu1996
Copy link
Author

This issue is not caused by LLVM upstream. It turns out the problem only exists in the LLVM Bazel module version 17.0.3.bcr.2 used via BCR. The current LLVM codebase has already fixed this issue.

@EugeneZelenko EugeneZelenko added invalid Resolved as invalid, i.e. not a bug bazel "Peripheral" support tier build system: utils/bazel and removed new issue labels May 9, 2025
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel invalid Resolved as invalid, i.e. not a bug
Projects
None yet
Development

No branches or pull requests

3 participants