google / fleetbench

Benchmarking suite for Google workloads
Apache License 2.0
111 stars 9 forks source link

How to use local Protobuf #21

Closed ShabnamSheikhha closed 5 months ago

ShabnamSheikhha commented 5 months ago

Hello,

I am trying to use Fleetbench with my own local Protobuf repo (i.e., build from source). My understanding is that currently Protobuf is loaded from online using Bazel's http_archive. Is it possible to change the Bazel build files to use a local Protobuf version? Is this supported?

rjogrady commented 5 months ago

Hi, There are a couple of ways to do this.

  1. Use bazel's --override_repository command line flag:

bazel build --override_repository=com_google_protobuf=/path/to/protobuf fleetbench/proto/...

  1. Modify the WORKSPACE to use a local_repository rule for protobuf. Replace the http_archive rule for com_google_protobuf with
local_repository(
    name = "com_google_protobuf",
    path = "/path/to/protobuf"
 )

Note that we have only tested that version 24.4 builds and runs, though I assume more recent versions should work.