Skip to content

bazel build //xla/... fails in OSS build due to missing xla_data_proto_py_pb2 target #36720

@samuela

Description

@samuela

Description

Following the developer guide, building all XLA targets with bazel build //xla/... fails during the analysis phase.

Steps to Reproduce

  1. Clone the XLA repository at commit e8247c3ea1d4d7f31cf27def4c7ac6f2ce64ecd4
  2. Run ./configure.py --backend=CPU
  3. Run bazel build //xla/...

Expected Behavior

According to the developer guide, bazel build //xla/... should build all XLA targets successfully.

Actual Behavior

The build fails during analysis with:

ERROR: /build/source/xla/BUILD: no such target '//xla:xla_data_proto_py_pb2': target 'xla_data_proto_py_pb2' not declared in package 'xla' defined by /build/source/xla/BUILD (did you mean xla_data_proto_py?)
ERROR: /build/source/xla/python/tools/BUILD:33:22: no such target '//xla:xla_data_proto_py_pb2': target 'xla_data_proto_py_pb2' not declared in package 'xla' defined by /build/source/xla/BUILD (did you mean xla_data_proto_py?) and referenced by '//xla/python/tools:types'
ERROR: Analysis of target '//xla/python/tools:types' failed; build aborted: Analysis failed

Root Cause Analysis

The //xla/python/tools:types target (in xla/python/tools/BUILD) depends on //xla:xla_data_proto_py_pb2. However, this target is wrapped in copybara:uncomment blocks in xla/BUILD.

While //xla/python/tools:types is tagged with tags = ["no_oss"], the --build_tag_filters=-no_oss flag from configure.py only filters targets at build time, not during analysis. Bazel must still resolve all dependencies during analysis, which fails because xla_data_proto_py_pb2 doesn't exist.

Environment

  • OS: Linux
  • Bazel version: 7.x
  • XLA commit: e8247c3

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions