You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
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 theSupport
target.In this case,
ScopedPrinter.cpp
includesScopedPrinter.h
, which forward-declaresDelimitedScope
but never defines it. This leads to the following compile error from the standard library:My project uses Bazel modules and depends on LLVM like this:
And in my
cc_library
: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 removeScopedPrinter.cpp
from the Support target until it's complete.The text was updated successfully, but these errors were encountered: