docs.rs failed to build ofi-libfabric-sys-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Motivation
Increasing number of HPC networking code is being written in Rust. Naturally, to support Libfabric usage in Rust, there needs a proper Rust library that wraps Libfabric APIs written in C. This practice is commonly referred as a Rust binding / FFI (foreign function interface).
This library builds a lightweight Rust binding via bindgen. Lightweight, meaning
there's no additional abstraction on top of the automatically generated code via
bindgen, aside from the wrapper.[ch] which is strictly used to support
static inline functions to be properly bound, by introducing a new translation
unit upon compilation.
Build
// Clean the existing build.
cargo clean
// Build, using the Libfabric binary that is compiled on-the-fly.
cargo build --features vendored
// Build, using the already installed Libfabric.
// You may be required to set `PKG_CONFIG_PATH` env variable to point towards `libfabric.pkg` file.
cargo build
// Unit-tests.
cargo test
// Unit-tests with ASAN enabled.
cargo test --features asan
How to use the library
Add the crate dependency under your Rust application's Cargo.toml file. Then;
use bindgen as ffi;
Files
build.rs: The actual build script for the bindgen.src/lib.rs: The generated binding is copy-pasted programmatically and publicly exported underbindingsnamespace.wrapper.[ch]: Wrapper source files that simply calls the static inline functions. This way, an isolated translation unit for each static inline function is made, for which the Rust bindgen is able to link against it.tests/unit_test.rs: Unit tests.