Skip to content

Suggestions on building simple_switch_grpc with bazel 8.5.0 #1346

@Vineet1101

Description

@Vineet1101

Hi everyone,

I am currently working on adding support for Bazel 8.5.0 to BMv2's simple_switch_grpc. I have already created some basic Bazel build files and dependencies, and the initial setup is working.

Before moving further, I would like to confirm the correct approach for handling PI library dependencies.

The PI submodule (PI/) expects the PI headers to be installed system-wide (e.g., PI/pi.h, PI/target/pi_imp.h, PI/p4info.h). In the current CMake build, these come from a pre-installed PI system library.

For Bazel, I see two possible approaches:

1. Build BMv2’s PI implementation directly from the local PI submodule sources
This would involve compiling the .cpp files under PI/src/.
However, this would only cover the BMv2 PI implementation, and would not include the upstream PI framework libraries such as:

  • pifeproto
  • pigrpcserver
  • pi
  • pip4info

which are used by some tests.

2. Import the full p4lang/PI repository as a Bazel dependency
This could be done using bazel_dep or git_override in MODULE.bazel, which would allow building the PI framework libraries as well.

However, the upstream PI repository currently uses WORKSPACE-based Bazel, not bzlmod, so this might require some compatibility adjustments.

Both approach have their own pros and cons, so can someone please advise which approach would be preferred for integrating Bazel support into BMv2?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions