git clone https://github.com/tikv/grpc-rs.git
- Change to the repo's directory and build:
cd tikv/grpc-rs
cargo xtask submodule
cargo build
cd grpc-sys/grpc/third_party
tar -zcf abseil-cpp.bak.tar.gz abseil-cpp/
cd tikv/grpc-rs
git rm --cached grpc-sys/grpc
cd grpc-sys/
mv grpc grpc-bak
cp -rf TiDBOverRoCE/grpc ./grpc
cd grpc-rs/grpc-sys/
vim build.rs
Add the following code in build.rs line 233:
println!("cargo:rustc-link-search=all=/usr/lib/x86_64-linux-gnu");
println!("cargo:rustc-link-lib=dylib=rdmacm");
println!("cargo:rustc-link-lib=dylib=ibverbs");
Notice: In most cases, librdmacm/libverbs are installed in /usr/lib/x86_64-linux-gnu on x64 platforms, or your own compiled path if the libs are built from source
vim grpc-rs/xtask/src/main.rs
Find the implementation of submodule() and comment the codes in submodule() to disable git submodule update :
fn submodule() {
//
// origin code
//
}
cp -rf grpc-sys/grpc-bak/third_party/abseil-cpp/ grpc-sys/grpc/third_party
Or extract the abseil-cpp.bak.tar.gz to grpc-sys/grpc/third_party
cd grpc-rs/
cargo xtask submodule
cargo build
git clone https://github.com/tikv/tikv.git
Modify the dependency on grpc-rs in tikv, open the tikv/Cargo.toml and add following code in [patch.crates-io] :
[patch.crates-io]
...
grpcio = { path = "..(local path)/grpc-rs", version = "0.9", default-features = false, features = ["openssl-vendored"]}
grpcio-health = { path = "..(local path)/grpc-rs/health", version = "0.9", default-features = false}
cd tikv/
make build