C++ quickstart need add com_github_google_benchmark rule in WORKSPACE
Closed this issue · 6 comments
I follow https://abseil.io/docs/cpp/quickstart.html Set Up a Bazel Workspace to Work with Abseil
instructions to setup bazel, but run command bazel test --test_tag_filters=-benchmark @com_google_absl//...
failed with following error:
no such package '@com_github_google_benchmark//': The repository '@com_github_google_benchmark' could not be resolved and referenced by '@com_google_absl//absl/time/internal/cctz:cctz_benchmark'
So I Copy com_github_google_benchmark
rule from Abseil WORKSPACE file and it works.
Maybe we need add com_github_google_benchmark
into WORKSPACE for quickstart instruction
Derek, can you comment on this?
Good catch. I sent a CL to update the documentation.
I could not find the CL with the documentation update, so for anyone who is having the same issue, here is what I did to get the unit tests to run on my computer. At first I got the same error as @qhsong. I added
http_archive(
name = "com_github_google_benchmark",
urls = ["https://github.com/google/benchmark/archive/master.zip"],
strip_prefix = "benchmark-master",
)
to my WORKSPACE
file and was then able to successfully run the Abseil tests using the command bazel test --test_tag_filters=-benchmark @com_google_absl//...
.
For some reason the change never got exported back to GitHub. I'll make sure that happens.
@nashirj I actually don't recommend using the master.zip file because you lose build reproducibility. See https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#what-is-live-at-head-and-how-do-i-do-it.
An easy way to get an up-to-date rule for com_github_google_benchmark
is to copy it out of https://github.com/abseil/federation-head/blob/master/federation_deps.bzl.
@derekmauro Thanks for the note/link explaining why not to use the master.zip file and where to find up-to-date rules for the federation libraries.
The documentation at https://abseil.io/docs/cpp/quickstart.html has been updated.