tricorder-observability / Starship

Starship: next-generation Observability platform built with eBPF+WASM
GNU Affero General Public License v3.0
163 stars 25 forks source link

Use bazel to build C++ code into wasm binary file in WASM byte code format #34

Open nascentcore-eng opened 1 year ago

nascentcore-eng commented 1 year ago

Currently we done it through Makefile with wasi CPP https://github.com/tricorder-observability/starship/blob/main/src/agent/wasm/testdata/pico/Makefile Using local machine's wasi sdk toolchain: https://github.com/WebAssembly/wasi-sdk

https://fossies.org/linux/envoy/bazel/wasm/wasm.bzl https://hackernoon.com/c-to-webassembly-using-bazel-and-emscripten-4him3ymc

Consider use cmd_bash of genrule.

nascentcore-eng commented 1 year ago

We have thought about this, the quick conclusion at this point is that using bazel to build WASM code is not as good as using shell tooling.

The reason is that these code is developed by different teams from different organizations. Which means the porting cost from them to bazel becomes very costly.

On the other hand, from an organizational perspective, the owner of their WASM code would have reservation of adopting Bazel (since it's costly for Tricorder team to fully own that).

A more ambitious direction is for Tricorder to implement compiler and toolchain, which embodies our own preference, and works the best in Tricorder's own ecosystem, and offer that to the community, so that we might have an easier time to integration bazel (or some other build system).