brpc linux 下编译构建
brpc 在 linux 下编译构建,比在 mac 下还要更复杂些,mac 下可以走官方说明编译成功,过程中也需要进行一些配置调整。
在 linux 通过 bazel 最终实现了 brpc 编译通过。
相关版本 centos 版本 7,gcc版本7.5 bazel 版本 2.0.0
brpc 版本 1.0,gflags 、protobuf、leveldb 相关版本因网络加载慢原因,通过bazel WORKSPACE 中链接下载下来配置到本地实现。
bazel WORKSPACE 配置进行本地化调整
workspace(name = "com_github_brpc_brpc") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") skylib_version = "0.8.0" http_archive( name = "bazel_skylib", type = "tar.gz", url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib.{}.tar.gz".format (skylib_version, skylib_version), sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e", ) local_repository( name = "rules_cc", path = "/root/rules_cc-8bd6cd75d03c01bb82561a96d9c1f9f7157b13d0", ) local_repository( name = "rules_java", path = "/root/rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178", ) local_repository( name = "com_google_protobuf", path = "/root/protobuf-3.6.1.3", ) local_repository( name = "com_github_gflags_gflags", path = "/root/gflags-46f73f88b18aee341538c0dfc22b1710a6abedef", ) bind( name = "gflags", actual = "@com_github_gflags_gflags//:gflags", ) new_local_repository( name = "com_github_google_leveldb", path = "/root/leveldb-a53934a3ae1244679f812d998a4f16f2c7f309a6", build_file = "//:leveldb.BUILD", ) http_archive( name = "com_github_google_glog", build_file = "//:glog.BUILD", strip_prefix = "glog-a6a166db069520dbbd653c97c2e5b12e08a8bb26", url = "https://github.com/google/glog/archive/a6a166db069520dbbd653c97c2e5b12e08a8bb26.tar.gz" ) http_archive( name = "com_google_googletest", strip_prefix = "googletest-0fe96607d85cf3a25ac40da369db62bbee2939a5", url = "https://github.com/google/googletest/archive/0fe96607d85cf3a25ac40da369db62bbee2939a5.tar.gz", ) new_local_repository( name = "openssl", path = "/usr", build_file = "//:openssl.BUILD", ) new_local_repository( name = "openssl_macos", build_file = "//:openssl.BUILD", path = "/usr/local/opt/openssl", ) bind( name = "ssl", actual = "@openssl//:ssl" ) bind( name = "ssl_macos", actual = "@openssl_macos//:ssl" ) new_local_repository( name = "zlib", build_file = "//:zlib.BUILD", path = "/usr", )
编译命令
brpc bazel编译:
bazel build //:protoc-gen-mcpack --incompatible_disable_deprecated_attr_params=false --incompatible_new_actions_api=false
echo_c++_server bazel编译:
bazel build //example:echo_c++_server --incompatible_disable_deprecated_attr_params=false --incompatible_new_actions_api=false --copt -DHAVE_ZLIB=1
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
2017-08-17 spring 4.1 xml配置头部信息 maven配置信息
2017-08-17 google像apple 30亿美元购买流量
2017-08-17 spring 启动异常Failed to read candidate component class
2016-08-17 商业