docs: add Bazel build guide and bzlmod example - #11
Closed
cw20050111-prog wants to merge 17 commits into
Closed
Conversation
Reviewer noted docs/cn/urma.md only covered the CMake build and that DOWNLOAD_URMA_HEADERS has no Bazel equivalent. Document the Bazel build command and clarify that Bazel always fetches UMDK headers from the pinned git_repository commit and always links the mock backend (no real-liburma detection yet), and that urma_performance has no Bazel target.
bazel/third_party/umdk only contained umdk.BUILD, unlike every other bazel/third_party/<dep> directory which pairs its <dep>.BUILD with an empty BUILD.bazel marking the directory as a package. Without it, resolving the git_repository(build_file = "//bazel/third_party/umdk:umdk.BUILD") label fails once the umdk repo is actually fetched: Error in read: Unable to load package for //bazel/third_party/umdk:umdk.BUILD: BUILD file not found ... This broke `bazel build --define=BRPC_WITH_URMA=true //:brpc` on both x86_64 and arm64 (confirmed via GitHub Actions CI on ubuntu-22.04 and ubuntu-24.04-arm).
…works The umdk repo ships its own src/urma/BUILD.bazel, which makes Bazel treat src/urma/ as a separate package. glob() in our umdk.BUILD (rooted at the umdk repo root) can't cross that boundary, so hdrs = glob(["src/urma/lib/urma/**/include/*.h"]) silently resolved to an empty list. The cc_library then exported no header inputs, so compiling anything that #includes urma_api.h failed with "No such file or directory" even though the -isystem path was correct and the file existed on disk. Confirmed via GitHub Actions on both ubuntu-22.04 (x86_64) and ubuntu-24.04-arm (arm64): `bazel build --define=BRPC_WITH_URMA=true //:brpc` failed identically on both before this patch_cmds fix.
Reviewer dwh110 pointed out that src/brpc/urma/mock_urma.cpp had no independent feature switch: whenever liburma wasn't found, CMake/Make silently linked the mock, which can produce a binary that looks URMA-capable but can't reach real hardware. Add WITH_URMA_MOCK (CMake) / --with-urma-mock (config_brpc.sh), default OFF. When WITH_URMA is enabled and liburma isn't found, the build now fails with a clear message unless the mock is explicitly requested, instead of substituting it implicitly. Document the new flag in docs/en/urma.md and docs/cn/urma.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add conditional linking for URMA library based on availability.
Added a comment regarding linking with liburma based on brpc build options.
Added logic to find the URMA library and handle its absence.
Removed conditional check for URMA library and related messages.
Update logic for linking liburma based on header presence.
- ci-linux.yml: new compile-and-test-with-urma job builds with -DWITH_URMA=ON against the openEuler-mirror UMDK headers on GitHub (avoids the atomgit.com dependency) and runs brpc_urma_unittest with the link-time mock, since no URMA hardware is available on runners. - mock_urma.cpp: add urma_user_ctl(), referenced by SetBondingMode() whenever urma_ubagg.h is available; without it, WITH_URMA=ON fails to link against the mock. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JX6CCou3VWh8ZxRR4x6zvY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: resolve apache#2991
Problem Summary:
The official documentation currently only describes CMake and config_brpc.sh build steps. It lacks Bazel build instructions, making it harder for developers to understand how to build and use bRPC with Bazel.
What is changed and the side effects?
Changed:
example/build_with_bazel_modulewith runnable server/client targets.MODULE.bazelsetup for using bRPC as a Bazel dependency.single_version_overrideentries forleveldbandopenssl, and document that users must repeat these overrides in their own rootMODULE.bazel.Side effects:
Performance effects: None.
Breaking backward compatibility: None.
Check List: