Skip to content

Document how to build using Bazel #191

@pedrokiefer

Description

@pedrokiefer

After a few rounds of Bazel errors, this is what worked for me:

In MODULE.bazel:

bazel_dep(
    name = "proxy-wasm-cpp-sdk",
    version = "0.0.0",
    repo_name = "proxy_wasm_cpp_sdk",
)

# Use git_override for proxy-wasm-cpp-sdk
git_override(
    module_name = "proxy-wasm-cpp-sdk",
    remote = "https://github.com/proxy-wasm/proxy-wasm-cpp-sdk.git",
    commit = "e5256b0c5463ea9961965ad5de3e379e00486640",
)

In the BUILD with the source code:

load("@proxy_wasm_cpp_sdk//bazel:defs.bzl", "proxy_wasm_cc_binary")

licenses(["notice"])  # Apache 2

proxy_wasm_cc_binary(
    name = "http_wasm_example.wasm",
    srcs = ["http_wasm_example.cc"],
    copts = ["-std=c++20"],
)

then running bazel build //src:http_wasm_example.wasm worked perfectly. Now it's just a matter of creating a scratch image with the built wasm file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions